Commit 3153896f authored by Stanislav Bohm's avatar Stanislav Bohm
Browse files

Testing of monitoring

parent 2a4d5863
......@@ -68,14 +68,8 @@ def test_data_service(tmpdir, root_dir):
with pytest.raises(abrpc.RemoteException):
await connection1.call("get_data", "x_1")
s1 = await connection1.call("get_stats")
s2 = await connection2.call("get_stats")
m = s1.pop("resources")
assert "cpu" in m
m = s2.pop("resources")
assert "cpu" in m
s1 = (await connection1.call("get_stats"))["service"]
s2 = (await connection2.call("get_stats"))["service"]
assert s1 == {
"connections": 0,
......@@ -93,14 +87,8 @@ def test_data_service(tmpdir, root_dir):
assert b"123" == await connection1.call("get_data", "x_1", "localhost", PORT2)
assert b"123" == await connection1.call("get_data", "x_1", "localhost", PORT2)
s1 = await connection1.call("get_stats")
s2 = await connection2.call("get_stats")
m = s1.pop("resources")
assert "cpu" in m
m = s2.pop("resources")
assert "cpu" in m
s1 = (await connection1.call("get_stats"))["service"]
s2 = (await connection2.call("get_stats"))["service"]
assert s1 == {
"connections": 1,
......
......@@ -2,7 +2,7 @@ import quake.client as quake
import pytest
import subprocess
from conftest import DOCKER_DIR
import json
@quake.mpi_task(n_processes=2)
def my_sleep():
......@@ -14,8 +14,17 @@ def my_sleep():
def monitor_client(client):
quake.set_global_client(client)
quake.wait(my_sleep())
output = subprocess.check_output(["docker-compose", "exec", "mpihead", "cat", "/tmp/monitoring"], cwd=DOCKER_DIR)
print(output)
import sys
sys.stderr.write("Getting a /tmp/monitoring\n")
output = subprocess.check_output(["docker-compose", "exec", "-T", "mpihead", "cat", "/tmp/monitoring"], cwd=DOCKER_DIR)
lines = output.decode().split("\n")[:-1]
assert len(lines) >= 12
data = [json.loads(line) for line in lines]
hostnames = set()
for value in data:
assert set(value.keys()) == {"timestamp", "resources", "service", "hostname"}
hostnames.add(value["hostname"])
assert hostnames == {"mpihead", "mpinode1", "mpinode2", "mpinode3"}
def test_monitoring(monitor_client):
pass
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment