From 442c5d25017059ed05a3673fd5cd7084146c9b46 Mon Sep 17 00:00:00 2001 From: Emanuele Prella Date: Sun, 14 Jun 2026 09:53:06 +0200 Subject: [PATCH 1/2] [4.21][Storage] De-quarantine libguestfs test and use data source (#4556) - 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. Fixing a quarantined test by enhancing code and explicitly waiting for libguestfs to be created. Additionally, using data source instead of artifactory, to align with other tests. CNV-47594 None https://redhat.atlassian.net/browse/CNV-47594 * **Tests** * Refactored test fixtures to use a generalized data-volume provisioning flow instead of a Cirros-specific helper. * Test setup now explicitly waits for data-volume readiness and for auxiliary pods to reach and exit RUNNING state. * Removed an expected-failure marker from a specific libguestfs test and simplified its fixture usage. --------- Signed-off-by: Emanuele Prella --- tests/storage/test_libguestfs.py | 39 ++++++++++++++++++-------------- tests/storage/utils.py | 23 ------------------- 2 files changed, 22 insertions(+), 40 deletions(-) diff --git a/tests/storage/test_libguestfs.py b/tests/storage/test_libguestfs.py index 622ac61d28..97ca428ec9 100644 --- a/tests/storage/test_libguestfs.py +++ b/tests/storage/test_libguestfs.py @@ -5,9 +5,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, 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 +22,18 @@ 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( + 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_1MIN) 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 +41,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() @@ -86,13 +96,8 @@ def client_for_test(request, admin_client, unprivileged_client): ], indirect=True, ) -@pytest.mark.xfail( - reason=f"{QUARANTINED}: Timeout exceeded. Tracked in CNV-62312", - run=False, -) @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 ff6b64d60e..9cd781a3eb 100644 --- a/tests/storage/utils.py +++ b/tests/storage/utils.py @@ -408,29 +408,6 @@ def _wait_for_sc_update(): yield edited_cdi_config -def create_cirros_dv( - namespace, - name, - storage_class, - client, - access_modes=None, - volume_mode=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): snapshot_indications = snapshot.instance.status.indications online = "Online" From 037a98d9f814dba6c6ba7cc17ea0f2f65a18d249 Mon Sep 17 00:00:00 2001 From: Emanuele Prella Date: Mon, 22 Jun 2026 10:18:07 +0200 Subject: [PATCH 2/2] Add client field and increase timeout Signed-off-by: Emanuele Prella --- tests/storage/test_libguestfs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/storage/test_libguestfs.py b/tests/storage/test_libguestfs.py index 97ca428ec9..c24d78809e 100644 --- a/tests/storage/test_libguestfs.py +++ b/tests/storage/test_libguestfs.py @@ -5,7 +5,7 @@ from ocp_resources.pod import Pod from pytest_testconfig import config as py_config -from utilities.constants import TIMEOUT_1MIN, UNPRIVILEGED_PASSWORD, UNPRIVILEGED_USER +from utilities.constants import TIMEOUT_1MIN, TIMEOUT_3MIN, UNPRIVILEGED_PASSWORD, UNPRIVILEGED_USER from utilities.infra import login_with_user_password from utilities.storage import create_dv, get_dv_size_from_datasource @@ -23,10 +23,11 @@ def virtctl_libguestfs_by_user( {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_1MIN) + libguestfs_pod.wait_for_status(status=Pod.Status.RUNNING, timeout=TIMEOUT_3MIN) guestfs_proc.send("\n\n") guestfs_proc.expect(r"\$", timeout=TIMEOUT_1MIN) yield guestfs_proc