[4.20][Storage] Manual Cherry-Pick: Add Velero backup hooks opt-out tests - #5963
[4.20][Storage] Manual Cherry-Pick: Add Velero backup hooks opt-out tests#5963ema-aka-young wants to merge 2 commits into
Conversation
…RHEL10 Signed-off-by: Emanuele Prella <eprella@redhat.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. |
Signed-off-by: Emanuele Prella <eprella@redhat.com>
|
/build-and-push-container |
|
New container for quay.io/openshift-cnv/openshift-virtualization-tests:pr-5963 published |
|
/verified All tests passed for PR #5963. 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
echo '=== Changed files and first changed line ==='
gh api 'repos/RedHatQE/openshift-virtualization-tests/pulls/5963/files?per_page=100' \
--paginate \
--jq '.[] | [.filename, .status, .patch] | `@base64`' |
while IFS= read -r row; do
decoded=$(printf '%s' "$row" | base64 -d)
file=$(printf '%s' "$decoded" | jq -r '.[0]')
status=$(printf '%s' "$decoded" | jq -r '.[1]')
patch=$(printf '%s' "$decoded" | jq -r '.[2] // ""')
first_line=$(printf '%s\n' "$patch" | sed -nE 's/^@@ -[0-9]+(,[0-9]+)? \+([0-9]+).*/\2/p' | head -1)
printf '%s\t%s\t%s\n' "$file" "$status" "${first_line:-NO_PATCH}"
done
echo '=== Diff stat ==='
git diff --stat HEAD^ HEAD
echo '=== Changed Python symbol lines in utilities/libs ==='
git diff HEAD^ HEAD --unified=0 -- utilities libs 2>/dev/null | grep -E '^[+-][[:space:]]*(async[[:space:]]+def|def|class)[[:space:]]' || true
echo '=== Repository Python outline for changed candidates ==='
git diff --name-only HEAD^ HEAD | while IFS= read -r file; do
case "$file" in
*.py)
echo "--- $file"
ast-grep outline "$file" --items all --type class,function || true
;;
esac
done
echo '=== Smoke-marked test files ==='
rg -l '`@pytest`\.mark\.smoke' tests/ || true
echo '=== Gating-marked test files ==='
rg -l '`@pytest`\.mark\.gating' tests/ || trueLength of output: 7990 🏁 Script executed: #!/bin/bash
set -euo pipefail
repo='RedHatQE/openshift-virtualization-tests'
pr=5963
base_sha=$(gh api "repos/$repo/pulls/$pr" --jq '.base.sha')
head_sha=$(gh api "repos/$repo/pulls/$pr" --jq '.head.sha')
printf 'base=%s\nhead=%s\n' "$base_sha" "$head_sha"
echo '=== Complete PR diff ==='
gh pr diff "$pr" --repo "$repo" --patch
echo '=== Changed-file patches ==='
for file in \
tests/conftest.py \
tests/data_protection/oadp/conftest.py \
tests/data_protection/oadp/test_velero_backup_hooks.py \
tests/data_protection/oadp/utils.py \
tests/storage/conftest.py \
utilities/constants.py
do
echo "--- $file"
gh api "repos/$repo/pulls/$pr/files?per_page=100" --paginate \
--jq ".[] | select(.filename == \"$file\") | .patch"
done
echo '=== Source outlines ==='
for file in \
tests/conftest.py \
tests/data_protection/oadp/conftest.py \
tests/data_protection/oadp/test_velero_backup_hooks.py \
tests/data_protection/oadp/utils.py \
tests/storage/conftest.py \
utilities/constants.py
do
echo "--- $file"
ast-grep outline "$file" --items all --type class,function || true
done
echo '=== Exact references to changed or likely affected fixture/helper names ==='
rg -n -C 3 \
'rhel10_data_source_scope_session|rhel10_data_source_scope_module|velero|backup_hook|BackupHook|oadp' \
tests/data_protection tests/storage tests/conftest.py 2>/dev/null || true
echo '=== Imports and references to OADP utils ==='
rg -n -C 2 \
'tests\.data_protection\.oadp\.utils|data_protection\.oadp\.utils|from .*oadp.* import|import .*oadp' \
tests/ || true
echo '=== Fixture wrappers and cleanup paths in OADP conftest ==='
rg -n -U -C 4 \
'`@pytest`\.fixture|`@contextmanager`|yield from|yield|def [a-zA-Z_][a-zA-Z0-9_]*\(' \
tests/data_protection/oadp/conftest.py tests/conftest.py tests/storage/conftest.py || trueLength of output: 228873 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '=== Direct consumers of the moved global fixture ==='
rg -n -C 2 '\brhel10_data_source_scope_session\b' tests/ -g '*.py'
echo '=== Consumers of fixture wrappers that depend on the moved global fixture ==='
rg -n -C 2 '\brhel_vm_for_snapshot\b|\brunning_vm_for_snapshot_upgrade_[ab]\b' tests/ -g '*.py'
echo '=== Markers on candidate affected test files ==='
for file in \
tests/data_protection/oadp/test_velero_backup_hooks.py \
tests/storage/snapshots/test_snapshots.py \
tests/storage/upgrade/test_snapshot_upgrade.py
do
if [ -f "$file" ]; then
echo "--- $file"
rg -n -C 1 '`@pytest`\.mark\.(smoke|gating)|def test_|class Test' "$file" || true
fi
done
echo '=== Locate all storage upgrade test modules ==='
fd -t f -e py . tests/storage/upgrade | sortLength of output: 20097 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '=== Storage upgrade fixture definitions ==='
sed -n '1,110p' tests/storage/upgrade/conftest.py
echo '=== Storage upgrade test fixture consumers ==='
rg -n -C 3 \
'def test_|class Test|snapshot_upgrade|rhel10_data_source_scope_session' \
tests/storage/upgrade/test_upgrade_storage.pyLength of output: 5672 🏁 Script executed: #!/bin/bash
set -euo pipefail
repo='RedHatQE/openshift-virtualization-tests'
pr=5963
head_sha=$(gh api "repos/$repo/pulls/$pr" --jq '.head.sha')
body=$(cat <<'EOF'
**Test Execution Plan**
**Run smoke tests: False.** No smoke-marked test has a verified dependency path to the new OADP fixtures, `assert_velero_backup_hooks_not_injected`, or `rhel10_data_source_scope_session`.
**Run gating tests: False.** No gating-marked test has a verified dependency path to the changed fixtures or helper.
**Affected tests to run**
- `tests/data_protection/oadp/test_velero_backup_hooks.py::TestVeleroBackupHookOptOut::test_backup_paused_vm_hooks_disabled`
- `tests/data_protection/oadp/test_velero_backup_hooks.py::TestVeleroBackupHookOptOut::test_backup_running_vm_hooks_disabled`
- `tests/storage/snapshots/test_snapshots.py::TestRestoreSnapshots::test_restore_snapshots`
- `tests/storage/snapshots/test_snapshots.py::TestRestoreSnapshots::test_restore_snapshot_while_vm_is_running`
- `tests/storage/snapshots/test_snapshots.py::TestRestoreSnapshots::test_fail_restore_vm_with_unprivileged_client`
- `tests/storage/snapshots/test_snapshots.py::TestRestoreSnapshots::test_restore_same_snapshot_twice`
- `tests/storage/snapshots/test_snapshots.py::test_remove_vm_with_snapshots`
- `tests/storage/snapshots/test_snapshots.py::test_remove_snapshots_while_vm_is_running`
- `tests/storage/snapshots/test_snapshots.py::test_fail_to_snapshot_with_unprivileged_client_no_permissions`
- `tests/storage/snapshots/test_snapshots.py::test_fail_to_snapshot_with_unprivileged_client_dv_permissions`
- `tests/storage/upgrade/test_upgrade_storage.py::TestUpgradeStorage::test_vm_snapshot_restore_before_upgrade`
- `tests/storage/upgrade/test_upgrade_storage.py::TestUpgradeStorage::test_vm_snapshot_created_before_upgrade`
- `tests/storage/upgrade/test_upgrade_storage.py::TestUpgradeStorage::test_vm_snapshot_restore_check_after_upgrade`
- `tests/storage/upgrade/test_upgrade_storage.py::TestUpgradeStorage::test_vm_snapshot_restore_create_after_upgrade`
**Real tests (cluster required)**
Error path (collection fix):
`pytest tests/data_protection/oadp/test_velero_backup_hooks.py --collect-only`
Expected: collection completes without a `NameError` from `TYPE_CHECKING` annotations.
Happy path:
`pytest tests/data_protection/oadp/test_velero_backup_hooks.py`
Expected: both Velero backups complete and the virt-launcher pod has no Velero hook annotations.
EOF
)
gh api --method POST "repos/$repo/pulls/$pr/comments" \
-f body="$body" \
-f commit_id="$head_sha" \
-f path='tests/conftest.py' \
-F line=105 \
-f side='RIGHT' \
--silentLength of output: 2770
You are interacting with an AI system. |
|
/lgtm |
|
/approve |
What this PR does / why we need it:
This is a manual cherry-pick of #5478.
Which issue(s) this PR fixes:
Special notes for reviewer:
from __future__ import annotationsin OADP utils to fix the tox collection NameError on TYPE_CHECKING hints that blocked #5961.rhel10_data_source_scope_sessionis added to global tests/conftest.py so OADP can resolve it (it previously lived only under tests/storage/).jira-ticket:
https://redhat.atlassian.net/browse/CNV-85597