Skip to content

Refactor OS matrix to support different architectures #983

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

Open
wants to merge 49 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
61db6af
feat: refactor image architectures
rnetser May 17, 2025
341e3be
fix versions and refactor functio location
rnetser May 17, 2025
b1d827a
get os from py_config only if exists
rnetser May 17, 2025
f18a9cf
add missing file
rnetser May 17, 2025
50b0ad8
fix tox and use global_config_x86.py
rnetser May 18, 2025
df53454
add todo on cirros s390x class
rnetser May 18, 2025
7c4f0fa
catch AttributeError it not set
rnetser May 18, 2025
a8fa849
catch AttributeError it not set
rnetser May 18, 2025
2f333d9
catch AttributeError it not set
rnetser May 18, 2025
ed3a9e5
update get_test_images_arch_class to upper
rnetser May 18, 2025
ff6f07c
Merge branch 'main' of https://github.com/RedHatQE/openshift-virtuali…
rnetser May 18, 2025
6c5a142
address comments and refactor archs
rnetser May 18, 2025
ceef9b6
Merge branch 'main' of https://github.com/RedHatQE/openshift-virtuali…
rnetser May 19, 2025
4b8216d
Merge branch 'main' of https://github.com/RedHatQE/openshift-virtuali…
rnetser May 19, 2025
71caec3
Merge branch 'main' of https://github.com/RedHatQE/openshift-virtuali…
rnetser May 20, 2025
a86e8a3
Merge branch 'main' of https://github.com/RedHatQE/openshift-virtuali…
rnetser May 20, 2025
dbf91d9
Merge branch 'main' of github.com:rnetser/openshift-virtualization-te…
rnetser May 22, 2025
f930f62
Merge branch 'main' of https://github.com/RedHatQE/openshift-virtuali…
rnetser May 22, 2025
ad21992
Move base images to data classes
rnetser May 22, 2025
ce0178c
resolve merge conflicts
rnetser May 28, 2025
652f5a8
add markers to pytest.ini
rnetser May 28, 2025
f02bf0a
address comments
rnetser May 28, 2025
bd1ce05
Merge branch 'main' of https://github.com/RedHatQE/openshift-virtuali…
rnetser May 29, 2025
74c3951
address review comments
rnetser May 29, 2025
a335779
add to tox
rnetser May 29, 2025
52f1e8f
fix tox
rnetser May 29, 2025
24d573d
Merge branch 'main' of https://github.com/RedHatQE/openshift-virtuali…
rnetser May 29, 2025
6e7b452
Merge branch 'main' of https://github.com/RedHatQE/openshift-virtuali…
rnetser Jun 1, 2025
f5019b0
update markers description
rnetser Jun 1, 2025
721bcba
Merge branch 'main' of https://github.com/RedHatQE/openshift-virtuali…
rnetser Jun 3, 2025
9cc19de
resolve conflicts
rnetser Jun 3, 2025
093716c
Merge branch 'main' of https://github.com/RedHatQE/openshift-virtuali…
rnetser Jun 4, 2025
7482645
address comments
rnetser Jun 4, 2025
61e1c08
fix dataclasses
rnetser Jun 4, 2025
d0425b1
add OS_VERSION_STR to all
rnetser Jun 4, 2025
6163446
resolve conflicts
rnetser Jun 5, 2025
0c0df1b
add docstrings
rnetser Jun 5, 2025
613957c
fix pre-commit
rnetser Jun 5, 2025
3c0d340
fix missing matrix flows
rnetser Jun 5, 2025
3b516b8
Merge branch 'main' of https://github.com/RedHatQE/openshift-virtuali…
rnetser Jun 5, 2025
933ca3d
Merge branch 'main' of https://github.com/RedHatQE/openshift-virtuali…
rnetser Jun 5, 2025
8be8d19
Merge branch 'main' of https://github.com/RedHatQE/openshift-virtuali…
rnetser Jun 5, 2025
3e86364
update gcp ini file
rnetser Jun 5, 2025
e4087ba
fix windows dir
rnetser Jun 5, 2025
811fe53
fix dir assignment
rnetser Jun 6, 2025
ec28a19
update readme
rnetser Jun 6, 2025
0d5c61b
re-add removed test
rnetser Jun 6, 2025
b532999
resolve conflicts
rnetser Jun 10, 2025
dcdff86
resolve conflicts
rnetser Jun 10, 2025
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ nameserver 192.168.8.1
The tests can dynamically select test images based on the system's architecture. This is controlled by the environment variable `OPENSHIFT_VIRTUALIZATION_TEST_IMAGES_ARCH`. Supported architectures include:

