How to use create_volume method in tempest

Best Python code snippet using tempest_python

test_volumes.py

Source:test_volumes.py Github

copy

Full Screen

...102 mock_service.create_volume.assert_called_once_with(1, fakearg="f")103 scenario.sleep_between.assert_called_once_with(10, 20)104 mock_service.delete_volume.assert_called_once_with(105 mock_service.create_volume.return_value)106 def test_create_volume(self):107 mock_service = self.mock_cinder.return_value108 scenario = volumes.CreateVolume(self._get_context())109 scenario.run(1, fakearg="f")110 mock_service.create_volume.assert_called_once_with(1, fakearg="f")111 def test_create_volume_and_modify_metadata(self):112 mock_service = self.mock_cinder.return_value113 scenario = volumes.ModifyVolumeMetadata(self._get_context())114 scenario.run(sets=5, set_size=4, deletes=3, delete_size=2)115 mock_service.set_metadata.assert_called_once_with(116 "uuid", set_size=4, sets=5)117 mock_service.delete_metadata.assert_called_once_with(118 "uuid",119 keys=mock_service.set_metadata.return_value,120 deletes=3, delete_size=2)...

Full Screen

Full Screen

volume_test.py

Source:volume_test.py Github

copy

Full Screen

...14 except DockerException:15 pass16 del self.tmp_volumes17 super().tearDown()18 def create_volume(self, name, driver=None, opts=None, external=None, custom_name=False):19 if external:20 custom_name = True21 if isinstance(external, str):22 name = external23 vol = Volume(24 self.client, 'composetest', name, driver=driver, driver_opts=opts,25 external=bool(external), custom_name=custom_name26 )27 self.tmp_volumes.append(vol)28 return vol29 def test_create_volume(self):30 vol = self.create_volume('volume01')31 vol.create()32 info = self.get_volume_data(vol.full_name)33 assert info['Name'].split('/')[-1] == vol.full_name34 def test_create_volume_custom_name(self):35 vol = self.create_volume('volume01', custom_name=True)36 assert vol.name == vol.full_name37 vol.create()38 info = self.get_volume_data(vol.full_name)39 assert info['Name'].split('/')[-1] == vol.name40 def test_recreate_existing_volume(self):41 vol = self.create_volume('volume01')42 vol.create()43 info = self.get_volume_data(vol.full_name)44 assert info['Name'].split('/')[-1] == vol.full_name45 vol.create()46 info = self.get_volume_data(vol.full_name)47 assert info['Name'].split('/')[-1] == vol.full_name48 @no_cluster('inspect volume by name defect on Swarm Classic')49 def test_inspect_volume(self):50 vol = self.create_volume('volume01')51 vol.create()52 info = vol.inspect()53 assert info['Name'] == vol.full_name54 @no_cluster('remove volume by name defect on Swarm Classic')55 def test_remove_volume(self):56 vol = Volume(self.client, 'composetest', 'volume01')57 vol.create()58 vol.remove()59 volumes = self.client.volumes()['Volumes']60 assert len([v for v in volumes if v['Name'] == vol.full_name]) == 061 @no_cluster('inspect volume by name defect on Swarm Classic')62 def test_external_volume(self):63 vol = self.create_volume('composetest_volume_ext', external=True)64 assert vol.external is True65 assert vol.full_name == vol.name66 vol.create()67 info = vol.inspect()68 assert info['Name'] == vol.name69 @no_cluster('inspect volume by name defect on Swarm Classic')70 def test_external_aliased_volume(self):71 alias_name = 'composetest_alias01'72 vol = self.create_volume('volume01', external=alias_name)73 assert vol.external is True74 assert vol.full_name == alias_name75 vol.create()76 info = vol.inspect()77 assert info['Name'] == alias_name78 @no_cluster('inspect volume by name defect on Swarm Classic')79 def test_exists(self):80 vol = self.create_volume('volume01')81 assert vol.exists() is False82 vol.create()83 assert vol.exists() is True84 @no_cluster('inspect volume by name defect on Swarm Classic')85 def test_exists_external(self):86 vol = self.create_volume('volume01', external=True)87 assert vol.exists() is False88 vol.create()89 assert vol.exists() is True90 @no_cluster('inspect volume by name defect on Swarm Classic')91 def test_exists_external_aliased(self):92 vol = self.create_volume('volume01', external='composetest_alias01')93 assert vol.exists() is False94 vol.create()95 assert vol.exists() is True96 @no_cluster('inspect volume by name defect on Swarm Classic')97 def test_volume_default_labels(self):98 vol = self.create_volume('volume01')99 vol.create()100 vol_data = vol.inspect()101 labels = vol_data['Labels']102 assert labels[LABEL_VOLUME] == vol.name...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful