diff --git a/nodepool/tests/test_nodepool.py b/nodepool/tests/test_nodepool.py index c427fa060..911aff393 100644 --- a/nodepool/tests/test_nodepool.py +++ b/nodepool/tests/test_nodepool.py @@ -441,104 +441,6 @@ class TestNodepool(tests.DBTestCase): servers = manager.listServers() self.assertEqual(len(servers), 1) - @skip("Disabled for early v3 development") - def test_building_image_cleanup_on_start(self): - """Test that a building image is deleted on start""" - configfile = self.setup_config('node.yaml') - pool = nodepool.nodepool.NodePool(self.secure_conf, configfile, - watermark_sleep=1) - try: - pool.start() - self.waitForImage(pool, 'fake-provider', 'fake-image') - self.waitForNodes(pool) - finally: - # Stop nodepool instance so that it can be restarted. - pool.stop() - - with pool.getDB().getSession() as session: - images = session.getSnapshotImages() - self.assertEqual(len(images), 1) - self.assertEqual(images[0].state, nodedb.READY) - images[0].state = nodedb.BUILDING - - # Start nodepool instance which should delete our old image. - pool = self.useNodepool(configfile, watermark_sleep=1) - pool.start() - # Ensure we have a config loaded for periodic cleanup. - while not pool.config: - time.sleep(0) - # Wait for startup to shift state to a state that periodic cleanup - # will act on. - while True: - with pool.getDB().getSession() as session: - if session.getSnapshotImages()[0].state != nodedb.BUILDING: - break - time.sleep(0) - # Necessary to force cleanup to happen within the test timeframe - pool.periodicCleanup() - self.waitForImage(pool, 'fake-provider', 'fake-image') - self.waitForNodes(pool) - - with pool.getDB().getSession() as session: - images = session.getSnapshotImages() - self.assertEqual(len(images), 1) - self.assertEqual(images[0].state, nodedb.READY) - # should be second image built. - self.assertEqual(images[0].id, 2) - - @skip("Disabled for early v3 development") - def test_building_dib_image_cleanup_on_start(self): - """Test that a building dib image is deleted on start""" - configfile = self.setup_config('node.yaml') - pool = nodepool.nodepool.NodePool(self.secure_conf, configfile, - watermark_sleep=1) - self._useBuilder(configfile) - try: - pool.start() - self.waitForImage(pool, 'fake-provider', 'fake-image') - self.waitForNodes(pool) - finally: - # Stop nodepool instance so that it can be restarted. - pool.stop() - - with pool.getDB().getSession() as session: - # We delete the snapshot image too to force a new dib image - # to be built so that a new image can be uploaded to replace - # the image that was in the snapshot table. - images = session.getSnapshotImages() - self.assertEqual(len(images), 1) - self.assertEqual(images[0].state, nodedb.READY) - images[0].state = nodedb.BUILDING - images = session.getDibImages() - self.assertEqual(len(images), 1) - self.assertEqual(images[0].state, nodedb.READY) - images[0].state = nodedb.BUILDING - - # Start nodepool instance which should delete our old image. - pool = self.useNodepool(configfile, watermark_sleep=1) - pool.start() - # Ensure we have a config loaded for periodic cleanup. - while not pool.config: - time.sleep(0) - # Wait for startup to shift state to a state that periodic cleanup - # will act on. - while True: - with pool.getDB().getSession() as session: - if session.getDibImages()[0].state != nodedb.BUILDING: - break - time.sleep(0) - # Necessary to force cleanup to happen within the test timeframe - pool.periodicCleanup() - self.waitForImage(pool, 'fake-provider', 'fake-image') - self.waitForNodes(pool) - - with pool.getDB().getSession() as session: - images = session.getDibImages() - self.assertEqual(len(images), 1) - self.assertEqual(images[0].state, nodedb.READY) - # should be second image built. - self.assertEqual(images[0].id, 2) - def test_label_provider(self): """Test that only providers listed in the label satisfy the request""" configfile = self.setup_config('node_label_provider.yaml')