Fixing wrong cleanup order in test "test_rebuild_server"
Some tests (see the list below) from file tempest/tempest/api/compute/
servers/test_server_actions.py will not work if we specify different IDs
of images for options "image_ref" and "image_ref_alt".
Here is these tests:
ServerActionsTestJSON.test_rebuild_server
ServerActionsTestJSON.test_rebuild_server_in_stop_state
ServerActionsTestJSON.test_resize_server_confirm
The root cause of this is wrong cleanup order in the test
"test_rebuild_server". In particular the issue is in these code lines:
# If the server was rebuilt on a different image, restore it to the
# original image once the test ends
if self.image_ref_alt != self.image_ref:
self.addCleanup(self.client.rebuild,
(self.server_id, self.image_ref))
For each test in file tempest/tempest/api/compute/
servers/test_server_actions.py we have the following tearDown():
def tearDown(self):
server = self.client.get_server(self.server_id)
self.assertEqual(self.image_ref, server['image']['id'])
self.server_check_teardown()
super(ServerActionsTestJSON, self).tearDown()
But addCleanup() is called after "tearDown" methods.
We can move code lines that check the server was rebuilt to addCleanup()
and invoke this check only in those tests that are related to rebuilding
the server.
Closes-Bug: #1454755
Change-Id: I3a743f55fa223e234b3c49d1191af0b627697b74
1 file changed