test: kubectl-dns secret-generation command#841
Conversation
6309fbe to
aa44ba2
Compare
|
/make smoke |
|
Test run completed ( Short Test SummaryFull Output |
|
/make smoke |
|
Test run completed ( Short Test SummaryFull Output |
Signed-off-by: averevki <sandyverevkin@gmail.com>
📝 WalkthroughWalkthroughThe changes introduce a Changes
Sequence Diagram(s)sequenceDiagram
participant TS as Test Suite
participant KD as KubectlDNS<br/>(CLI Wrapper)
participant KC as Kubernetes<br/>Clusters
participant DNS as DNS Resolution
TS->>TS: Check kubectl-dns binary exists
TS->>KC: Get primary cluster context
TS->>KC: Get secondary cluster context
TS->>KC: Create merged kubeconfig
TS->>KD: Execute secret-generation command<br/>with merged config
KD->>KC: Apply secret to secondary cluster
KC-->>KD: Return exit code 0
KD-->>TS: Command completed successfully
TS->>DNS: Resolve configured hostname
DNS-->>TS: Return A records (IP set)
TS->>TS: Assert IPs match expected values
TS->>KC: Delete generated secret<br/>(cleanup)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@testsuite/kubernetes/client.py`:
- Around line 170-176: Before extending config1 with config2 entries, detect
name collisions among the "clusters", "contexts", and "users" entries by
comparing their metadata.name values (operate on config1 and config2 variables
and merged_config). If any duplicate names are found, either raise an exception
to fail fast or consistently rewrite config2's names (e.g., append a suffix) and
update all references inside config2's "contexts" (context.cluster and
context.user) and the "current-context" value accordingly, then perform the
merge using merged_config["clusters"].extend(...),
merged_config["contexts"].extend(...), merged_config["users"].extend(...).
Ensure the final merged_config has unique names across clusters/contexts/users
to avoid ambiguous lookups.
In
`@testsuite/tests/multicluster/coredns/two_clusters/kubectl_dns/test_secret_generation.py`:
- Line 11: Update the module-level pytest markers in the test file by adding the
multicluster and coredns_one_primary markers to the existing pytestmark list
(currently only contains pytest.mark.cli); locate the pytestmark definition and
change it to include pytest.mark.multicluster and
pytest.mark.coredns_one_primary alongside pytest.mark.cli so the test is
discovered when running suites filtered by those markers.
- Around line 23-24: The kubeconfig_secrets fixture is defined but never
executed; update its declaration so it runs automatically (e.g., change the
pytest.fixture(...) for kubeconfig_secrets to include autouse=True) or ensure
the tests explicitly request it, and if you make it autouse, register any
teardown with request.addfinalizer inside the kubeconfig_secrets function to
perform proper cleanup after kubectl_dns secret-generation runs; refer to the
kubeconfig_secrets fixture and the kubectl_dns secret-generation side effects
when making the change.
🪄 Autofix (Beta)
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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b5fcb163-1c91-4e5a-94ac-2fbfd7d0ff9f
📒 Files selected for processing (10)
config/settings.local.yaml.tplconfig/settings.yamlpyproject.tomltestsuite/cli/__init__.pytestsuite/cli/kuadrantctl.pytestsuite/cli/kubectl_dns.pytestsuite/kubernetes/client.pytestsuite/tests/kuadrantctl/conftest.pytestsuite/tests/multicluster/coredns/two_clusters/kubectl_dns/__init__.pytestsuite/tests/multicluster/coredns/two_clusters/kubectl_dns/test_secret_generation.py
Description
kubectl-dnsCLI tool integration to the test suitekubectl-dns secret-generationcommandkuadrantctlinto a dedicatedtestsuite/cli/moduleVerification steps
Run the new test:
Note: This test requires:
certificate-authoritykey with the cluster CA. You can set it for a kubeconfig by logging in with explicitly specified path to the cluster CA, aka.oc login --username=${} --password=${} <clusterapiurl> --certificate-authority=path/to/caSummary by CodeRabbit
Release Notes
New Features
Tests
Chores