Codebase list cinder-tempest-plugin / c96757b
Remove redundant cleanups in test_volume_backup The BaseVolumeTest class contains some helper methods that do their own cleanup steps within them. However, several of the tests in VolumesBackupsTest were also doing identical cleanup. Occasionally, this results in a failure to cleanup in the gate [1] because a test that doesn't wait for resource deletion [2] after it cleans up a resource can leave a resource in a mid-deletion state that the base class cleanup will fail with a 400 when *it* tries to delete the same resource. This was noticed on the Ocata branch but it looks like the same issues exist on master in the plugin, so I'm starting with the fix here. Closes-Bug: #1774684 [1] http://logs.openstack.org/53/570653/1/check/legacy-tempest-dsvm-full-devstack-plugin-ceph/c5d03e7/job-output.txt.gz#_2018-05-30_04_41_10_689262 [2] https://github.com/openstack/cinder-tempest-plugin/blob/28456a1/cinder_tempest_plugin/api/volume/test_volume_backup.py#L64 Change-Id: I2a29daf56f8327fce405e7969767dc9993849f19 melanie witt 7 years ago
2 changed file(s) with 7 addition(s) and 38 deletion(s). Raw diff Collapse all Expand all
142142
143143 backup = backup_client.create_backup(
144144 volume_id=volume_id, **kwargs)['backup']
145 self.addCleanup(backup_client.delete_backup, backup['id'])
145 self.addCleanup(backup_client.wait_for_resource_deletion, backup['id'])
146 self.addCleanup(test_utils.call_and_ignore_notfound_exc,
147 backup_client.delete_backup, backup['id'])
146148 waiters.wait_for_volume_resource_status(backup_client, backup['id'],
147149 'available')
148150 return backup
4040 backup = self.create_backup(
4141 volume_id=volume['id'],
4242 snapshot_id=snapshot['id'])
43 # Get a given backup
44 backup = self.backups_client.show_backup(
45 backup['id'])['backup']
46 waiters.wait_for_volume_resource_status(
47 self.backups_client,
48 backup['id'], 'available')
4943 self.assertEqual(volume['id'], backup['volume_id'])
5044 self.assertEqual(snapshot['id'], backup['snapshot_id'])
51
52 self.snapshots_client.delete_snapshot(snapshot['id'])
53 self.snapshots_client.wait_for_resource_deletion(snapshot['id'])
54
55 self.volumes_client.delete_volume(volume['id'])
56 self.volumes_client.wait_for_resource_deletion(volume['id'])
5745
5846 @decorators.idempotent_id('b5d837b0-7066-455d-88fc-4a721a899306')
5947 def test_backup_create_and_restore_to_an_existing_volume(self):
6048 """Test backup create and restore to an existing volume."""
6149 # Create volume
6250 src_vol = self.create_volume()
63 self.addCleanup(self.volumes_client.delete_volume,
64 src_vol['id'])
6551 # Create backup
66 backup = self.backups_client.create_backup(
67 volume_id=src_vol['id'])['backup']
68 self.addCleanup(self.backups_client.delete_backup, backup['id'])
69 waiters.wait_for_volume_resource_status(
70 self.backups_client,
71 backup['id'], 'available')
52 backup = self.create_backup(volume_id=src_vol['id'])
7253 # Restore to existing volume
7354 restore = self.backups_client.restore_backup(
7455 backup_id=backup['id'],
8869 # Create volume from image
8970 volume = self.create_volume(size=CONF.volume.volume_size,
9071 imageRef=CONF.compute.image_ref)
91 self.addCleanup(self.volumes_client.delete_volume,
92 volume['id'])
9372
9473 # Create backup
95 backup = self.backups_client.create_backup(
96 volume_id=volume['id'])['backup']
97 waiters.wait_for_volume_resource_status(self.backups_client,
98 backup['id'], 'available')
74 self.create_backup(volume_id=volume['id'])
9975 # Create a server
10076 bd_map = [{'volume_id': volume['id'],
10177 'delete_on_termination': '0'}]
11187 # Create incremental backup
11288 waiters.wait_for_volume_resource_status(self.volumes_client,
11389 volume['id'], 'available')
114 backup_incr = self.backups_client.create_backup(
90 backup_incr = self.create_backup(
11591 volume_id=volume['id'],
116 incremental=True)['backup']
117
118 waiters.wait_for_volume_resource_status(self.backups_client,
119 backup_incr['id'],
120 'available')
92 incremental=True)
12193
12294 is_incremental = self.backups_client.show_backup(
12395 backup_incr['id'])['backup']['is_incremental']
12496 self.assertTrue(is_incremental)
125
126 self.backups_client.delete_backup(backup_incr['id'])
127 self.backups_client.wait_for_resource_deletion(backup_incr['id'])
128 self.backups_client.delete_backup(backup['id'])
129 self.backups_client.wait_for_resource_deletion(backup['id'])