- `x86_64` (default)
- `arm64`
- `s390x` (currently work in progress)

### Usage
The architecture-specific test images class is selected automatically based on the `OPENSHIFT_VIRTUALIZATION_TEST_IMAGES_ARCH` environment variable. If the variable is not set, the default architecture `x86_64` is used.
Expand Down
32 changes: 16 additions & 16 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,24 +585,24 @@ def _update_os_related_config():
# with runtime windows_os_matrix value(s).
# Some tests extract a single OS from the matrix and may fail if running with
# passed values from cli
py_config["system_windows_os_matrix"] = py_config["windows_os_matrix"]
py_config["system_rhel_os_matrix"] = py_config["rhel_os_matrix"]
if windows_os_matrix := py_config.get("windows_os_matrix"):
py_config["system_windows_os_matrix"] = windows_os_matrix

if rhel_os_matrix := py_config.get("rhel_os_matrix"):
py_config["system_rhel_os_matrix"] = rhel_os_matrix

# Update OS matrix list with the latest OS if running with os_group
if session.config.getoption("latest_rhel"):
py_config["rhel_os_matrix"] = [utilities.infra.generate_latest_os_dict(os_list=py_config["rhel_os_matrix"])]
if session.config.getoption("latest_windows"):
py_config["windows_os_matrix"] = [
utilities.infra.generate_latest_os_dict(os_list=py_config["windows_os_matrix"])
]
if session.config.getoption("latest_centos"):
py_config["centos_os_matrix"] = [
utilities.infra.generate_latest_os_dict(os_list=py_config["centos_os_matrix"])
]
if session.config.getoption("latest_fedora"):
py_config["fedora_os_matrix"] = [
utilities.infra.generate_latest_os_dict(os_list=py_config["fedora_os_matrix"])
]
if session.config.getoption("latest_rhel") and rhel_os_matrix:
py_config["rhel_os_matrix"] = [utilities.infra.generate_latest_os_dict(os_list=rhel_os_matrix)]

if session.config.getoption("latest_windows") and windows_os_matrix:
py_config["windows_os_matrix"] = [utilities.infra.generate_latest_os_dict(os_list=windows_os_matrix)]

if session.config.getoption("latest_centos") and (centos_os_matrix := py_config.get("centos_os_matrix")):
py_config["centos_os_matrix"] = [utilities.infra.generate_latest_os_dict(os_list=centos_os_matrix)]

if session.config.getoption("latest_fedora") and (fedora_os_matrix := py_config.get("fedora_os_matrix")):
py_config["fedora_os_matrix"] = [utilities.infra.generate_latest_os_dict(os_list=fedora_os_matrix)]

