From: Peter Amstutz Date: Wed, 18 Nov 2015 14:45:08 +0000 (-0500) Subject: 5353: Add a couple comments to tests. X-Git-Tag: 1.1.0~1249^2~2 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/d01d6bdf901b49e8856e199a131fb263f98b370e 5353: Add a couple comments to tests. --- diff --git a/services/nodemanager/tests/test_daemon.py b/services/nodemanager/tests/test_daemon.py index 2510c79470..e0f051741f 100644 --- a/services/nodemanager/tests/test_daemon.py +++ b/services/nodemanager/tests/test_daemon.py @@ -613,6 +613,9 @@ class NodeManagerDaemonActorTestCase(testutil.ActorTestMixin, (testutil.MockSize(2), {"cores":2})] self.make_daemon(want_sizes=[small, small, small, big], avail_sizes=avail_sizes, max_nodes=4) + + # the daemon runs in another thread, so we need to wait and see + # if it does all the work we're expecting it to do before stopping it. self.busywait(lambda: self.node_setup.start.call_count == 4) booting = self.daemon.booting.get(self.TIMEOUT) self.stop_proxy(self.daemon) @@ -630,13 +633,15 @@ class NodeManagerDaemonActorTestCase(testutil.ActorTestMixin, (testutil.MockSize(2), {"cores":2})] self.make_daemon(want_sizes=[small, small, small, big], avail_sizes=avail_sizes, max_nodes=3) + + # the daemon runs in another thread, so we need to wait and see + # if it does all the work we're expecting it to do before stopping it. self.busywait(lambda: self.node_setup.start.call_count == 3) booting = self.daemon.booting.get(self.TIMEOUT) self.stop_proxy(self.daemon) sizecounts = {a[0].id: 0 for a in avail_sizes} for b in booting.itervalues(): sizecounts[b.cloud_size.get().id] += 1 - logging.info(sizecounts) self.assertEqual(2, sizecounts[small.id]) self.assertEqual(1, sizecounts[big.id]) @@ -692,15 +697,25 @@ class NodeManagerDaemonActorTestCase(testutil.ActorTestMixin, avail_sizes=avail_sizes, max_nodes=4, max_total_price=4) + # the daemon runs in another thread, so we need to wait and see + # if it does all the work we're expecting it to do before stopping it. self.busywait(lambda: self.node_setup.start.call_count == 3) booting = self.daemon.booting.get() self.stop_proxy(self.daemon) + + # technically something could happen between finishing the busywait and + # stopping the daemon so check again self.assertEqual(3, self.node_setup.start.call_count) + sizecounts = {a[0].id: 0 for a in avail_sizes} for b in booting.itervalues(): sizecounts[b.cloud_size.get().id] += 1 logging.info(sizecounts) - # The way the update_server_wishlist() works effectively results in a - # round-robin creation of one node of each size in the wishlist + + # Booting 3 small nodes and not booting a big node would also partially + # satisfy the wishlist and come in under the price cap, however the way + # the update_server_wishlist() currently works effectively results in a + # round-robin creation of one node of each size in the wishlist, so + # test for that. self.assertEqual(2, sizecounts[small.id]) self.assertEqual(1, sizecounts[big.id])