MCPcopy Create free account
hub / github.com/It4innovations/hyperqueue / test_worker_list

Function test_worker_list

tests/test_worker.py:13–50  ·  view source on GitHub ↗
(hq_env: HqEnv)

Source from the content-addressed store, hash-verified

11
12
13def test_worker_list(hq_env: HqEnv):
14 hq_env.start_server()
15 table = list_all_workers(hq_env)
16 assert len(table) == 0
17 assert table.header[:2] == ["ID", "State"]
18
19 hq_env.start_workers(2)
20
21 table = list_all_workers(hq_env)
22 assert len(table) == 2
23 table.check_columns_value(["ID", "State"], 0, ["1", "RUNNING"])
24 table.check_columns_value(["ID", "State"], 1, ["2", "RUNNING"])
25
26 hq_env.kill_worker(2)
27 wait_for_worker_state(hq_env, 2, "CONNECTION LOST")
28
29 table = list_all_workers(hq_env)
30 assert len(table) == 2
31 table.check_columns_value(["ID", "State"], 0, ["1", "RUNNING"])
32 table.check_columns_value(["ID", "State"], 1, ["2", "CONNECTION LOST"])
33
34 hq_env.kill_worker(1)
35 wait_for_worker_state(hq_env, 1, "CONNECTION LOST")
36
37 table = list_all_workers(hq_env)
38 assert len(table) == 2
39 table.check_columns_value(["ID", "State"], 0, ["1", "CONNECTION LOST"])
40 table.check_columns_value(["ID", "State"], 1, ["2", "CONNECTION LOST"])
41
42 hq_env.start_worker()
43 wait_for_worker_state(hq_env, 3, "RUNNING")
44
45 table = list_all_workers(hq_env)
46
47 assert len(table) == 3
48 table.check_columns_value(["ID", "State"], 0, ["1", "CONNECTION LOST"])
49 table.check_columns_value(["ID", "State"], 1, ["2", "CONNECTION LOST"])
50 table.check_columns_value(["ID", "State"], 2, ["3", "RUNNING"])
51
52
53def test_worker_list_filter(hq_env: HqEnv):

Callers

nothing calls this directly

Calls 7

list_all_workersFunction · 0.85
wait_for_worker_stateFunction · 0.85
check_columns_valueMethod · 0.80
start_serverMethod · 0.45
start_workersMethod · 0.45
kill_workerMethod · 0.45
start_workerMethod · 0.45

Tested by

no test coverage detected