data_collector_dict = set_data_collector_values()
shutil.rmtree(
Expand Down
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ addopts =
-p no:logging
--basetemp=/tmp/pytest
--strict-markers
--tc-file=tests/global_config.py
Copy link
Contributor

Choose a reason for hiding this comment

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

we dont want a default global config file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no; if you add one in cmd, the plugin will use both

Copy link
Contributor

Choose a reason for hiding this comment

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

Make sense

And what about the jenkins jobs?
Do they set --tc-file explicity? because if they dont, 4.19 amd jobs may break

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, there's a jira for them to work on this. this PR cannot be merged before they make the change

--tc-file=tests/global_config_x86.py
--tc-format=python
--show-progress
--order-dependencies
Expand Down
14 changes: 8 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1881,12 +1881,14 @@ def rhel_latest_os_params():
"""This fixture is needed as during collection pytest_testconfig is empty.
os_params or any globals using py_config in conftest cannot be used.
"""
latest_rhel_dict = py_config["latest_rhel_os_dict"]
return {
"rhel_image_path": f"{get_test_artifact_server_url()}{latest_rhel_dict['image_path']}",
"rhel_dv_size": latest_rhel_dict["dv_size"],
"rhel_template_labels": latest_rhel_dict["template_labels"],
}
if latest_rhel_dict := py_config.get("latest_rhel_os_dict"):
return {
"rhel_image_path": f"{get_test_artifact_server_url()}{latest_rhel_dict['image_path']}",
"rhel_dv_size": latest_rhel_dict["dv_size"],
"rhel_template_labels": latest_rhel_dict["template_labels"],
}

return {}


@pytest.fixture(scope="session")
Expand Down
242 changes: 6 additions & 236 deletions tests/global_config.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import os
from typing import Any

from ocp_resources.datavolume import DataVolume
from ocp_resources.deployment import Deployment
from ocp_resources.template import Template
from ocp_resources.virtual_machine import VirtualMachine

from utilities.constants import (
Expand All @@ -20,46 +18,29 @@
CNV_OPERATORS,
CNV_PODS_NO_HPP_CSI_HPP_POOL,
CNV_PROMETHEUS_RULES,
DATA_SOURCE_NAME,
DV_SIZE_STR,
FLAVOR_STR,
HCO_CATALOG_SOURCE,
HPP_CAPABILITIES,
IMAGE_NAME_STR,
IMAGE_PATH_STR,
INSTANCE_TYPE_STR,
IPV4_STR,
IPV6_STR,
KUBEVIRT_VMI_CPU_SYSTEM_USAGE_SECONDS_TOTAL_QUERY_STR,
KUBEVIRT_VMI_CPU_USAGE_SECONDS_TOTAL_QUERY_STR,
KUBEVIRT_VMI_CPU_USER_USAGE_SECONDS_TOTAL_QUERY_STR,
KUBEVIRT_VMI_VCPU_DELAY_SECONDS_TOTAL_QUERY_STR,
LATEST_RELEASE_STR,
LINUX_BRIDGE,
OS_STR,
OS_VERSION_STR,
OVS_BRIDGE,
PREFERENCE_STR,
PRODUCTION_CATALOG_SOURCE,
TEKTON_AVAILABLE_PIPELINEREF,
TEKTON_AVAILABLE_TASKS,
TEMPLATE_LABELS_STR,
TIMEOUT_5MIN,
TIMEOUT_5SEC,
TLS_CUSTOM_POLICY,
TLS_OLD_POLICY,
VM_CONSOLE_PROXY_CLUSTER_RESOURCES,
VM_CONSOLE_PROXY_NAMESPACE_RESOURCES,
WIN_2K22,
WIN_2K25,
WIN_10,
WIN_11,
WORKLOAD_STR,
Images,
NamespacesNames,
StorageClassNames,
)
from utilities.infra import get_latest_os_dict_list
from utilities.storage import HppCsiStorageClass

global config
Expand Down Expand Up @@ -199,229 +180,18 @@ def _get_default_storage_class(sc_list):

data_import_cron_matrix = [
{"centos-stream9": {"instance_type": "u1.medium", "preference": "centos.stream9"}},
{"centos-stream10": {"instance_type": "u1.medium", "preference": "centos.stream10"}},
{
"centos-stream10": {
"instance_type": "u1.medium",
"preference": "centos.stream10",
}
},
{"fedora": {"instance_type": "u1.medium", "preference": "fedora"}},
{"rhel8": {"instance_type": "u1.medium", "preference": "rhel.8"}},
{"rhel9": {"instance_type": "u1.medium", "preference": "rhel.9"}},
{"rhel10": {"instance_type": "u1.medium", "preference": "rhel.10"}},
]

rhel_os_matrix = [
{
"rhel-7-8": {
OS_VERSION_STR: "7.8",
IMAGE_NAME_STR: Images.Rhel.RHEL7_8_IMG,
IMAGE_PATH_STR: os.path.join(Images.Rhel.DIR, Images.Rhel.RHEL7_8_IMG),
DV_SIZE_STR: Images.Rhel.DEFAULT_DV_SIZE,
TEMPLATE_LABELS_STR: {
OS_STR: "rhel7.8",
WORKLOAD_STR: Template.Workload.SERVER,
FLAVOR_STR: Template.Flavor.TINY,
},
}
},
{
"rhel-7-9": {
OS_VERSION_STR: "7.9",
IMAGE_NAME_STR: Images.Rhel.RHEL7_9_IMG,
IMAGE_PATH_STR: os.path.join(Images.Rhel.DIR, Images.Rhel.RHEL7_9_IMG),
DV_SIZE_STR: Images.Rhel.DEFAULT_DV_SIZE,
TEMPLATE_LABELS_STR: {
OS_STR: "rhel7.9",
WORKLOAD_STR: Template.Workload.SERVER,
FLAVOR_STR: Template.Flavor.TINY,
},
}
},
{
"rhel-8-8": {
OS_VERSION_STR: "8.8",
IMAGE_NAME_STR: Images.Rhel.RHEL8_8_IMG,
IMAGE_PATH_STR: os.path.join(Images.Rhel.DIR, Images.Rhel.RHEL8_8_IMG),
DV_SIZE_STR: Images.Rhel.DEFAULT_DV_SIZE,
TEMPLATE_LABELS_STR: {
OS_STR: "rhel8.8",
WORKLOAD_STR: Template.Workload.SERVER,
FLAVOR_STR: Template.Flavor.TINY,
},
}
},
{
"rhel-8-10": {
OS_VERSION_STR: "8.10",
IMAGE_NAME_STR: Images.Rhel.RHEL8_10_IMG,
IMAGE_PATH_STR: os.path.join(Images.Rhel.DIR, Images.Rhel.RHEL8_10_IMG),
DV_SIZE_STR: Images.Rhel.DEFAULT_DV_SIZE,
TEMPLATE_LABELS_STR: {
OS_STR: "rhel8.10",
WORKLOAD_STR: Template.Workload.SERVER,
FLAVOR_STR: Template.Flavor.TINY,
},
}
},
{
"rhel-9-4": {
OS_VERSION_STR: "9.4",
IMAGE_NAME_STR: Images.Rhel.RHEL9_4_IMG,
IMAGE_PATH_STR: os.path.join(Images.Rhel.DIR, Images.Rhel.RHEL9_4_IMG),
DV_SIZE_STR: Images.Rhel.DEFAULT_DV_SIZE,
TEMPLATE_LABELS_STR: {
OS_STR: "rhel9.4",
WORKLOAD_STR: Template.Workload.SERVER,
FLAVOR_STR: Template.Flavor.TINY,
},
}
},
{
"rhel-9-6": {
OS_VERSION_STR: "9.6",
IMAGE_NAME_STR: Images.Rhel.RHEL9_6_IMG,
IMAGE_PATH_STR: os.path.join(Images.Rhel.DIR, Images.Rhel.RHEL9_6_IMG),
DV_SIZE_STR: Images.Rhel.DEFAULT_DV_SIZE,
LATEST_RELEASE_STR: True,
TEMPLATE_LABELS_STR: {
OS_STR: "rhel9.6",
WORKLOAD_STR: Template.Workload.SERVER,
FLAVOR_STR: Template.Flavor.TINY,
},
}
},
]

windows_os_matrix = [
{
"win-10": {
OS_VERSION_STR: "10",
IMAGE_NAME_STR: Images.Windows.WIN10_IMG,
IMAGE_PATH_STR: os.path.join(Images.Windows.UEFI_WIN_DIR, Images.Windows.WIN10_IMG),
DV_SIZE_STR: Images.Windows.DEFAULT_DV_SIZE,
TEMPLATE_LABELS_STR: {
OS_STR: WIN_10,
WORKLOAD_STR: Template.Workload.DESKTOP,
FLAVOR_STR: Template.Flavor.MEDIUM,
},
}
},
{
"win-2016": {
OS_VERSION_STR: "2016",
IMAGE_NAME_STR: Images.Windows.WIN2k16_IMG,
IMAGE_PATH_STR: os.path.join(Images.Windows.UEFI_WIN_DIR, Images.Windows.WIN2k16_IMG),
DV_SIZE_STR: Images.Windows.DEFAULT_DV_SIZE,
TEMPLATE_LABELS_STR: {
OS_STR: "win2k16",
WORKLOAD_STR: Template.Workload.SERVER,
FLAVOR_STR: Template.Flavor.MEDIUM,
},
}
},
{
"win-2019": {
OS_VERSION_STR: "2019",
IMAGE_NAME_STR: Images.Windows.WIN2k19_IMG,
IMAGE_PATH_STR: os.path.join(Images.Windows.UEFI_WIN_DIR, Images.Windows.WIN2k19_IMG),
DV_SIZE_STR: Images.Windows.DEFAULT_DV_SIZE,
LATEST_RELEASE_STR: True,
TEMPLATE_LABELS_STR: {
OS_STR: "win2k19",
WORKLOAD_STR: Template.Workload.SERVER,
FLAVOR_STR: Template.Flavor.MEDIUM,
},
}
},
{
"win-11": {
OS_VERSION_STR: "11",
IMAGE_NAME_STR: Images.Windows.WIN11_IMG,
IMAGE_PATH_STR: os.path.join(Images.Windows.DIR, Images.Windows.WIN11_IMG),
DV_SIZE_STR: Images.Windows.DEFAULT_DV_SIZE,
TEMPLATE_LABELS_STR: {
OS_STR: WIN_11,
WORKLOAD_STR: Template.Workload.DESKTOP,
FLAVOR_STR: Template.Flavor.MEDIUM,
},
}
},
{
"win-2022": {
OS_VERSION_STR: "2022",
IMAGE_NAME_STR: Images.Windows.WIN2022_IMG,
IMAGE_PATH_STR: os.path.join(Images.Windows.DIR, Images.Windows.WIN2022_IMG),
DV_SIZE_STR: Images.Windows.DEFAULT_DV_SIZE,
TEMPLATE_LABELS_STR: {
OS_STR: WIN_2K22,
WORKLOAD_STR: Template.Workload.SERVER,
FLAVOR_STR: Template.Flavor.MEDIUM,
},
}
},
{
"win-2025": {
OS_VERSION_STR: "2025",
IMAGE_NAME_STR: Images.Windows.WIN2k25_IMG,
IMAGE_PATH_STR: os.path.join(Images.Windows.UEFI_WIN_DIR, Images.Windows.WIN2k25_IMG),
DV_SIZE_STR: Images.Windows.DEFAULT_DV_SIZE,
TEMPLATE_LABELS_STR: {
OS_STR: WIN_2K25,
WORKLOAD_STR: Template.Workload.SERVER,
FLAVOR_STR: Template.Flavor.MEDIUM,
},
}
},
]

fedora_os_matrix = [
{
"fedora-41": {
IMAGE_NAME_STR: Images.Fedora.FEDORA41_IMG,
IMAGE_PATH_STR: os.path.join(Images.Fedora.DIR, Images.Fedora.FEDORA41_IMG),
DV_SIZE_STR: Images.Fedora.DEFAULT_DV_SIZE,
LATEST_RELEASE_STR: True,
TEMPLATE_LABELS_STR: {
OS_STR: "fedora41",
WORKLOAD_STR: Template.Workload.SERVER,
FLAVOR_STR: Template.Flavor.SMALL,
},
}
},
]

centos_os_matrix = [
{
"centos-stream-9": {
IMAGE_NAME_STR: Images.CentOS.CENTOS_STREAM_9_IMG,
IMAGE_PATH_STR: os.path.join(Images.CentOS.DIR, Images.CentOS.CENTOS_STREAM_9_IMG),
DV_SIZE_STR: Images.CentOS.DEFAULT_DV_SIZE,
LATEST_RELEASE_STR: True,
TEMPLATE_LABELS_STR: {
OS_STR: "centos-stream9",
WORKLOAD_STR: Template.Workload.SERVER,
FLAVOR_STR: Template.Flavor.TINY,
},
}
},
]

instance_type_rhel_os_matrix = [
{
"rhel-10": {
OS_VERSION_STR: "10",
DV_SIZE_STR: Images.Rhel.DEFAULT_DV_SIZE,
INSTANCE_TYPE_STR: "u1.medium",
PREFERENCE_STR: "rhel.10",
DATA_SOURCE_NAME: "rhel10",
LATEST_RELEASE_STR: True,
}
},
]

(
latest_rhel_os_dict,
latest_windows_os_dict,
latest_fedora_os_dict,
latest_centos_os_dict,
) = get_latest_os_dict_list(os_list=[rhel_os_matrix, windows_os_matrix, fedora_os_matrix, centos_os_matrix])

ip_stack_version_matrix = [
IPV4_STR,
IPV6_STR,
Expand Down
Loading