diff --git a/nodepool/tests/test_commands.py b/nodepool/tests/test_commands.py index eba047e4e..92e3f7d86 100644 --- a/nodepool/tests/test_commands.py +++ b/nodepool/tests/test_commands.py @@ -19,7 +19,7 @@ import fixtures import mock from nodepool.cmd import nodepoolcmd -from nodepool import tests +from nodepool import nodepool, tests class TestNodepoolCMD(tests.DBTestCase): @@ -91,3 +91,20 @@ class TestNodepoolCMD(tests.DBTestCase): configfile = self.setup_config("node_cmd.yaml") self.patch_argv("-c", configfile, "image-delete", "invalid-image") nodepoolcmd.main() + + def test_image_delete_snapshot(self): + configfile = self.setup_config("node_cmd.yaml") + self.patch_argv("-c", configfile, "image-update", + "all", "fake-image1") + nodepoolcmd.main() + pool = nodepool.NodePool(configfile, watermark_sleep=1) + # This gives us a nodepool with a working db but not running which + # is important so we can control image building + pool.updateConfig() + self.addCleanup(pool.stop) + self.waitForImage(pool, 'fake-provider1', 'fake-image1') + + self.patch_argv("-c", configfile, "image-delete", '1') + nodepoolcmd.main() + self.wait_for_threads() + self.assert_images_listed(configfile, 0)