Manual cherry-pick: [4.21] [Storage] refactor os matrix generator(#3883)#4870
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (4)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
AI Features
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
4e7601a to
98b26de
Compare
|
/verified cancel |
|
/verified |
Test execution plan request detailsCRITICAL: You MUST post an inline review comment on the first changed line of the first file. As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan. Analysis Requirements:
Output rules: Your deliverable: Test Execution Plan
Use these formats:
Real test commands (MANDATORY when changes affect session/runtime code): When the affected code runs at session/collection time (conftest fixtures, pytest plugins,
Example output for a session-startup fix: Guidelines:
Hardware-Related Checks (SR-IOV, GPU, DPDK): When PR modifies fixtures for hardware-specific resources:
CRITICAL WORKFLOW COMPLETION RULES: When responding to this test execution plan request, you MUST follow these rules EXACTLY:
ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):
Remember: The pull request review is visible to users. Additional comments are redundant noise. CRITICAL — Verification rules for smoke and gating decisions: |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
gh pr view 4870 --repo RedHatQE/openshift-virtualization-tests --json headRefOid,files --jq '{sha: .headRefOid, files: [.files[].path]}'Length of output: 550 🏁 Script executed: #!/bin/bash
COMMIT_SHA="1401e3e1bf1b215a1a720f0f116ecf8b51c54c71"
BODY="**Test Execution Plan**
- **Run smoke tests: True**
- \`tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py\` (smoke) → \`py_config[\"rhel_os_matrix\"]\` → \`generate_os_matrix_dicts()\` in \`conftest.py::pytest_sessionstart\`
- \`tests/infrastructure/instance_types/supported_os/test_rhel_os.py\` (smoke) → \`py_config[\"instance_type_rhel_os_matrix\"]\` → \`generate_os_matrix_dicts()\` in \`conftest.py::pytest_sessionstart\`
- \`tests/storage/cdi_upload/test_upload_virtctl.py\` (smoke) → \`py_config[\"latest_rhel_os_dict\"]\` → \`update_latest_os_config()\` in \`conftest.py::pytest_sessionstart\`
- **Run gating tests: True**
- \`tests/storage/cdi_upload/test_upload_virtctl.py\` (gating) → \`py_config[\"latest_rhel_os_dict\"]\` → \`update_latest_os_config()\` → \`generate_os_matrix_dicts()\` (refactored into \`utilities/pytest_utils.py\`)
- \`tests/storage/cdi_import/test_import_http.py\` (gating) → \`py_config[\"latest_windows_os_dict\"]\` → \`update_latest_os_config()\` → \`generate_os_matrix_dicts()\`
**Affected tests to run:**
- \`tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py\` (smoke)
- \`tests/infrastructure/instance_types/supported_os/test_rhel_os.py\` (smoke)
- \`tests/storage/cdi_upload/test_upload_virtctl.py\` (smoke + gating)
- \`tests/storage/cdi_import/test_import_http.py\` (gating)
- \`utilities/unittests/test_os_utils.py\`
- \`utilities/unittests/test_pytest_utils.py\`
**Real tests (cluster required)**
The refactored \`generate_os_matrix_dicts()\` and \`update_latest_os_config()\` run at session startup — verify end-to-end on a real cluster:
Error path (import chain after refactor — s390x arch-specific path):
\`\`\`
pytest tests/infrastructure/instance_types/supported_os/test_rhel_os.py --collect-only --tc-file=tests/global_config_s390x.py
\`\`\`
Expected: collection succeeds, \`py_config[\"instance_type_rhel_os_matrix\"]\` populated with s390x-specific preferences (no \`KeyError\` / \`ImportError\`)
Happy path (regression — x86_64, OS matrix values correct):
\`\`\`
pytest tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py --collect-only --tc-file=tests/global_config_x86_64.py
\`\`\`
Expected: parametrized test IDs match expected RHEL OS versions for x86_64"
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
/repos/RedHatQE/openshift-virtualization-tests/pulls/4870/reviews \
-f commit_id="$COMMIT_SHA" \
-f event="COMMENT" \
-f "comments[][path]=conftest.py" \
-F "comments[][line]=30" \
-f "comments[][side]=RIGHT" \
-f "comments[][body]=$BODY"Length of output: 4459 |
move os matrix generators from global_config_* files into a centralized location Original PR: RedHatQE#3883 Signed-off-by: Alexander Mamani <alexander.mamani@ibm.com>
- utilities/pytest_utils.py: Remove unused mark_nmstate_dependent_tests function Signed-off-by: Alexander Mamani <alexander.mamani@ibm.com>
Signed-off-by: Alexander Mamani <alexander.mamani@ibm.com>
Since in OCP 4.21 is still using X86_64 as suffix for preference and unittest are using AMD_64 suffix. Make cpu_arch flexible for both Signed-off-by: Alexander Mamani <alexander.mamani@ibm.com>
|
Clean rebase detected — no code changes compared to previous head ( |
|
/verified cancel |
|
/verified |
Test execution plan request detailsCRITICAL: You MUST post an inline review comment on the first changed line of the first file. As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan. Analysis Requirements:
Output rules: Your deliverable: Test Execution Plan
Use these formats:
Real test commands (MANDATORY when changes affect session/runtime code): When the affected code runs at session/collection time (conftest fixtures, pytest plugins,
Example output for a session-startup fix: Guidelines:
Hardware-Related Checks (SR-IOV, GPU, DPDK): When PR modifies fixtures for hardware-specific resources:
CRITICAL WORKFLOW COMPLETION RULES: When responding to this test execution plan request, you MUST follow these rules EXACTLY:
ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):
Remember: The pull request review is visible to users. Additional comments are redundant noise. CRITICAL — Verification rules for smoke and gating decisions: |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
gh pr view 4870 --repo RedHatQE/openshift-virtualization-tests --json headRefOid,files --jq '{sha: .headRefOid, files: [.files[].path]}'Length of output: 550 🏁 Script executed: #!/bin/bash
COMMIT_SHA="a27819d3396a7ec947283d9a3a734fa2afa137f0"
BODY="**Test Execution Plan**
- **Run smoke tests: True**
- \`tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py\` (smoke) → \`py_config[\"rhel_os_matrix\"]\` → \`generate_os_matrix_dicts()\` in \`conftest.py::pytest_sessionstart\`
- \`tests/infrastructure/instance_types/supported_os/test_rhel_os.py\` (smoke) → \`py_config[\"instance_type_rhel_os_matrix\"]\` → \`generate_os_matrix_dicts()\` in \`conftest.py::pytest_sessionstart\`
- \`tests/storage/cdi_upload/test_upload_virtctl.py\` (smoke) → \`py_config[\"latest_rhel_os_dict\"]\` → \`update_latest_os_config()\` in \`conftest.py::pytest_sessionstart\`
- **Run gating tests: True**
- \`tests/storage/cdi_upload/test_upload_virtctl.py\` (gating) → \`py_config[\"latest_rhel_os_dict\"]\` → \`update_latest_os_config()\` → \`generate_os_matrix_dicts()\` (refactored into \`utilities/pytest_utils.py\`)
- \`tests/storage/cdi_import/test_import_http.py\` (gating) → \`py_config[\"latest_windows_os_dict\"]\` → \`update_latest_os_config()\` → \`generate_os_matrix_dicts()\`
**Affected tests to run:**
- \`tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py\` (smoke)
- \`tests/infrastructure/instance_types/supported_os/test_rhel_os.py\` (smoke)
- \`tests/storage/cdi_upload/test_upload_virtctl.py\` (smoke + gating)
- \`tests/storage/cdi_import/test_import_http.py\` (gating)
- \`utilities/unittests/test_os_utils.py\`
- \`utilities/unittests/test_pytest_utils.py\`
**Real tests (cluster required)**
The refactored \`generate_os_matrix_dicts()\` and \`update_latest_os_config()\` run at session startup via \`conftest.py::pytest_sessionstart\` — verify end-to-end on a real cluster:
Error path (import chain after refactor — s390x arch-specific path):
\`\`\`
pytest tests/infrastructure/instance_types/supported_os/test_rhel_os.py --collect-only --tc-file=tests/global_config_s390x.py
\`\`\`
Expected: collection succeeds, \`py_config[\"instance_type_rhel_os_matrix\"]\` populated with s390x-specific preferences (no \`KeyError\` / \`ImportError\`)
Happy path (regression — x86_64, OS matrix values correct):
\`\`\`
pytest tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py --collect-only --tc-file=tests/global_config_x86_64.py
\`\`\`
Expected: parametrized test IDs match expected RHEL OS versions for x86_64"
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
/repos/RedHatQE/openshift-virtualization-tests/pulls/4870/reviews \
-f commit_id="$COMMIT_SHA" \
-f event="COMMENT" \
-f "comments[][path]=conftest.py" \
-F "comments[][line]=30" \
-f "comments[][side]=RIGHT" \
-f "comments[][body]=$BODY"Length of output: 4500 |
|
/reprocess |
|
/verified |
Test execution plan request detailsCRITICAL: You MUST post an inline review comment on the first changed line of the first file. As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan. Analysis Requirements:
Output rules: Your deliverable: Test Execution Plan
Use these formats:
Real test commands (MANDATORY when changes affect session/runtime code): When the affected code runs at session/collection time (conftest fixtures, pytest plugins,
Example output for a session-startup fix: Guidelines:
Hardware-Related Checks (SR-IOV, GPU, DPDK): When PR modifies fixtures for hardware-specific resources:
CRITICAL WORKFLOW COMPLETION RULES: When responding to this test execution plan request, you MUST follow these rules EXACTLY:
ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):
Remember: The pull request review is visible to users. Additional comments are redundant noise. CRITICAL — Verification rules for smoke and gating decisions: |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
gh pr view 4870 --repo RedHatQE/openshift-virtualization-tests --json headRefOid,files --jq '{sha: .headRefOid, files: [.files[].path]}'Length of output: 644 🏁 Script executed: #!/bin/bash
# Get first changed line in conftest.py
gh pr diff 4870 --repo RedHatQE/openshift-virtualization-tests -- conftest.py 2>/dev/null | head -60
COMMIT_SHA="a27819d3396a7ec947283d9a3a734fa2afa137f0"
BODY="**Test Execution Plan**
- **Run smoke tests: True**
- \`tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py\` (smoke) → \`py_config[\"rhel_os_matrix\"]\` → \`generate_os_matrix_dicts()\` in \`conftest.py::pytest_sessionstart\`
- \`tests/infrastructure/instance_types/supported_os/test_rhel_os.py\` (smoke) → \`py_config[\"instance_type_rhel_os_matrix\"]\` → \`generate_os_matrix_dicts()\` in \`conftest.py::pytest_sessionstart\`
- \`tests/storage/cdi_upload/test_upload_virtctl.py\` (smoke) → \`py_config[\"latest_rhel_os_dict\"]\` → \`update_latest_os_config()\` in \`conftest.py::pytest_sessionstart\`
- **Run gating tests: True**
- \`tests/storage/cdi_upload/test_upload_virtctl.py\` (gating) → \`py_config[\"latest_rhel_os_dict\"]\` → \`update_latest_os_config()\` → \`generate_os_matrix_dicts()\` (refactored into \`utilities/pytest_utils.py\`)
- \`tests/storage/cdi_import/test_import_http.py\` (gating) → \`py_config[\"latest_windows_os_dict\"]\` → \`update_latest_os_config()\` → \`generate_os_matrix_dicts()\`
**Affected tests to run:**
- \`tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py\` (smoke)
- \`tests/infrastructure/instance_types/supported_os/test_rhel_os.py\` (smoke)
- \`tests/storage/cdi_upload/test_upload_virtctl.py\` (smoke + gating)
- \`tests/storage/cdi_import/test_import_http.py\` (gating)
- \`utilities/unittests/test_os_utils.py\`
- \`utilities/unittests/test_pytest_utils.py\`
**Real tests (cluster required)**
The refactored \`generate_os_matrix_dicts()\` and \`update_latest_os_config()\` run at session startup via \`conftest.py::pytest_sessionstart\` — verify end-to-end on a real cluster:
Error path (import chain after refactor — s390x arch-specific path):
\`\`\`
pytest tests/infrastructure/instance_types/supported_os/test_rhel_os.py --collect-only --tc-file=tests/global_config_s390x.py
\`\`\`
Expected: collection succeeds, \`py_config[\"instance_type_rhel_os_matrix\"]\` populated with s390x-specific preferences (no \`KeyError\` / \`ImportError\`)
Happy path (regression — x86_64, OS matrix values correct):
\`\`\`
pytest tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py --collect-only --tc-file=tests/global_config_x86_64.py
\`\`\`
Expected: parametrized test IDs match expected RHEL OS versions for x86_64"
# Get the diff to find the exact first changed line
DIFF_OUTPUT=$(gh pr diff 4870 --repo RedHatQE/openshift-virtualization-tests -- conftest.py 2>/dev/null)
echo "$DIFF_OUTPUT" | grep -n "^@@" | head -5
# Extract the first new line number from the diff header
FIRST_LINE=$(echo "$DIFF_OUTPUT" | grep "^@@" | head -1 | grep -oP '\+\K[0-9]+')
echo "First changed line: $FIRST_LINE"
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
/repos/RedHatQE/openshift-virtualization-tests/pulls/4870/reviews \
-f commit_id="$COMMIT_SHA" \
-f event="COMMENT" \
-f "comments[][path]=conftest.py" \
-F "comments[][line]=${FIRST_LINE:-30}" \
-f "comments[][side]=RIGHT" \
-f "comments[][body]=$BODY"Length of output: 5153 |
|
/retest all Auto-triggered: Files in this PR were modified by merged PR #5332. Overlapping filesconftest.py |
|
@alexandermamaniy please add how was the PR verified |
|
/verified Collection of tests on s390x |
and also https://github.com/RedHatQE/openshift-virtualization-tests/pull/4870/files#r3457848925? |
|
/verified Test verification on s390x
_ 22 of 22 completed, 22 Pass, 0 Fail, 0 Skip, 0 XPass, 0 XFail, 0 Error, 0 ReRun _ |
Thank you, please note that as this change also affects other teams, please also run |
|
/approve cancel removing approval until #4870 (comment) is addressed to avoid merge by mistake |
|
/retest all Auto-triggered: Files in this PR were modified by merged PR #5169. Overlapping filesconftest.py |
Short description:
Backport of #3883 to cnv-4.21: refactor os matrix generator
More details:
move os matrix generators from global_config_*
files into a centralized location
What this PR does / why we need it:
This PR enables dynamic lookup via py_config["latest_instance_type_rhel_os_dict"], which is required to replace hardcoded RHEL10 preference and data source values in the rhel_vm_for_snapshot and rhel_vm_for_snapshot_with_content fixtures on s390x architecture.
This implementation is referenced in #4866, which requires architecture-aware RHEL preference support in snapshot fixtures when cherry-picked to cnv-4.21.
Which issue(s) this PR fixes:
Special notes for reviewer:
This backport centralizes OS matrix configuration to support architecture-specific preferences and data sources, preventing test failures on s390x where generic preferences enable incompatible firmware settings (SecureBoot/OVMF).
jira-ticket:
NONE
Signed-off-by: Alexander Mamani alexander.mamani@ibm.com