Convert SCC annotation tests to dynamic subtests - #5968
Conversation
|
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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
📝 WalkthroughWalkthroughChangesCNV SCC validation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error)
✅ Passed checks (5 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@tests/install_upgrade_operators/security/scc/test_cnv_deployment_required_scc.py`:
- Around line 18-19: Add an assertion in test_deployment_required_scc before
iterating over discovered_cnv_deployments to require at least one discovered
deployment. Preserve the existing per-deployment subtest loop while ensuring an
empty discovery result fails the test.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 6be017c4-5627-43e2-ae72-4713b3632433
📒 Files selected for processing (2)
tests/install_upgrade_operators/conftest.pytests/install_upgrade_operators/security/scc/test_cnv_deployment_required_scc.py
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
RedHatQE/openshift-virtualization-tests-design-docs(manual)
2ed3c57 to
3e81247
Compare
|
/build-and-push-container |
|
New container for quay.io/openshift-cnv/openshift-virtualization-tests:pr-5968 published |
|
/build-and-push-container |
1 similar comment
|
/build-and-push-container |
|
New container for quay.io/openshift-cnv/openshift-virtualization-tests:pr-5968 published |
1 similar comment
|
New container for quay.io/openshift-cnv/openshift-virtualization-tests:pr-5968 published |
|
/verified All tests passed for PR #5968. Execution details |
|
/verified All tests passed for PR #5968. 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 '=== PR metadata and changed files ==='
gh pr view 5968 --json baseRefName,headRefName,files --jq '.baseRefName, .headRefName, (.files[] | "\(.path) +\(.additions) -\(.deletions)")'
echo '=== Diff with zero context ==='
gh pr diff 5968 --unified=0 -- \
tests/install_upgrade_operators/conftest.py \
tests/install_upgrade_operators/security/scc/test_cnv_deployment_required_scc.py
echo '=== Outline: changed files ==='
ast-grep outline tests/install_upgrade_operators/conftest.py --items all
ast-grep outline tests/install_upgrade_operators/security/scc/test_cnv_deployment_required_scc.py --items all
echo '=== Fixture and test consumers ==='
rg -n -C 4 '\bdiscovered_cnv_deployments\b|\bget_deployments\b|\btest_deployment_required_scc\b' tests
echo '=== SCC test markers and fixture context ==='
rg -n -C 5 '`@pytest`\.mark|def test_|def [A-Za-z_][A-Za-z0-9_]*\(' \
tests/install_upgrade_operators/security/scc/test_cnv_deployment_required_scc.py
echo '=== Smoke-marked test files ==='
rg -l '`@pytest`\.mark\.smoke' tests || true
echo '=== Gating-marked test files ==='
rg -l '`@pytest`\.mark\.gating' tests || true
echo '=== Parent conftest files and references ==='
for f in \
tests/conftest.py \
tests/install_upgrade_operators/conftest.py \
tests/install_upgrade_operators/security/conftest.py \
tests/install_upgrade_operators/security/scc/conftest.py
do
if [ -f "$f" ]; then
echo "--- $f ---"
rg -n -C 3 '\bdiscovered_cnv_deployments\b|\bget_deployments\b|`@pytest`\.fixture|yield' "$f" || true
fi
doneLength of output: 2728 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '=== PR head SHA and changed-file patches ==='
gh pr view 5968 --json headRefOid --jq '.headRefOid'
gh api --paginate 'repos/RedHatQE/openshift-virtualization-tests/pulls/5968/files?per_page=100' \
--jq '.[] | "=== \(.filename) ===\n\(.patch // "(patch unavailable)")"'
echo '=== Outline: changed files ==='
ast-grep outline tests/install_upgrade_operators/conftest.py --items all
ast-grep outline tests/install_upgrade_operators/security/scc/test_cnv_deployment_required_scc.py --items all
echo '=== Fixture and test consumers ==='
rg -n -C 5 '\bdiscovered_cnv_deployments\b|\bget_deployments\b|\btest_deployment_required_scc\b' tests
echo '=== SCC test markers and fixture context ==='
rg -n -C 5 '`@pytest`\.mark|def test_|def [A-Za-z_][A-Za-z0-9_]*\(' \
tests/install_upgrade_operators/security/scc/test_cnv_deployment_required_scc.py
echo '=== Smoke-marked test files ==='
rg -l '`@pytest`\.mark\.smoke' tests || true
echo '=== Gating-marked test files ==='
rg -l '`@pytest`\.mark\.gating' tests || true
echo '=== Parent conftest files and fixture dependencies ==='
for f in \
tests/conftest.py \
tests/install_upgrade_operators/conftest.py \
tests/install_upgrade_operators/security/conftest.py \
tests/install_upgrade_operators/security/scc/conftest.py
do
if [ -f "$f" ]; then
echo "--- $f ---"
rg -n -C 4 '\bdiscovered_cnv_deployments\b|\bget_deployments\b|\bhco_namespace\b|\badmin_client\b|`@pytest`\.fixture|yield' "$f" || true
fi
doneLength of output: 99561 🏁 Script executed: #!/bin/bash
set -euo pipefail
repo="RedHatQE/openshift-virtualization-tests"
pr="5968"
head_sha="3e81247c2eed90396bf1f8a56216f3fefb135a00"
path="tests/install_upgrade_operators/conftest.py"
line="40"
body=$(cat <<'EOF'
## Test Execution Plan
- **Run smoke tests: False**. `discovered_cnv_deployments` has one consumer: `tests/install_upgrade_operators/security/scc/test_cnv_deployment_required_scc.py::test_deployment_required_scc`. The fixture is not autouse. No smoke-marked test consumes it.
- **Run gating tests: False**. No gating-marked test consumes `discovered_cnv_deployments`.
**Affected tests to run**
- `tests/install_upgrade_operators/security/scc/test_cnv_deployment_required_scc.py::test_deployment_required_scc` (`s390x`, `skip_must_gather_collection`, Polarion `CNV-11964`)
**Real tests (cluster required)**
Error path: On an s390x cluster with a discovered non-HPP CNV deployment that has a missing or incorrect `openshift.io/required-scc` annotation, run:
`pytest tests/install_upgrade_operators/security/scc/test_cnv_deployment_required_scc.py -s -o log_cli=true -m tier2 --jira`
Expected: pytest reports a failed subtest with the deployment name and the missing or incorrect annotation value. If CNV-94717 is open, `virt-template-apiserver` and `virt-template-controller` report expected failures instead.
Happy path: On an s390x cluster where all non-exempt discovered CNV deployments have `openshift.io/required-scc=restricted-v2`, run:
`pytest tests/install_upgrade_operators/security/scc/test_cnv_deployment_required_scc.py -s -o log_cli=true -m tier2 --jira`
Expected: the test passes. The test verifies every deployment returned from the HCO namespace, and excludes HPP deployments.
EOF
)
payload=$(jq -n \
--arg body "$body" \
--arg commit_id "$head_sha" \
--arg path "$path" \
--argjson line "$line" \
'{body: $body, commit_id: $commit_id, path: $path, line: $line, side: "RIGHT"}')
for attempt in 1 2; do
if gh api --method POST "repos/$repo/pulls/$pr/comments" --input - <<<"$payload" >/dev/null; then
exit 0
fi
if [ "$attempt" -eq 2 ]; then
exit 1
fi
sleep 2
doneLength of output: 2323
You are interacting with an AI system. |
Combine test_deployments_missing_required_scc_annotation and test_deployments_with_incorrect_required_scc into a single test using subtests over discovered_cnv_deployments. Remove the required_scc_deployment_check fixture. Xfail virt-template deployments while CNV-94717 is open. assisted by: claude code claude-opus-4-6 Signed-off-by: Ohad <orevah@redhat.com>
3e81247 to
866985c
Compare
|
/build-and-push-container |
|
New container for quay.io/openshift-cnv/openshift-virtualization-tests:pr-5968 published |
|
/verified All tests passed for PR #5968. 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.
You are interacting with an AI system. |
|
/retest all Auto-triggered: Files in this PR were modified by merged PR #5975. Overlapping filestests/install_upgrade_operators/conftest.py |
| def discovered_cnv_deployments(admin_client, hco_namespace): | ||
| """Discover all CNV deployments from the cluster.""" | ||
| return list( | ||
| Deployment.get( | ||
| client=admin_client, | ||
| namespace=hco_namespace.name, | ||
| label_selector="app.kubernetes.io/part-of=hyperconverged-cluster", | ||
| ) | ||
| ) |
There was a problem hiding this comment.
can you apply it for all other other tests using ALL_CNV_DEPLOYMENT or the deployment matrix? its a good opportunity
What this PR does / why we need it:
Combine test_deployments_missing_required_scc_annotation and test_deployments_with_incorrect_required_scc into a single test using subtests over discovered_cnv_deployments. Remove the required_scc_deployment_check fixture.
Xfail virt-template deployments while CNV-94717 is open.
This is part of the effort for stabilizing the 5.0 DS and rhcos lanes.
assisted by: claude code claude-opus-4-6
Which issue(s) this PR fixes:
Special notes for reviewer:
jira-ticket:
Summary by CodeRabbit