-
Notifications
You must be signed in to change notification settings - Fork 72
edit: clone conformance tests with 4-disk VM, no registry dependency (CNV-5607 & CNV-5608) #5624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,12 @@ | |
| Clone tests | ||
| """ | ||
|
|
||
| import bitmath | ||
| import pytest | ||
| from ocp_resources.datavolume import DataVolume | ||
|
|
||
| from tests.os_params import FEDORA_LATEST | ||
| from tests.storage.cdi_clone.utils import create_vm_from_clone_dv_template | ||
| from tests.storage.utils import ( | ||
| assert_pvc_snapshot_clone_annotation, | ||
| assert_use_populator, | ||
|
|
@@ -20,44 +22,11 @@ | |
| check_disk_count_in_vm, | ||
| create_dv, | ||
| create_vm_from_dv, | ||
| data_volume_template_dict_with_pvc_source, | ||
| get_dv_size_from_datasource, | ||
| overhead_size_for_dv, | ||
| sc_volume_binding_mode_is_wffc, | ||
| ) | ||
| from utilities.virt import ( | ||
| VirtualMachineForTests, | ||
| restart_vm_wait_for_running_vm, | ||
| running_vm, | ||
| ) | ||
|
|
||
|
|
||
| def create_vm_from_clone_dv_template( | ||
| vm_name, | ||
| dv_name, | ||
| namespace_name, | ||
| source_dv, | ||
| client, | ||
| volume_mode, | ||
| storage_class, | ||
| size=None, | ||
| ): | ||
| with VirtualMachineForTests( | ||
| name=vm_name, | ||
| namespace=namespace_name, | ||
| os_flavor=OS_FLAVOR_FEDORA, | ||
| client=client, | ||
| memory_guest=Images.Fedora.DEFAULT_MEMORY_SIZE, | ||
| data_volume_template=data_volume_template_dict_with_pvc_source( | ||
| target_dv_name=dv_name, | ||
| target_dv_namespace=namespace_name, | ||
| source_dv=source_dv, | ||
| volume_mode=volume_mode, | ||
| size=size, | ||
| storage_class=storage_class, | ||
| ), | ||
| ) as vm: | ||
| running_vm(vm=vm) | ||
| from utilities.virt import restart_vm_wait_for_running_vm | ||
|
|
||
|
|
||
| @pytest.mark.sno | ||
|
|
@@ -228,6 +197,7 @@ def test_successful_snapshot_clone( | |
|
|
||
|
|
||
| @pytest.mark.gating | ||
| @pytest.mark.conformance | ||
| @pytest.mark.polarion("CNV-5607") | ||
| @pytest.mark.s390x | ||
| def test_clone_from_fs_to_block_using_dv_template( | ||
|
|
@@ -248,6 +218,7 @@ def test_clone_from_fs_to_block_using_dv_template( | |
| ) | ||
|
|
||
|
|
||
| @pytest.mark.conformance | ||
| @pytest.mark.polarion("CNV-5608") | ||
| @pytest.mark.smoke() | ||
| @pytest.mark.s390x | ||
|
|
@@ -259,16 +230,16 @@ def test_clone_from_block_to_fs_using_dv_template( | |
| storage_class_with_filesystem_volume_mode, | ||
| default_fs_overhead, | ||
| ): | ||
| source_dv = fedora_dv_with_block_volume_mode | ||
| create_vm_from_clone_dv_template( | ||
|
Comment on lines
221
to
234
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a Please create a new, separate test that is required for the |
||
| vm_name="vm-5608", | ||
| dv_name="dv-5608", | ||
| namespace_name=namespace.name, | ||
| source_dv=fedora_dv_with_block_volume_mode, | ||
| source_dv=source_dv, | ||
| client=unprivileged_client, | ||
| volume_mode=DataVolume.VolumeMode.FILE, | ||
| # add fs overhead and round up the result | ||
| size=overhead_size_for_dv( | ||
| image_size=int(fedora_dv_with_block_volume_mode.size[:-2]), | ||
| image_size=bitmath.parse_string(source_dv.size, strict=False).to_GiB().value, | ||
| overhead_value=default_fs_overhead, | ||
| ), | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| storage_class=storage_class_with_filesystem_volume_mode, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| from utilities.storage import ( | ||
| add_dv_to_vm, | ||
| check_disk_count_in_vm, | ||
| data_volume_template_dict_with_pvc_source, | ||
| ) | ||
| from utilities.virt import VirtualMachineForTests, running_vm | ||
|
|
||
| NUM_CLONE_DISKS = 4 | ||
|
|
||
|
|
||
| def create_vm_from_clone_dv_template( | ||
| vm_name, | ||
| dv_name, | ||
| namespace_name, | ||
| source_dv, | ||
| client, | ||
| volume_mode, | ||
| storage_class, | ||
| size=None, | ||
| ): | ||
| """Create a VM with NUM_CLONE_DISKS cloned disks from source_dv and verify all disks are visible. | ||
|
|
||
| DV names are derived as {dv_name}-0, {dv_name}-1, etc. | ||
| """ | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| dv_templates = [ | ||
| data_volume_template_dict_with_pvc_source( | ||
| target_dv_name=f"{dv_name}-{idx}", | ||
| target_dv_namespace=namespace_name, | ||
| source_dv=source_dv, | ||
| volume_mode=volume_mode, | ||
| size=size, | ||
| storage_class=storage_class, | ||
| ) | ||
| for idx in range(NUM_CLONE_DISKS) | ||
| ] | ||
| with VirtualMachineForTests( | ||
| name=vm_name, | ||
| namespace=namespace_name, | ||
| client=client, | ||
| vm_instance_type_infer=True, | ||
| vm_preference_infer=True, | ||
| data_volume_template=dv_templates[0], | ||
| ) as vm: | ||
| for template in dv_templates[1:]: | ||
| add_dv_to_vm(vm=vm, template_dv=template) | ||
| running_vm(vm=vm) | ||
| check_disk_count_in_vm(vm=vm) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the sig-storage PRs, please start the PR title with
[Storage] ...For example:
[Storage] Add conformance test: clone VM with 4-disks