Skip to content

Commit

Permalink
test(integration): support v2 volume test on test_provisioner.py
Browse files Browse the repository at this point in the history
ref: longhorn/longhorn 9760

Signed-off-by: Chris Chien <[email protected]>
  • Loading branch information
chriscchien authored and derekbit committed Feb 20, 2025
1 parent 61fc814 commit 1358f84
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 7 additions & 1 deletion manager/integration/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
10 changes: 9 additions & 1 deletion manager/integration/tests/test_provisioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
"""
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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",
[
Expand Down

0 comments on commit 1358f84

Please sign in to comment.