From 17d7d32a47794b3179710d16b0b9415bfda4d9e6 Mon Sep 17 00:00:00 2001 From: Emanuele Prella Date: Thu, 9 Jul 2026 12:56:47 +0200 Subject: [PATCH 1/2] [4.21][Storage] De-quarantine libguestfs test and use data source (#5263) - De-quarantine test_virtctl_libguestfs_with_specific_user. - Replace HTTP import in favor of data source cloning. - Wait for the libguestfs container to be created before performing operations in it. CNV-47594 manual backporting https://github.com/RedHatQE/openshift-virtualization-tests/pull/4556 and https://github.com/RedHatQE/openshift-virtualization-tests/pull/5426 --------- Signed-off-by: Emanuele Prella --- tests/storage/test_libguestfs.py | 46 ++++++++++++++++++++------------ tests/storage/utils.py | 21 --------------- 2 files changed, 29 insertions(+), 38 deletions(-) diff --git a/tests/storage/test_libguestfs.py b/tests/storage/test_libguestfs.py index 67694e0ced..57ba960ce7 100644 --- a/tests/storage/test_libguestfs.py +++ b/tests/storage/test_libguestfs.py @@ -1,3 +1,9 @@ +""" +Test virtctl guestfs command with specific user. + +Jira: https://redhat.atlassian.net/browse/CNV-7487 # +""" + from subprocess import check_output import pexpect @@ -5,9 +11,9 @@ from ocp_resources.pod import Pod from pytest_testconfig import config as py_config -from tests.storage.utils import create_cirros_dv -from utilities.constants import QUARANTINED, TIMEOUT_1MIN, UNPRIVILEGED_PASSWORD, UNPRIVILEGED_USER +from utilities.constants import TIMEOUT_1MIN, TIMEOUT_10MIN, UNPRIVILEGED_PASSWORD, UNPRIVILEGED_USER from utilities.infra import login_with_user_password +from utilities.storage import create_dv, get_dv_size_from_datasource pytestmark = pytest.mark.post_upgrade @@ -22,17 +28,19 @@ def virtctl_libguestfs_by_user( f"virtctl guestfs {dv_created_by_specific_user.name} -n {dv_created_by_specific_user.namespace} \ {fs_group_flag}" ) - + libguestfs_pod = Pod( + client=unprivileged_client, + name=f"libguestfs-tools-{dv_created_by_specific_user.name}", + namespace=dv_created_by_specific_user.namespace, + ) + libguestfs_pod.wait_for_status(status=Pod.Status.RUNNING, timeout=TIMEOUT_10MIN) guestfs_proc.send("\n\n") - guestfs_proc.expect("$", timeout=TIMEOUT_1MIN) + guestfs_proc.expect(r"\$", timeout=TIMEOUT_1MIN) yield guestfs_proc guestfs_proc.send("exit\n") guestfs_proc.expect(pexpect.EOF, timeout=TIMEOUT_1MIN) guestfs_proc.close() - Pod( - name=f"libguestfs-tools-{dv_created_by_specific_user.name}", - namespace=dv_created_by_specific_user.namespace, - ).wait_deleted() + libguestfs_pod.wait_deleted() @pytest.fixture @@ -40,13 +48,22 @@ def dv_created_by_specific_user( request, namespace, client_for_test, + fedora_data_source_scope_module, ): - yield from create_cirros_dv( - name=request.param["data_volume_name"], - namespace=namespace.name, + with create_dv( + dv_name=request.param["data_volume_name"], storage_class=py_config["default_storage_class"], client=client_for_test, - ) + namespace=namespace.name, + source_ref={ + "kind": fedora_data_source_scope_module.kind, + "name": fedora_data_source_scope_module.name, + "namespace": fedora_data_source_scope_module.namespace, + }, + size=get_dv_size_from_datasource(data_source=fedora_data_source_scope_module), + ) as dv: + dv.wait_for_dv_success() + yield dv @pytest.fixture() @@ -67,10 +84,6 @@ def client_for_test(request, admin_client, unprivileged_client): ) -@pytest.mark.xfail( - reason=f"{QUARANTINED}: the test is not stable; tracked in CNV-62312", - run=False, -) @pytest.mark.parametrize( ( "client_for_test", @@ -92,7 +105,6 @@ def client_for_test(request, admin_client, unprivileged_client): ) @pytest.mark.s390x def test_virtctl_libguestfs_with_specific_user( - client_for_test, virtctl_libguestfs_by_user, ): virtctl_libguestfs_by_user.sendline("libguestfs-test-tool") diff --git a/tests/storage/utils.py b/tests/storage/utils.py index a3c05740ed..388af24b0b 100644 --- a/tests/storage/utils.py +++ b/tests/storage/utils.py @@ -355,27 +355,6 @@ def create_windows19_vm(dv_name, namespace, client, vm_name, cpu_model, storage_ ) -def create_cirros_dv( - namespace, - name, - storage_class, - access_modes=None, - volume_mode=None, - client=None, - dv_size=Images.Cirros.DEFAULT_DV_SIZE, -): - with create_dv( - dv_name=f"dv-{name}", - namespace=namespace, - url=get_http_image_url(image_directory=Images.Cirros.DIR, image_name=Images.Cirros.QCOW2_IMG), - size=dv_size, - storage_class=storage_class, - access_modes=access_modes, - volume_mode=volume_mode, - client=client, - ) as dv: - dv.wait_for_dv_success() - yield dv def check_snapshot_indication(snapshot, is_online): From a18280d1a04cdb929177afd364c26935c867db96 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 11:14:42 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/storage/utils.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/storage/utils.py b/tests/storage/utils.py index 388af24b0b..6723ab1640 100644 --- a/tests/storage/utils.py +++ b/tests/storage/utils.py @@ -355,8 +355,6 @@ def create_windows19_vm(dv_name, namespace, client, vm_name, cpu_model, storage_ ) - - def check_snapshot_indication(snapshot, is_online): snapshot_indications = snapshot.instance.status.indications online = "Online"