Skip to content

Commit cba8b2d

Browse files
committed
test: address review comments on the Ceph smoke tests
Assert that the encryption format and passphrase secret lists of TestVolumeEncryption are not empty, instead of asserting they are not None, which findall() never returns. Compare the storage pool type case-insensitively, give the direct download test a unique storage tag, skip the live VM migration test for every RBD source pool, and drop an unused variable in test_list_storage_pools.
1 parent 7ba7d7e commit cba8b2d

5 files changed

Lines changed: 12 additions & 11 deletions

File tree

‎test/integration/smoke/test_direct_download.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def setUpClass(cls):
194194
if cls.zone.networktype == 'Basic' :
195195
networks = Network.list(cls.apiclient)
196196
if len(networks) == 0 :
197-
self.skipTest("Skipping test since no network found in basic zone")
197+
cls.skipTest("Skipping test since no network found in basic zone")
198198
else :
199199
cls.network = networks[0]
200200
else :
@@ -307,9 +307,10 @@ def test_01_deploy_vm_from_direct_download_template(self):
307307
for pool_type, pool_id, offering_type in storages:
308308
self.debug("Deploying VM from direct download template on %s storage" % pool_type)
309309

310-
# Create service offering for the storage using the storage pool type as storage tag
310+
# Create a unique, test-scoped storage tag to avoid collisions with existing tags
311+
# or parallel test runs that may also rely on temporary storage tags.
311312
tags = self.getCurrentStoragePoolTags(pool_id)
312-
test_tag = pool_type.lower()
313+
test_tag = "marvin_test_direct_download_%s_%s" % (pool_type.lower(), uuid.uuid4().hex)
313314
self.updateStoragePoolTags(pool_id, test_tag)
314315
offering = self.createServiceOffering("TestDirectDownload-%s" % test_tag, offering_type, test_tag)
315316
try:

‎test/integration/smoke/test_list_storage_pools.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,9 @@ def test_01_list_storage_pools_clusterid_filter(self):
6363
"Storage pool response type should be a list"
6464
)
6565
# Filter may return zone-wide pools (with clusterid=None) alongside cluster-scoped pools
66-
cluster_scoped_found = False
6766
for storage_pool in storage_pools:
6867
if storage_pool.clusterid is not None:
6968
# Only assert clusterid for cluster-scoped pools
70-
cluster_scoped_found = True
7169
self.assertEqual(
7270
storage_pool.clusterid,
7371
self.cluster.id,

‎test/integration/smoke/test_snapshots.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def test_02_list_snapshots_with_removed_data_store(self):
262262
volume_pool_response = list_storage_pools(self.apiclient,
263263
id=vol_res[0].storageid)
264264
volume_pool = volume_pool_response[0]
265-
if volume_pool.type not in ("NetworkFilesystem", "RBD"):
265+
if volume_pool.type.lower() not in ("networkfilesystem", "rbd"):
266266
self.skipTest("This test is not supported for volume created on storage pool type %s" % volume_pool.type)
267267
clusters = list_clusters(
268268
self.apiclient,

‎test/integration/smoke/test_vm_life_cycle.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,8 +1717,8 @@ def get_target_pool(self, vol):
17171717

17181718
volume = Volume.list(self.apiclient, id=vol.id)[0]
17191719
source_pool = list_storage_pools(self.apiclient, id=volume.storageid)[0]
1720-
if source_pool.type == 'RBD' and target_pools[0].type == 'RBD':
1721-
self.skipTest("Live VM migration between RBD pools is unsupported")
1720+
if source_pool.type == 'RBD':
1721+
self.skipTest("Live VM migration from RBD pool is unsupported")
17221722

17231723
return target_pools[0]
17241724

‎test/integration/smoke/test_volumes.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,7 +1817,7 @@ def get_expected_guest_visible_size(self, volume, vol_sz):
18171817
vol_sz = int(vol_sz)
18181818
if volume_pool.type.lower() == "powerflex":
18191819
vol_sz = vol_sz - (128 << 20) - ((vol_sz >> 30) * 200704)
1820-
elif volume_pool.type == "RBD" and getattr(volume, "encryptformat", None):
1820+
elif volume_pool.type.lower() == "rbd" and getattr(volume, "encryptformat", None):
18211821
# RBD volumes are encrypted natively by librbd: the LUKS2 header/keyslots (16 MiB) are
18221822
# reserved out of the volume's own size, so the guest sees size - header.
18231823
vol_sz = vol_sz - (16 << 20)
@@ -1877,7 +1877,8 @@ def check_volume_encryption(self, virtual_machine, volumes_count):
18771877
# Any other pool type keeps using qemu-native LUKS1: <encryption format='luks'> (no engine).
18781878
encryption_format_value = 'luks2' if self.storage_pool_type == "RBD" else 'luks'
18791879
encryption_format = virshxml_root.findall(".devices/disk/encryption[@format='%s']" % encryption_format_value)
1880-
self.assertIsNotNone(encryption_format, "The volume encryption format is not %s" % encryption_format_value)
1880+
self.assertGreater(len(encryption_format), 0,
1881+
"No volume is encrypted with the %s format in the domain XML of %s" % (encryption_format_value, instance_name))
18811882
self.assertEqual(
18821883
len(encryption_format),
18831884
volumes_count,
@@ -1893,7 +1894,8 @@ def check_volume_encryption(self, virtual_machine, volumes_count):
18931894
)
18941895

18951896
secret_type = virshxml_root.findall(".devices/disk/encryption/secret[@type='passphrase']")
1896-
self.assertIsNotNone(secret_type, "The volume encryption secret type is not passphrase")
1897+
self.assertGreater(len(secret_type), 0,
1898+
"No encryption secret of type passphrase in the domain XML of %s" % instance_name)
18971899
self.assertEqual(
18981900
len(secret_type),
18991901
volumes_count,

0 commit comments

Comments
 (0)