Manual cherry-pick: #4571 [cnv-4.21] Windows Session Scoped Data Source + CDI Clone and Hotplug implementation - #5664
Conversation
…implementation of it (RedHatQE#4571) Using `validation-os-images` namespace, we import the Windows image only once and it can be used by other modules because it's session scoped. This PR also makes changes in Hotplug and CDI Clone modules to take advantage of this new approach. Other modules will follow. This creates session scoped Data Source fixture that imports the image only once if needed or uses a golden image already on a cluster. It also makes CDI Clone and Hotplug modules utilising to fixture as a proof of concept. Co-Authored: Claude Code https://redhat.atlassian.net/browse/CNV-51351 <!-- full-ticket-url needs to be provided. This would add a link to the pull request to the jira and close it when the pull request is merged If the task is not tracked by a Jira ticket, just write "NONE". --> --------- Signed-off-by: Adam Cinko <acinko@redhat.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Signed-off-by: Adam Cinko <acinko@redhat.com>
Signed-off-by: Adam Cinko <acinko@redhat.com>
|
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 Plus 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
Branch Management
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
AI Features
Security Checks
💡 Tips
📌 Additional InformationCustom Commands:
For more information, please refer to the project documentation or contact the maintainers. |
|
D/S test |
9f5189f
|
/build-and-push-container |
|
New container for quay.io/openshift-cnv/openshift-virtualization-tests:pr-5664 published |
|
/verified All tests passed for PR #5664. Execution details |
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
set -euo pipefail
repo="RedHatQE/openshift-virtualization-tests"
pr="5664"
base_sha=$(gh pr view "$pr" --repo "$repo" --json baseRefOid --jq .baseRefOid)
head_sha=$(gh pr view "$pr" --repo "$repo" --json headRefOid --jq .headRefOid)
printf '=== changed files, diff order ===\n'
git diff --name-status "$base_sha" "$head_sha"
printf '\n=== changed definitions in utilities/libs ===\n'
git diff --unified=0 "$base_sha" "$head_sha" -- utilities libs \
| rg -n '^[+-][[:space:]]*(async[[:space:]]+)?def[[:space:]]|^[+-][[:space:]]*class[[:space:]]|^[+-][[:space:]]*[A-Z][A-Z0-9_]+[[:space:]]*=' || true
printf '\n=== changed hunk headers ===\n'
git diff --unified=0 "$base_sha" "$head_sha" \
| rg -n '^(diff --git|@@|[+-][[:space:]]*(async[[:space:]]+)?def[[:space:]]|[+-][[:space:]]*class[[:space:]]|[+-][[:space:]]*`@pytest`\.fixture)' || true
printf '\n=== first changed file hunk ===\n'
first_file=$(git diff --name-only "$base_sha" "$head_sha" | head -n1)
printf '%s\n' "$first_file"
git diff --unified=5 "$base_sha" "$head_sha" -- "$first_file" | sed -n '1,180p'
printf '\n=== symbols and fixture uses ===\n'
rg -n -C3 'windows_validation_os_images|cloned_windows_dv_multi_storage|hotplug_volume_windows|vm_instance_multi_storage|construct_datavolume_source_dict|DATA_SOURCE|VALIDATION.*IMAGE|win2k22' \
conftest.py tests utilities || true
printf '\n=== fixture setup and cleanup paths ===\n'
rg -n -C5 '`@pytest`\.fixture|`@contextmanager`|yield from|^[[:space:]]*yield[[:space:]]*$|windows_validation_os_images|cloned_windows_dv_multi_storage|hotplug_volume_windows|vm_instance_multi_storage' \
tests/fixtures/images/validation_os_images.py tests/storage/conftest.py tests/storage/cdi_clone/conftest.py tests/storage/cdi_clone/test_clone.py tests/storage/test_hotplug.py conftest.py 2>/dev/null || true
printf '\n=== smoke test files ===\n'
rg -l '`@pytest`\.mark\.smoke' tests/ | sort || true
printf '\n=== gating test files ===\n'
rg -l '`@pytest`\.mark\.gating' tests/ | sort || trueLength of output: 108682 🏁 Script executed: #!/bin/bash
set -euo pipefail
repo="RedHatQE/openshift-virtualization-tests"
pr="5664"
base_sha=$(gh pr view "$pr" --repo "$repo" --json baseRefOid --jq .baseRefOid)
head_sha=$(gh pr view "$pr" --repo "$repo" --json headRefOid --jq .headRefOid)
printf '=== current PR diff ===\n'
git diff --find-renames --unified=8 "$base_sha" "$head_sha" -- \
tests/storage/cdi_clone/conftest.py \
tests/storage/cdi_clone/test_clone.py \
tests/storage/conftest.py \
tests/storage/test_hotplug.py \
tests/utils.py \
utilities/constants.py \
utilities/storage.py
printf '\n=== marker scope around affected classes and all storage smoke/gating markers ===\n'
rg -n -C8 '`@pytest`\.mark\.(smoke|gating|tier3)|class TestWindowsClonedDv|class TestHotPlugWindows|def test_(clone_dv_windows|vm_from_cloned_dv_windows|windows_hotplug|windows_hotplug_migrate)' \
tests/storage/cdi_clone/test_clone.py tests/storage/test_hotplug.py
printf '\n=== direct and same-file calls to the changed utility function ===\n'
rg -n -C4 '\bconstruct_datavolume_source_dict\s*\(' tests conftest.py utilities
printf '\n=== fixture wrappers and callers of new/renamed Windows VM helpers ===\n'
rg -n -C4 '\b(create_windows2022_vm_using_existing_dv|create_windows2022_vm_with_data_volume_template)\s*\(' tests conftest.py utilities
printf '\n=== hierarchy conftest references for smoke and gating storage files ===\n'
for f in tests/storage/cdi_clone/test_clone.py tests/storage/test_hotplug.py; do
echo "--- $f"
for c in conftest.py tests/conftest.py tests/storage/conftest.py tests/storage/cdi_clone/conftest.py; do
if [ -f "$c" ]; then
printf '%s: ' "$c"
rg -n 'construct_datavolume_source_dict|windows_validation_os_images|cloned_windows_dv_multi_storage|vm_instance_multi_storage|autouse' "$c" || true
fi
done
doneLength of output: 54402 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '=== conformance option and fixture ===\n'
rg -n -C5 '\bconformance_tests\b|addoption\(|--conformance\b' conftest.py tests
printf '\n=== first changed right-side line ===\n'
repo="RedHatQE/openshift-virtualization-tests"
pr="5664"
base_sha=$(gh pr view "$pr" --repo "$repo" --json baseRefOid --jq .baseRefOid)
head_sha=$(gh pr view "$pr" --repo "$repo" --json headRefOid --jq .headRefOid)
git diff --unified=0 "$base_sha" "$head_sha" -- tests/storage/cdi_clone/conftest.py | sed -n '1,35p'Length of output: 21005 🏁 Script executed: #!/bin/bash
set -euo pipefail
repo="RedHatQE/openshift-virtualization-tests"
pr="5664"
head_sha=$(gh pr view "$pr" --repo "$repo" --json headRefOid --jq .headRefOid)
body=$(cat <<'EOF'
**Test Execution Plan**
- **Run smoke tests: False.** The only smoke test in `tests/storage/cdi_clone/test_clone.py` uses the Fedora block-volume fixture. It does not request `cloned_windows_dv_multi_storage_scope_class`. The new session fixture is not autouse.
- **Run gating tests: False.** The gated CDI Clone test uses the Fedora DataSource fixture. The gated Hotplug classes use `fedora_vm_for_hotplug_scope_class`. Neither fixture chain reaches the Windows session fixture or `construct_datavolume_source_dict`.
**Affected tests to run**
- `tests/storage/cdi_clone/test_clone.py::TestWindowsClonedDv::test_clone_dv_windows` (tier3)
- `tests/storage/cdi_clone/test_clone.py::TestWindowsClonedDv::test_vm_from_cloned_dv_windows` (tier3)
- `tests/storage/test_hotplug.py::TestHotPlugWindows::test_windows_hotplug` (tier3)
- `tests/storage/test_hotplug.py::TestHotPlugWindows::test_windows_hotplug_migrate` (tier3)
Dependency paths:
- `TestWindowsClonedDv` → `cloned_windows_dv_multi_storage_scope_class` → `windows_validation_os_images_data_source_scope_session` → `windows_validation_os_images_data_volume_scope_session` → `construct_datavolume_source_dict`.
- `TestHotPlugWindows` → `hotplug_volume_windows_scope_class` → `vm_instance_multi_storage_scope_class` → `windows_validation_os_images_data_source_scope_session` → `windows_validation_os_images_data_volume_scope_session` → `construct_datavolume_source_dict`.
**Real tests (cluster required)**
Error path: With no `win2k22` DataVolume in `validation-os-images`, run:
`pytest tests/storage/cdi_clone/test_clone.py::TestWindowsClonedDv::test_clone_dv_windows -m "tier3 or conformance"`
Expected: fixture setup fails with the explicit pre-created-image assertion. It must not import the image.
Happy path: With a valid default storage class and no `win2k22` DataVolume, run:
`pytest tests/storage/cdi_clone/test_clone.py::TestWindowsClonedDv::test_clone_dv_windows tests/storage/cdi_clone/test_clone.py::TestWindowsClonedDv::test_vm_from_cloned_dv_windows tests/storage/test_hotplug.py::TestHotPlugWindows`
Expected: the session fixture imports the image once, creates the DataSource, and both clone and hotplug workflows complete. Repeat with an existing succeeded `win2k22` DataVolume to verify reuse.
EOF
)
gh api \
--method POST \
"repos/${repo}/pulls/${pr}/comments" \
-f body="$body" \
-f commit_id="$head_sha" \
-f path="tests/storage/cdi_clone/conftest.py" \
-F line=5 \
-f side="RIGHT" >/dev/nullLength of output: 2818
You are interacting with an AI system. |
|
/lgtm |
What this PR does / why we need it:
Manual cherry-pick: #4571
Using validation-os-images namespace, we import the Windows image only once and it can be used by other modules because it's session scoped.
This PR also makes changes in Hotplug and CDI Clone modules to take advantage of this new approach. Other modules will follow.
This creates session scoped Data Source fixture that imports the image only once if needed or uses a golden image already on a cluster.
It also makes CDI Clone and Hotplug modules utilising to fixture as a proof of concept.
Which issue(s) this PR fixes:
Special notes for reviewer:
https://redhat.atlassian.net/browse/CNV-51351
Co-Authored: Claude Code