diff --git a/tempest/scenario/test_stamp_pattern.py b/tempest/scenario/test_stamp_pattern.py index 0c256649fe..cc54a39787 100644 --- a/tempest/scenario/test_stamp_pattern.py +++ b/tempest/scenario/test_stamp_pattern.py @@ -13,8 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -import time - from oslo_log import log as logging import testtools @@ -63,21 +61,17 @@ def _create_volume_snapshot(self, volume): snapshot_name = data_utils.rand_name('scenario-snapshot') snapshot = self.snapshots_client.create_snapshot( volume_id=volume['id'], display_name=snapshot_name)['snapshot'] - - def cleaner(): - self.snapshots_client.delete_snapshot(snapshot['id']) - try: - while self.snapshots_client.show_snapshot( - snapshot['id'])['snapshot']: - time.sleep(1) - except lib_exc.NotFound: - pass - self.addCleanup(cleaner) + self.addCleanup(self.snapshots_client.wait_for_resource_deletion, + snapshot['id']) + self.addCleanup(self.snapshots_client.delete_snapshot, snapshot['id']) waiters.wait_for_volume_status(self.volumes_client, volume['id'], 'available') waiters.wait_for_snapshot_status(self.snapshots_client, snapshot['id'], 'available') - self.assertEqual(snapshot_name, snapshot['display_name']) + if 'display_name' in snapshot: + self.assertEqual(snapshot_name, snapshot['display_name']) + else: + self.assertEqual(snapshot_name, snapshot['name']) return snapshot def _wait_for_volume_available_on_the_system(self, ip_address, @@ -94,7 +88,6 @@ def _func(): CONF.compute.build_interval): raise lib_exc.TimeoutException - @decorators.skip_because(bug="1205344") @decorators.idempotent_id('10fd234a-515c-41e5-b092-8323060598c5') @testtools.skipUnless(CONF.compute_feature_enabled.snapshot, 'Snapshotting is not available.') @@ -109,7 +102,7 @@ def test_stamp_pattern(self): server = self.create_server( image_id=CONF.compute.image_ref, key_name=keypair['name'], - security_groups=security_group) + security_groups=[{'name': security_group['name']}]) # create and add floating IP to server1 ip_for_server = self.get_server_ip(server) @@ -136,7 +129,7 @@ def test_stamp_pattern(self): server_from_snapshot = self.create_server( image_id=snapshot_image['id'], key_name=keypair['name'], - security_groups=security_group) + security_groups=[{'name': security_group['name']}]) # create and add floating IP to server_from_snapshot ip_for_snapshot = self.get_server_ip(server_from_snapshot)