Exemple #1
0
 def test_init_distribute_batch_size(self):
     sched = LoadScheduling(2)
     sched.addnode(MockNode())
     sched.addnode(MockNode())
     node1, node2 = sched.nodes
     col = ["xyz"] * (6)
     sched.addnode_collection(node1, col)
     sched.addnode_collection(node2, col)
     sched.init_distribute()
     # assert not sched.tests_finished()
     sent1 = node1.sent
     sent2 = node2.sent
     assert sent1 == [0, 2]
     assert sent2 == [1, 3]
     assert sched.pending == [4, 5]
     assert sched.node2pending[node1] == sent1
     assert sched.node2pending[node2] == sent2
     assert len(sched.pending) == 2
     sched.remove_item(node1, 0)
     assert node1.sent == [0, 2, 4]
     assert sched.pending == [5]
     assert node2.sent == [1, 3]
     sched.remove_item(node1, 2)
     assert node1.sent == [0, 2, 4, 5]
     assert not sched.pending
Exemple #2
0
 def test_init_distribute_batch_size(self):
     sched = LoadScheduling(2)
     sched.addnode(MockNode())
     sched.addnode(MockNode())
     node1, node2 = sched.nodes
     col = ["xyz"] * (6)
     sched.addnode_collection(node1, col)
     sched.addnode_collection(node2, col)
     sched.init_distribute()
     # assert not sched.tests_finished()
     sent1 = node1.sent
     sent2 = node2.sent
     assert sent1 == [0, 2]
     assert sent2 == [1, 3]
     assert sched.pending == [4, 5]
     assert sched.node2pending[node1] == sent1
     assert sched.node2pending[node2] == sent2
     assert len(sched.pending) == 2
     sched.remove_item(node1, 0)
     assert node1.sent == [0, 2, 4]
     assert sched.pending == [5]
     assert node2.sent == [1, 3]
     sched.remove_item(node1, 2)
     assert node1.sent == [0, 2, 4, 5]
     assert not sched.pending
Exemple #3
0
 def test_schedule_load_simple(self):
     sched = LoadScheduling(2)
     sched.addnode(MockNode())
     sched.addnode(MockNode())
     node1, node2 = sched.nodes
     collection = ["a.py::test_1", "a.py::test_2"]
     assert not sched.collection_is_completed
     sched.addnode_collection(node1, collection)
     assert not sched.collection_is_completed
     sched.addnode_collection(node2, collection)
     assert sched.collection_is_completed
     assert sched.node2collection[node1] == collection
     assert sched.node2collection[node2] == collection
     sched.init_distribute()
     assert not sched.pending
     assert sched.tests_finished()
     assert len(node1.sent) == 1
     assert len(node2.sent) == 1
     assert node1.sent == [0]
     assert node2.sent == [1]
     sched.remove_item(node1, node1.sent[0])
     assert sched.tests_finished()
Exemple #4
0
 def test_schedule_load_simple(self):
     sched = LoadScheduling(2)
     sched.addnode(MockNode())
     sched.addnode(MockNode())
     node1, node2 = sched.nodes
     collection = ["a.py::test_1", "a.py::test_2"]
     assert not sched.collection_is_completed
     sched.addnode_collection(node1, collection)
     assert not sched.collection_is_completed
     sched.addnode_collection(node2, collection)
     assert sched.collection_is_completed
     assert sched.node2collection[node1] == collection
     assert sched.node2collection[node2] == collection
     sched.init_distribute()
     assert not sched.pending
     assert sched.tests_finished()
     assert len(node1.sent) == 1
     assert len(node2.sent) == 1
     assert node1.sent == [0]
     assert node2.sent == [1]
     sched.remove_item(node1, node1.sent[0])
     assert sched.tests_finished()