Codebase list cinder-tempest-plugin / e9834cd
Refactor test_volume_backup due to leftovers Current test class does not clean volume / backup resources. Change the create for volume and backups from base and not from client. The base create contains waiters and run cleanup resources. Change-Id: I8a6a7945870d30f180bd41940b8ee8b82e2f87b7 Benny Kopilov 4 years ago
1 changed file(s) with 14 addition(s) and 47 deletion(s). Raw diff Collapse all Expand all
1212 # License for the specific language governing permissions and limitations
1313 # under the License.
1414
15 from tempest.common import waiters
1615 from tempest import config
1716 from tempest.lib import decorators
1817 from tempest.lib import exceptions
4039 def test_backup_crossproject_admin_negative(self):
4140
4241 # create vol as user
43 volume = self.volumes_client.create_volume(
44 size=CONF.volume.volume_size)['volume']
45 waiters.wait_for_volume_resource_status(
46 self.volumes_client,
47 volume['id'], 'available')
42 volume = self.create_volume(size=CONF.volume.volume_size)
4843
4944 # create backup as user
50 backup = self.backups_client.create_backup(
51 volume_id=volume['id'])['backup']
52 waiters.wait_for_volume_resource_status(
53 self.backups_client,
54 backup['id'], 'available')
55
45 self.create_backup(volume_id=volume['id'])
5646 # try to create incremental backup as admin
5747 self.assertRaises(
5848 exceptions.BadRequest, self.admin_backups_client.create_backup,
6252 def test_backup_crossproject_user_negative(self):
6353
6454 # create vol as user
65 volume = self.volumes_client.create_volume(
66 size=CONF.volume.volume_size)['volume']
67 waiters.wait_for_volume_resource_status(
68 self.volumes_client,
69 volume['id'], 'available')
55 volume = self.create_volume(size=CONF.volume.volume_size)
7056
7157 # create backup as admin
72 backup = self.admin_backups_client.create_backup(
73 volume_id=volume['id'])['backup']
74 waiters.wait_for_volume_resource_status(
75 self.admin_backups_client,
76 backup['id'], 'available')
58
59 self.create_backup(volume_id=volume['id'],
60 backup_client=self.admin_backups_client)
7761
7862 # try to create incremental backup as user
7963 self.assertRaises(
8468 def test_incremental_backup_respective_parents(self):
8569
8670 # create vol as user
87 volume = self.volumes_client.create_volume(
88 size=CONF.volume.volume_size)['volume']
89 waiters.wait_for_volume_resource_status(
90 self.volumes_client,
91 volume['id'], 'available')
71 volume = self.create_volume(size=CONF.volume.volume_size)
9272
9373 # create backup as admin
94 backup_adm = self.admin_backups_client.create_backup(
95 volume_id=volume['id'])['backup']
96 waiters.wait_for_volume_resource_status(
97 self.admin_backups_client,
98 backup_adm['id'], 'available')
74 backup_adm = self.create_backup(
75 volume_id=volume['id'], backup_client=self.admin_backups_client)
9976
10077 # create backup as user
101 backup_usr = self.backups_client.create_backup(
102 volume_id=volume['id'])['backup']
103 waiters.wait_for_volume_resource_status(
104 self.backups_client,
105 backup_usr['id'], 'available')
78 backup_usr = self.create_backup(volume_id=volume['id'])
10679
10780 # refresh admin backup and assert no child backups
10881 backup_adm = self.admin_backups_client.show_backup(
11083 self.assertFalse(backup_adm['has_dependent_backups'])
11184
11285 # create incremental backup as admin
113 backup_adm_inc = self.admin_backups_client.create_backup(
114 volume_id=volume['id'], incremental=True)['backup']
115 waiters.wait_for_volume_resource_status(
116 self.admin_backups_client,
117 backup_adm_inc['id'], 'available')
86 self.create_backup(volume_id=volume['id'], incremental=True,
87 backup_client=self.admin_backups_client)
11888
11989 # refresh user backup and assert no child backups
12090 backup_usr = self.backups_client.show_backup(
12797 self.assertTrue(backup_adm['has_dependent_backups'])
12898
12999 # create incremental backup as user
130 backup_usr_inc = self.backups_client.create_backup(
131 volume_id=volume['id'], incremental=True)['backup']
132 waiters.wait_for_volume_resource_status(
133 self.backups_client,
134 backup_usr_inc['id'], 'available')
100 self.create_backup(volume_id=volume['id'],
101 incremental=True)
135102
136103 # refresh user backup and assert it has childs
137104 backup_usr = self.backups_client.show_backup(