From 1358f84ec3996c924d44e08b531925bf454333f6 Mon Sep 17 00:00:00 2001 From: Chris Chien Date: Thu, 6 Feb 2025 15:22:50 +0800 Subject: [PATCH] test(integration): support v2 volume test on test_provisioner.py ref: longhorn/longhorn 9760 Signed-off-by: Chris Chien --- manager/integration/tests/common.py | 8 +++++++- manager/integration/tests/test_provisioner.py | 10 +++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/manager/integration/tests/common.py b/manager/integration/tests/common.py index 7f8de7ef22..12ad7bc1f2 100644 --- a/manager/integration/tests/common.py +++ b/manager/integration/tests/common.py @@ -1684,7 +1684,13 @@ def node_default_tags(): tag_mappings = {} for tags, node in zip(DEFAULT_TAGS, nodes): - assert len(node.disks) == 1 + if DATA_ENGINE == "v2": + # if the v2 data engine is enabled, both a file system disk + # and a block disk will coexist. This is because a v2 backing image + # requires a file system disk to function. + assert len(node.disks) == 2 + else: + assert len(node.disks) == 1 update_disks = get_update_disks(node.disks) update_disks[list(update_disks)[0]].tags = tags["disk"] diff --git a/manager/integration/tests/test_provisioner.py b/manager/integration/tests/test_provisioner.py index 0b5b09d0fe..80353e4131 100644 --- a/manager/integration/tests/test_provisioner.py +++ b/manager/integration/tests/test_provisioner.py @@ -9,6 +9,7 @@ from common import write_pod_volume_data, check_volume_replicas from common import SETTING_REPLICA_NODE_SOFT_ANTI_AFFINITY from common import get_self_host_id +from common import DATA_ENGINE import subprocess DEFAULT_STORAGECLASS_NAME = "longhorn-provisioner" @@ -26,6 +27,8 @@ def create_storage(api, sc_manifest, pvc_manifest): body=pvc_manifest, namespace='default') + +@pytest.mark.v2_volume_test # NOQA @pytest.mark.coretest # NOQA def test_provisioner_mount(client, core_api, storage_class, pvc, pod): # NOQA """ @@ -81,6 +84,7 @@ def test_provisioner_generic_ephemeral(): pass +@pytest.mark.v2_volume_test # NOQA def test_provisioner_params(client, core_api, storage_class, pvc, pod): # NOQA """ Test that substituting different StorageClass parameters is reflected in @@ -107,7 +111,8 @@ def test_provisioner_params(client, core_api, storage_class, pvc, pod): # NOQA storage_class['metadata']['name'] = DEFAULT_STORAGECLASS_NAME storage_class['parameters'] = { 'numberOfReplicas': '2', - 'staleReplicaTimeout': '20' + 'staleReplicaTimeout': '20', + 'dataEngine': DATA_ENGINE } create_storage(core_api, storage_class, pvc) @@ -124,6 +129,7 @@ def test_provisioner_params(client, core_api, storage_class, pvc, pod): # NOQA assert volumes.data[0].state == "attached" +@pytest.mark.v2_volume_test # NOQA def test_provisioner_io(client, core_api, storage_class, pvc, pod): # NOQA """ Test that input and output on a StorageClass provisioned @@ -165,6 +171,7 @@ def test_provisioner_io(client, core_api, storage_class, pvc, pod): # NOQA assert resp == test_data +@pytest.mark.v2_volume_test # NOQA def test_provisioner_tags(client, core_api, node_default_tags, storage_class, pvc, pod): # NOQA """ Test that a StorageClass can properly provision a volume with requested @@ -216,6 +223,7 @@ def test_provisioner_tags(client, core_api, node_default_tags, storage_class, pv check_volume_replicas(volumes.data[0], tag_spec, node_default_tags) +@pytest.mark.v2_volume_test # NOQA @pytest.mark.parametrize( "inode_size,block_size", [