add unit test flag

This commit is contained in:
Aryan Singh committed 2026-09-12 23:29:06 -05:00
1 parent 9899fd4741
commit 8dfc59f570
2 files changed
+21 -15

No files matched your search

+13 -11
View File
@@ -19,20 +19,22 @@ ALL_IPS = [
#generate log files on all the machines before running this test
print("Generating log files on all machines...")
for i, ip in enumerate(ALL_IPS):
subprocess.run(["vpn", "ssh", f"asing271@{ip}", "cd ~/fa26_cs425_.group-mp_.team-01/MP1 && python3 generate_log.py {i + 1} 100"])
subprocess.run(["vpn", "ssh", f"asing271@{ip}", f"cd ~/fa26_cs425_.group-mp_.team-01/MP1 && python3 generate_log.py {i + 1} 100"])
#start the server on all the machines before running this test
print("Starting server on all machines...")
for i, ip in enumerate(ALL_IPS):
subprocess.run(["vpn", "ssh", f"asing271@{ip}", "cd ~/fa26_cs425_.group-mp_.team-01/MP1 && python3 server.py &"])
# print("Starting server on all machines...")
# for i, ip in enumerate(ALL_IPS):
# print(f"Starting server on machine {i + 1} ({ip})...")
# subprocess.run([
# "vpn", "ssh", f"asing271@{ip}", "cd ~/fa26_cs425_.group-mp_.team-01/MP1 && setsid -f python3 server.py > server.log 2>&1 < /dev/null"])
#ssh into one machine at randome
print("Running grep command on a random machine...")
machine_num = random.randint(1, len(ALL_IPS))
result = subprocess.run(["vpn", "ssh", f"asing271@{ALL_IPS[machine_num - 1]}", "cd ~/fa26_cs425_.group-mp_.team-01/MP1 && grep 'ERROR' f'./machine.{machine_num}.test.log'"], capture_output=True, text=True)
print(f"Machine {machine_num} grep result:\n{result.stdout}")
# print("Running grep command on a random machine...")
# machine_num = random.randint(1, len(ALL_IPS))
# result = subprocess.run(["vpn", "ssh", f"asing271@{ALL_IPS[machine_num - 1]}", f"cd ~/fa26_cs425_.group-mp_.team-01/MP1 && grepp 'ERROR' f'./machine.{machine_num}.test.log'"], capture_output=True, text=True)
# print(f"Machine {machine_num} grep result:\n{result.stdout}")
#delete log files on all the machines after running this test
print("Deleting log files on all machines...")
for i, ip in enumerate(ALL_IPS):
subprocess.run(["vpn", "ssh", f"asing271@{ip}", "cd ~/fa26_cs425_.group-mp_.team-01/MP1 && rm -f ./machine.*.test.log"])
# print("Deleting log files on all machines...")
# for i, ip in enumerate(ALL_IPS):
# subprocess.run(["vpn", "ssh", f"asing271@{ip}", "cd ~/fa26_cs425_.group-mp_.team-01/MP1 && rm -f ./machine.*.test.log"])