Skip to content

Commit

Permalink
Fix some LoadScheduling tests
Browse files Browse the repository at this point in the history
The expected number of nodes didn't match throughout the test code.
  • Loading branch information
amezin committed Jan 11, 2023
1 parent d1dfad3 commit e986092
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions testing/test_dsession.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def test_schedule_maxchunk_1(self, pytester: pytest.Pytester) -> None:
assert sched.pending == list(range(first_pending, 16))

def test_schedule_fewer_tests_than_nodes(self, pytester: pytest.Pytester) -> None:
config = pytester.parseconfig("--tx=2*popen")
config = pytester.parseconfig("--tx=3*popen")
sched = LoadScheduling(config)
sched.add_node(MockNode())
sched.add_node(MockNode())
Expand All @@ -193,20 +193,19 @@ def test_schedule_fewer_tests_than_nodes(self, pytester: pytest.Pytester) -> Non
col = ["xyz"] * 2
sched.add_node_collection(node1, col)
sched.add_node_collection(node2, col)
sched.add_node_collection(node3, col)
assert sched.collection_is_completed
sched.schedule()
# assert not sched.tests_finished
sent1 = node1.sent
sent2 = node2.sent
sent3 = node3.sent
assert sent1 == [0]
assert sent2 == [1]
assert sent3 == []
assert node1.sent == [0]
assert node2.sent == [1]
assert node3.sent == []
assert not sched.pending

def test_schedule_fewer_than_two_tests_per_node(
self, pytester: pytest.Pytester
) -> None:
config = pytester.parseconfig("--tx=2*popen")
config = pytester.parseconfig("--tx=3*popen")
sched = LoadScheduling(config)
sched.add_node(MockNode())
sched.add_node(MockNode())
Expand All @@ -215,14 +214,13 @@ def test_schedule_fewer_than_two_tests_per_node(
col = ["xyz"] * 5
sched.add_node_collection(node1, col)
sched.add_node_collection(node2, col)
sched.add_node_collection(node3, col)
assert sched.collection_is_completed
sched.schedule()
# assert not sched.tests_finished
sent1 = node1.sent
sent2 = node2.sent
sent3 = node3.sent
assert sent1 == [0, 3]
assert sent2 == [1, 4]
assert sent3 == [2]
assert node1.sent == [0, 3]
assert node2.sent == [1, 4]
assert node3.sent == [2]
assert not sched.pending

def test_add_remove_node(self, pytester: pytest.Pytester) -> None:
Expand Down

0 comments on commit e986092

Please sign in to comment.