Merge "Test snapshot image deletion command"

This commit is contained in:
Jenkins 2015-03-18 22:37:02 +00:00 committed by Gerrit Code Review
commit 8b4c05185f

View File

@ -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)