summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Finucane <sfinucan@redhat.com>2022-10-20 15:49:43 +0100
committerStephen Finucane <sfinucan@redhat.com>2022-12-01 15:13:17 +0000
commite7bc68735f5010f0712b640e204c6ceb05fa3759 (patch)
treee6b7b03b73cb9668df530fa8238428c797410af3
parent6cd72f61826a1af79fe9244240d95283203cd03b (diff)
downloadpython-openstackclient-e7bc68735f5010f0712b640e204c6ceb05fa3759.tar.gz
tests: Add test for multiple blocks devices
The 'server create' command should support multiple '--block-device' parameters. Prove it. Change-Id: I1bd83287efdbbe11774053b694bae99b6a4ebdf5 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
-rw-r--r--openstackclient/tests/unit/compute/v2/test_server.py54
1 files changed, 35 insertions, 19 deletions
diff --git a/openstackclient/tests/unit/compute/v2/test_server.py b/openstackclient/tests/unit/compute/v2/test_server.py
index f59c954a..27ae3e9b 100644
--- a/openstackclient/tests/unit/compute/v2/test_server.py
+++ b/openstackclient/tests/unit/compute/v2/test_server.py
@@ -1445,6 +1445,7 @@ class TestServerCreate(TestServer):
self.flavors_mock.get.return_value = self.flavor
self.volume = volume_fakes.create_one_volume()
+ self.volume_alt = volume_fakes.create_one_volume()
self.volumes_mock.get.return_value = self.volume
self.snapshot = volume_fakes.create_one_snapshot()
@@ -2563,11 +2564,13 @@ class TestServerCreate(TestServer):
'key_name': None,
'availability_zone': None,
'admin_pass': None,
- 'block_device_mapping_v2': [{
- 'uuid': self.volume.id,
- 'source_type': 'volume',
- 'destination_type': 'volume',
- }],
+ 'block_device_mapping_v2': [
+ {
+ 'uuid': self.volume.id,
+ 'source_type': 'volume',
+ 'destination_type': 'volume',
+ },
+ ],
'nics': [],
'scheduler_hints': {},
'config_drive': None,
@@ -2594,11 +2597,13 @@ class TestServerCreate(TestServer):
f'volume_type=foo,boot_index=1,delete_on_termination=true,'
f'tag=foo'
)
+ block_device_alt = f'uuid={self.volume_alt.id},source_type=volume'
arglist = [
'--image', 'image1',
'--flavor', self.flavor.id,
'--block-device', block_device,
+ '--block-device', block_device_alt,
self.new_server.name,
]
verifylist = [
@@ -2619,6 +2624,10 @@ class TestServerCreate(TestServer):
'delete_on_termination': 'true',
'tag': 'foo',
},
+ {
+ 'uuid': self.volume_alt.id,
+ 'source_type': 'volume',
+ },
]),
('server_name', self.new_server.name),
]
@@ -2639,20 +2648,27 @@ class TestServerCreate(TestServer):
'key_name': None,
'availability_zone': None,
'admin_pass': None,
- 'block_device_mapping_v2': [{
- 'uuid': self.volume.id,
- 'source_type': 'volume',
- 'destination_type': 'volume',
- 'disk_bus': 'ide',
- 'device_name': 'sdb',
- 'volume_size': '64',
- 'guest_format': 'ext4',
- 'boot_index': 1,
- 'device_type': 'disk',
- 'delete_on_termination': True,
- 'tag': 'foo',
- 'volume_type': 'foo',
- }],
+ 'block_device_mapping_v2': [
+ {
+ 'uuid': self.volume.id,
+ 'source_type': 'volume',
+ 'destination_type': 'volume',
+ 'disk_bus': 'ide',
+ 'device_name': 'sdb',
+ 'volume_size': '64',
+ 'guest_format': 'ext4',
+ 'boot_index': 1,
+ 'device_type': 'disk',
+ 'delete_on_termination': True,
+ 'tag': 'foo',
+ 'volume_type': 'foo',
+ },
+ {
+ 'uuid': self.volume_alt.id,
+ 'source_type': 'volume',
+ 'destination_type': 'volume',
+ },
+ ],
'nics': 'auto',
'scheduler_hints': {},
'config_drive': None,