Skip to content

Commit 5b42583

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "tests: Add test for multiple blocks devices"
2 parents 747811f + e7bc687 commit 5b42583

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
@@ -1460,6 +1460,7 @@ def setUp(self):
14601460
self.flavors_mock.get.return_value = self.flavor
14611461

14621462
self.volume = volume_fakes.create_one_volume()
1463+
self.volume_alt = volume_fakes.create_one_volume()
14631464
self.volumes_mock.get.return_value = self.volume
14641465

14651466
self.snapshot = volume_fakes.create_one_snapshot()
@@ -2578,11 +2579,13 @@ def test_server_create_with_block_device(self):
25782579
'key_name': None,
25792580
'availability_zone': None,
25802581
'admin_pass': None,
2581-
'block_device_mapping_v2': [{
2582-
'uuid': self.volume.id,
2583-
'source_type': 'volume',
2584-
'destination_type': 'volume',
2585-
}],
2582+
'block_device_mapping_v2': [
2583+
{
2584+
'uuid': self.volume.id,
2585+
'source_type': 'volume',
2586+
'destination_type': 'volume',
2587+
},
2588+
],
25862589
'nics': [],
25872590
'scheduler_hints': {},
25882591
'config_drive': None,
@@ -2609,11 +2612,13 @@ def test_server_create_with_block_device_full(self):
26092612
f'volume_type=foo,boot_index=1,delete_on_termination=true,'
26102613
f'tag=foo'
26112614
)
2615+
block_device_alt = f'uuid={self.volume_alt.id},source_type=volume'
26122616

26132617
arglist = [
26142618
'--image', 'image1',
26152619
'--flavor', self.flavor.id,
26162620
'--block-device', block_device,
2621+
'--block-device', block_device_alt,
26172622
self.new_server.name,
26182623
]
26192624
verifylist = [
@@ -2634,6 +2639,10 @@ def test_server_create_with_block_device_full(self):
26342639
'delete_on_termination': 'true',
26352640
'tag': 'foo',
26362641
},
2642+
{
2643+
'uuid': self.volume_alt.id,
2644+
'source_type': 'volume',
2645+
},
26372646
]),
26382647
('server_name', self.new_server.name),
26392648
]
@@ -2654,20 +2663,27 @@ def test_server_create_with_block_device_full(self):
26542663
'key_name': None,
26552664
'availability_zone': None,
26562665
'admin_pass': None,
2657-
'block_device_mapping_v2': [{
2658-
'uuid': self.volume.id,
2659-
'source_type': 'volume',
2660-
'destination_type': 'volume',
2661-
'disk_bus': 'ide',
2662-
'device_name': 'sdb',
2663-
'volume_size': '64',
2664-
'guest_format': 'ext4',
2665-
'boot_index': 1,
2666-
'device_type': 'disk',
2667-
'delete_on_termination': True,
2668-
'tag': 'foo',
2669-
'volume_type': 'foo',
2670-
}],
2666+
'block_device_mapping_v2': [
2667+
{
2668+
'uuid': self.volume.id,
2669+
'source_type': 'volume',
2670+
'destination_type': 'volume',
2671+
'disk_bus': 'ide',
2672+
'device_name': 'sdb',
2673+
'volume_size': '64',
2674+
'guest_format': 'ext4',
2675+
'boot_index': 1,
2676+
'device_type': 'disk',
2677+
'delete_on_termination': True,
2678+
'tag': 'foo',
2679+
'volume_type': 'foo',
2680+
},
2681+
{
2682+
'uuid': self.volume_alt.id,
2683+
'source_type': 'volume',
2684+
'destination_type': 'volume',
2685+
},
2686+
],
26712687
'nics': 'auto',
26722688
'scheduler_hints': {},
26732689
'config_drive': None,

0 commit comments

Comments
 (0)