Merge "Test snapshot image deletion command"
This commit is contained in:
commit
8b4c05185f
@ -19,7 +19,7 @@ import fixtures
|
|||||||
import mock
|
import mock
|
||||||
|
|
||||||
from nodepool.cmd import nodepoolcmd
|
from nodepool.cmd import nodepoolcmd
|
||||||
from nodepool import tests
|
from nodepool import nodepool, tests
|
||||||
|
|
||||||
|
|
||||||
class TestNodepoolCMD(tests.DBTestCase):
|
class TestNodepoolCMD(tests.DBTestCase):
|
||||||
@ -91,3 +91,20 @@ class TestNodepoolCMD(tests.DBTestCase):
|
|||||||
configfile = self.setup_config("node_cmd.yaml")
|
configfile = self.setup_config("node_cmd.yaml")
|
||||||
self.patch_argv("-c", configfile, "image-delete", "invalid-image")
|
self.patch_argv("-c", configfile, "image-delete", "invalid-image")
|
||||||
nodepoolcmd.main()
|
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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user