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
12 changes: 12 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
CLUSTER,
CNV_TEST_SERVICE_ACCOUNT,
CNV_VM_SSH_KEY_PATH,
DATA_SOURCE_NAME,
ES_NONE,
Comment thread
carterpewpew marked this conversation as resolved.
EXPECTED_CLUSTER_INSTANCE_TYPE_LABELS,
FEATURE_GATES,
Expand Down Expand Up @@ -881,6 +882,17 @@ def rhel10_data_source_scope_session(golden_images_namespace):
)


@pytest.fixture(scope="session")
def latest_rhel_data_source(golden_images_namespace):
"""Provide the DataSource for the latest RHEL version supported on this architecture."""
return DataSource(
client=golden_images_namespace.client,
name=py_config["latest_instance_type_rhel_os_dict"][DATA_SOURCE_NAME],
namespace=golden_images_namespace.name,
ensure_exists=True,
)


"""
VM creation from template
"""
Expand Down
13 changes: 0 additions & 13 deletions tests/infrastructure/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@

import pytest
from kubernetes.dynamic.exceptions import ResourceNotFoundError
from ocp_resources.data_source import DataSource
from pytest_testconfig import config as py_config
from timeout_sampler import TimeoutExpiredError

from tests.infrastructure.utils import (
verify_numa_enabled,
verify_tekton_operator_installed,
)
from tests.utils import verify_cpumanager_workers, verify_hugepages_1gi, verify_rwx_default_storage
from utilities.constants import DATA_SOURCE_NAME
from utilities.exceptions import ResourceMissingFieldError, ResourceValueError
from utilities.pytest_utils import exit_pytest_execution

Expand Down Expand Up @@ -99,13 +96,3 @@ def infrastructure_special_infra_sanity(
junitxml_property=junitxml_plugin,
admin_client=admin_client,
)


@pytest.fixture(scope="module")
def latest_rhel_data_source(golden_images_namespace):
return DataSource(
client=golden_images_namespace.client,
name=py_config["latest_instance_type_rhel_os_dict"][DATA_SOURCE_NAME],
namespace=golden_images_namespace.name,
ensure_exists=True,
)
11 changes: 7 additions & 4 deletions tests/storage/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
CNV_TEST_SERVICE_ACCOUNT,
OS_FLAVOR_FEDORA,
OS_FLAVOR_RHEL,
RHEL10_PREFERENCE,
PREFERENCE_STR,
SECURITY_CONTEXT,
TIMEOUT_1MIN,
TIMEOUT_5SEC,
Expand Down Expand Up @@ -393,7 +393,7 @@ def rhel_vm_for_snapshot(
admin_client,
namespace,
rhel_vm_name,
rhel10_data_source_scope_session,
latest_rhel_data_source,
snapshot_storage_class_name_scope_module,
):
"""Create a RHEL VM with using DataSource that supports snapshots"""
Expand All @@ -403,9 +403,12 @@ def rhel_vm_for_snapshot(
client=admin_client,
os_flavor=OS_FLAVOR_RHEL,
vm_instance_type=VirtualMachineClusterInstancetype(client=admin_client, name=U1_SMALL),
vm_preference=VirtualMachineClusterPreference(client=admin_client, name=RHEL10_PREFERENCE),
vm_preference=VirtualMachineClusterPreference(
client=admin_client,
name=py_config["latest_instance_type_rhel_os_dict"][PREFERENCE_STR],
),
data_volume_template=data_volume_template_with_source_ref_dict(
data_source=rhel10_data_source_scope_session,
data_source=latest_rhel_data_source,
storage_class=snapshot_storage_class_name_scope_module,
),
) as vm:
Expand Down
11 changes: 7 additions & 4 deletions tests/storage/vm_export/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
)
from ocp_resources.virtual_machine_export import VirtualMachineExport
from ocp_resources.virtual_machine_snapshot import VirtualMachineSnapshot
from pytest_testconfig import config as py_config

from tests.storage.constants import TEST_FILE_CONTENT, TEST_FILE_NAME
from tests.storage.vm_export.utils import create_blank_dv_by_specific_user, get_manifest_from_vmexport, get_manifest_url
from utilities.constants import OS_FLAVOR_RHEL, U1_SMALL, UNPRIVILEGED_PASSWORD, UNPRIVILEGED_USER
from utilities.constants import OS_FLAVOR_RHEL, PREFERENCE_STR, U1_SMALL, UNPRIVILEGED_PASSWORD, UNPRIVILEGED_USER
from utilities.infra import create_ns, login_with_user_password
from utilities.storage import data_volume_template_with_source_ref_dict, write_file_via_ssh
from utilities.virt import VirtualMachineForTests, running_vm
Expand Down Expand Up @@ -200,7 +201,7 @@ def vmexport_download_path(tmp_path):
def rhel_vm_for_snapshot_with_content(
unprivileged_client,
namespace,
rhel10_data_source_scope_session,
latest_rhel_data_source,
snapshot_storage_class_name_scope_module,
):
with VirtualMachineForTests(
Expand All @@ -209,9 +210,11 @@ def rhel_vm_for_snapshot_with_content(
client=unprivileged_client,
os_flavor=OS_FLAVOR_RHEL,
vm_instance_type=VirtualMachineClusterInstancetype(name=U1_SMALL),
vm_preference=VirtualMachineClusterPreference(name="rhel.10"),
vm_preference=VirtualMachineClusterPreference(
name=py_config["latest_instance_type_rhel_os_dict"][PREFERENCE_STR],
),
data_volume_template=data_volume_template_with_source_ref_dict(
data_source=rhel10_data_source_scope_session,
data_source=latest_rhel_data_source,
storage_class=snapshot_storage_class_name_scope_module,
),
) as vm:
Expand Down