[test-only] add admin_client to unprivileged_secret return#4009
[test-only] add admin_client to unprivileged_secret return#4009rnetser wants to merge 4 commits intoRedHatQE:mainfrom
Conversation
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
|
/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:
Your deliverable: Test Execution Plan
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: Before setting "Run smoke tests: True", you MUST use shell scripts to: |
| def unprivileged_secret(admin_client, skip_unprivileged_client): | ||
| if skip_unprivileged_client: | ||
| yield | ||
| yield admin_client |
There was a problem hiding this comment.
Test Execution Plan
Run smoke tests: True
Rationale: The unprivileged_secret fixture is consumed by unprivileged_client, which is used by multiple smoke tests. Verified dependency chain:
- Smoke tests →
unprivileged_client→unprivileged_secret(modified)
Affected smoke tests:
tests/virt/node/general/test_container_disk_vm.py::test_container_disk_vmtests/storage/cdi_upload/test_upload_virtctl.py::test_virtctl_image_upload_dvtests/storage/cdi_clone/test_clone.py::test_clone_from_block_to_fs_using_dv_template
Additional tests to verify:
tests/storage/test_cdi_resources.py::test_uploader_pod_cdi_labeltests/storage/restricted_namespace_cloning/test_restricted_namespace_cloning_vms.py::test_create_vm_with_cloned_data_volume_grant_unprivileged_client_permissions_negativetests/storage/snapshots/test_snapshots.py::TestSnapshotRestore::test_fail_restore_vm_with_unprivileged_clienttests/storage/snapshots/test_snapshots.py::test_unprivileged_client_fails_to_list_resourcestests/virt/cluster/migration_and_maintenance/rbac_hardening/test_migration_rights.py- tests usingunprivileged_client
Change impact: When skip_unprivileged_client=True, the fixture now returns admin_client instead of None, potentially affecting conditional logic in downstream fixtures (exported_kubeconfig, unprivileged_client).
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 415 🏁 Script executed: Length of output: 975 🏁 Script executed: Length of output: 138 🏁 Script executed: Length of output: 0 🏁 Script executed: Length of output: 1062 🏁 Script executed: Length of output: 4544 🏁 Script executed: Length of output: 310 🏁 Script executed: Length of output: 686 🏁 Script executed: Length of output: 2626 🏁 Script executed: Length of output: 282 🏁 Script executed: Length of output: 0 🏁 Script executed: Length of output: 54 🏁 Script executed: Length of output: 274 🏁 Script executed: Length of output: 1735 🧠 Learnings used |
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:
Your deliverable: Test Execution Plan
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: Before setting "Run smoke tests: True", you MUST use shell scripts to: |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 5618 🏁 Script executed: Length of output: 1010 🏁 Script executed: Length of output: 1735 🧠 Learnings used |
|
/retest all Auto-triggered: Files in this PR were modified by merged PR #4003. Overlapping filestests/conftest.py |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/conftest.py (1)
319-334:⚠️ Potential issue | 🟠 MajorType inconsistency and fixture naming violation.
The fixture yields
admin_client(aDynamicClient) whenskip_unprivileged_client=True, but the nameunprivileged_secretimplies it returns aSecretobject. This violates the fixture naming convention that requires nouns describing what they provide.Additionally,
unprivileged_secretappears as an unused parameter in theunprivileged_clientfixture (line 405) and is never referenced in the function body—remove it per the no dead code guideline. If it's needed only for fixture ordering/setup, use indirect dependency via pytest's autouse pattern or implicit ordering instead.Consider renaming this fixture to reflect its actual behavior (e.g.,
unprivileged_secret_or_admin_client) or refactoring to always return aSecretobject and handle the skip case differently. Also review why this fixture returns a truthy value when skipping, unlikeidentity_provider_with_htpasswdwhich yields nothing in that case—pattern consistency matters for test readability.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/conftest.py` around lines 319 - 334, The fixture unprivileged_secret yields an admin_client (DynamicClient) when skip_unprivileged_client is true which violates the fixture name and causes a dead/unused dependency in unprivileged_client; fix by either (A) renaming the fixture to reflect its possible return types (e.g., unprivileged_secret_or_admin_client) and update any callers, or (B) make unprivileged_secret consistently return a Secret (use yield None or skip the yield when skip_unprivileged_client is true) and update code that relied on admin_client; also remove the unused parameter unprivileged_secret from the unprivileged_client fixture so there is no dead dependency, and align the skip behavior with identity_provider_with_htpasswd (i.e., yield nothing or None rather than a truthy admin_client) to keep patterns consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/virt/node/general/test_container_disk_vm.py`:
- Line 17: The placeholder error log call LOGGER.error("this is a test message")
in test_container_disk_vm should not emit an ERROR; either remove it or change
it to an informational trace (e.g., use LOGGER.info with a meaningful message
like "Starting test_container_disk_vm in namespace {namespace.name}") so logs
are not polluted and provide diagnostic value—locate the LOGGER.error call in
the test_container_disk_vm test and replace or remove accordingly.
---
Outside diff comments:
In `@tests/conftest.py`:
- Around line 319-334: The fixture unprivileged_secret yields an admin_client
(DynamicClient) when skip_unprivileged_client is true which violates the fixture
name and causes a dead/unused dependency in unprivileged_client; fix by either
(A) renaming the fixture to reflect its possible return types (e.g.,
unprivileged_secret_or_admin_client) and update any callers, or (B) make
unprivileged_secret consistently return a Secret (use yield None or skip the
yield when skip_unprivileged_client is true) and update code that relied on
admin_client; also remove the unused parameter unprivileged_secret from the
unprivileged_client fixture so there is no dead dependency, and align the skip
behavior with identity_provider_with_htpasswd (i.e., yield nothing or None
rather than a truthy admin_client) to keep patterns consistent.
|
/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:
Your deliverable: Test Execution Plan
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: Before setting "Run smoke tests: True", you MUST use shell scripts to: |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 1292 🏁 Script executed: Length of output: 1777 🏁 Script executed: Length of output: 2355 🏁 Script executed: Length of output: 1735 🧠 Learnings used |
Short description:
More details:
What this PR does / why we need it:
Which issue(s) this PR fixes:
Special notes for reviewer:
jira-ticket:
Summary by CodeRabbit