Skip to content

Commit e7bc687

Browse files
committed
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>
1 parent 6cd72f6 commit e7bc687

1 file changed

Lines changed: 35 additions & 19 deletions

File tree

openstackclient/tests/unit/compute/v2/test_server.py

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,6 +1445,7 @@ def setUp(self):
14451445
self.flavors_mock.get.return_value = self.flavor
14461446

14471447
self.volume = volume_fakes.create_one_volume()
1448+
self.volume_alt = volume_fakes.create_one_volume()
14481449
self.volumes_mock.get.return_value = self.volume
14491450

14501451
self.snapshot = volume_fakes.create_one_snapshot()
@@ -2563,11 +2564,13 @@ def test_server_create_with_block_device(self):
25632564
'key_name': None,
25642565
'availability_zone': None,
25652566
'admin_pass': None,
2566-
'block_device_mapping_v2': [{
2567-
'uuid': self.volume.id,
2568-
'source_type': 'volume',
2569-
'destination_type': 'volume',
2570-
}],
2567+
'block_device_mapping_v2': [
2568+
{
2569+
'uuid': self.volume.id,
2570+
'source_type': 'volume',
2571+
'destination_type': 'volume',
2572+
},
2573+
],
25712574
'nics': [],
25722575
'scheduler_hints': {},
25732576
'config_drive': None,
@@ -2594,11 +2597,13 @@ def test_server_create_with_block_device_full(self):
25942597
f'volume_type=foo,boot_index=1,delete_on_termination=true,'
25952598
f'tag=foo'
25962599
)
2600+
block_device_alt = f'uuid={self.volume_alt.id},source_type=volume'
25972601

25982602
arglist = [
25992603
'--image', 'image1',
26002604
'--flavor', self.flavor.id,
26012605
'--block-device', block_device,
2606+
'--block-device', block_device_alt,
26022607
self.new_server.name,
26032608
]
26042609
verifylist = [
@@ -2619,6 +2624,10 @@ def test_server_create_with_block_device_full(self):
26192624
'delete_on_termination': 'true',
26202625
'tag': 'foo',
26212626
},
2627+
{
2628+
'uuid': self.volume_alt.id,
2629+
'source_type': 'volume',
2630+
},
26222631
]),
26232632
('server_name', self.new_server.name),
26242633
]
@@ -2639,20 +2648,27 @@ def test_server_create_with_block_device_full(self):
26392648
'key_name': None,
26402649
'availability_zone': None,
26412650
'admin_pass': None,
2642-
'block_device_mapping_v2': [{
2643-
'uuid': self.volume.id,
2644-
'source_type': 'volume',
2645-
'destination_type': 'volume',
2646-
'disk_bus': 'ide',
2647-
'device_name': 'sdb',
2648-
'volume_size': '64',
2649-
'guest_format': 'ext4',
2650-
'boot_index': 1,
2651-
'device_type': 'disk',
2652-
'delete_on_termination': True,
2653-
'tag': 'foo',
2654-
'volume_type': 'foo',
2655-
}],
2651+
'block_device_mapping_v2': [
2652+
{
2653+
'uuid': self.volume.id,
2654+
'source_type': 'volume',
2655+
'destination_type': 'volume',
2656+
'disk_bus': 'ide',
2657+
'device_name': 'sdb',
2658+
'volume_size': '64',
2659+
'guest_format': 'ext4',
2660+
'boot_index': 1,
2661+
'device_type': 'disk',
2662+
'delete_on_termination': True,
2663+
'tag': 'foo',
2664+
'volume_type': 'foo',
2665+
},
2666+
{
2667+
'uuid': self.volume_alt.id,
2668+
'source_type': 'volume',
2669+
'destination_type': 'volume',
2670+
},
2671+
],
26562672
'nics': 'auto',
26572673
'scheduler_hints': {},
26582674
'config_drive': None,

0 commit comments

Comments
 (0)