Remove test_*_cleanup_on_start tests

This functionality is no longer done by nodepool, but by the
nodepool builder.

Change-Id: I4fc12ca07d610c6b69b3be59ec42ac899bee4b63
This commit is contained in:
David Shrewsbury 2017-03-13 11:27:23 -04:00
parent 8c6461ebe4
commit d7df1eb47c

View File

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