Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions tests/storage/test_libguestfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, TIMEOUT_3MIN, UNPRIVILEGED_PASSWORD, UNPRIVILEGED_USER

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Execution Plan

Run smoke tests: False
No smoke-marked test depends on test_libguestfs.py, the removed create_cirros_dv helper (now deleted from tests/storage/utils.py), or any changed symbol. Verified: zero remaining callers of create_cirros_dv in tests/; test_libguestfs.py carries no @pytest.mark.smoke marker.

Run gating tests: False
No gating-marked test file is in the affected set. Verified: rg -l '@pytest.mark.gating' tests/ returned no results.

Affected tests to run

  • tests/storage/test_libguestfs.py::test_virtctl_libguestfs_with_specific_user (tier2) — de-quarantined; now clones from fedora_data_source_scope_module via create_dv (replaces HTTP import of Cirros); adds libguestfs_pod.wait_for_status(RUNNING) before shell interaction; fixes regex "$"r"\\$" for pexpect; reuses libguestfs_pod reference for wait_deleted.
pytest -s -o log_cli=true -m tier2 --jira -k test_virtctl_libguestfs_with_specific_user --storage-class-matrix=ocs-storagecluster-ceph-rbd-virtualization

from utilities.infra import login_with_user_password
from utilities.storage import create_dv, get_dv_size_from_datasource

pytestmark = pytest.mark.post_upgrade

Expand All @@ -22,31 +22,42 @@ 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}",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add client field

Suggested change
name=f"libguestfs-tools-{dv_created_by_specific_user.name}",
client=unprivileged_client
name=f"libguestfs-tools-{dv_created_by_specific_user.name}",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thank you!

namespace=dv_created_by_specific_user.namespace,
)
libguestfs_pod.wait_for_status(status=Pod.Status.RUNNING, timeout=TIMEOUT_3MIN)
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
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()
Expand Down Expand Up @@ -86,13 +97,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,
)
Comment on lines -89 to -92

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep the DataSource change, but the test still needs to stay quarantined. I see it fails in 4.22 tier2 lane.

@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")
Expand Down
23 changes: 0 additions & 23 deletions tests/storage/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down