From 96c36cffbe115226402600c321c2de701b281f7b Mon Sep 17 00:00:00 2001 From: zhufl Date: Fri, 10 Feb 2017 09:51:57 +0800 Subject: [PATCH] Remove skip of test_stamp_pattern test_stamp_pattern is skipped of bug 1205344 which is reported at 2013, though there is no exact hint on whether the bug is fixed or not, but since 2013 is too long ago, we guess the bug should have been fixed. This is to remove the skip, and to fix several obvious errors in the code. Change-Id: I2c13099595d8ee8099e02e3f06096078c7d27c34 --- tempest/scenario/test_stamp_pattern.py | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) 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)