29 lines
905 B
Python
29 lines
905 B
Python
import pytest
|
|
import subprocess
|
|
|
|
PORT = 5055
|
|
ALL_IPS = [
|
|
"172.22.156.3",
|
|
"172.22.158.2",
|
|
"172.22.94.2",
|
|
"172.22.156.4",
|
|
"172.22.158.3",
|
|
"172.22.94.3",
|
|
"172.22.156.5",
|
|
"172.22.158.4",
|
|
"172.22.94.4",
|
|
"172.22.156.6"
|
|
]
|
|
|
|
#generate log files on all the machines before running this test
|
|
for i, ip in enumerate(ALL_IPS):
|
|
subprocess.run(["ssh", "asing@{ip}", "python3", "generate_log.py", str(i + 1), "100"])
|
|
|
|
#start the server on all the machines before running this test
|
|
for i, ip in enumerate(ALL_IPS):
|
|
subprocess.run(["ssh", "asing@{ip}", "python3", "server.py"])
|
|
|
|
#ssh into one machine at randome
|
|
machine_num = random.randint(1, len(ALL_IPS))
|
|
result = subprocess.run(["ssh", f"asing@{ALL_IPS[machine_num - 1]}", "grep", "ERROR", f"./machine.{machine_num}.test.log"], capture_output=True, text=True)
|
|
print(f"Machine {machine_num} grep result:\n{result.stdout}") |