test(failover): add happy path test for DNS Failover#1020
Conversation
Signed-off-by: averevki <sandyverevkin@gmail.com>
📝 WalkthroughWalkthroughThe Docker image and test configuration now use the Kuadrant DNS CLI. A shared fixture exposes the binary to multicluster tests, and new failover fixtures and tests validate switching DNS records between two gateways. ChangesDNS failover validation
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
🧹 Nitpick comments (1)
testsuite/tests/multicluster/conftest.py (1)
31-39: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueValidate the
kubectl-dnsconfiguration item.As per coding guidelines, test fixtures should validate their required config sections before use. Consider validating the
kubectl-dnsconfiguration usingtestconfig.validators.validateto adhere to this project pattern.♻️ Proposed refactor
`@pytest.fixture`(scope="session") def kubectl_dns(testconfig, skip_or_fail): """Return kubectl-kuadrant_dns CLI wrapper""" + try: + testconfig.validators.validate(only=["kubectl-dns"]) + except (KeyError, ValidationError) as exc: + skip_or_fail(f"kubectl-dns configuration is missing or invalid: {exc}") binary_path = testconfig["kubectl-dns"] if not shutil.which(binary_path): skip_or_fail("kubectl-dns binary not found")🤖 Prompt for 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. In `@testsuite/tests/multicluster/conftest.py` around lines 31 - 39, Update the kubectl_dns fixture to validate the required kubectl-dns configuration through testconfig.validators.validate before reading testconfig["kubectl-dns"]. Preserve the existing binary lookup, skip_or_fail behavior, and KubectlDNS construction after validation.Source: Coding guidelines
🤖 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.
Nitpick comments:
In `@testsuite/tests/multicluster/conftest.py`:
- Around line 31-39: Update the kubectl_dns fixture to validate the required
kubectl-dns configuration through testconfig.validators.validate before reading
testconfig["kubectl-dns"]. Preserve the existing binary lookup, skip_or_fail
behavior, and KubectlDNS construction after validation.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8ecb7d4a-fa8a-46db-9829-3e449ee63cbf
📒 Files selected for processing (9)
Dockerfileconfig/settings.local.yaml.tplconfig/settings.yamltestsuite/gateway/gateway_api/hostname.pytestsuite/tests/multicluster/conftest.pytestsuite/tests/multicluster/coredns/two_clusters/kubectl_dns/test_secret_generation.pytestsuite/tests/multicluster/failover/__init__.pytestsuite/tests/multicluster/failover/conftest.pytestsuite/tests/multicluster/failover/test_dns_failover.py
💤 Files with no reviewable changes (1)
- testsuite/tests/multicluster/coredns/two_clusters/kubectl_dns/test_secret_generation.py
Summary
Add a basic happy path E2E test for DNS failover via active groups to verify regressions as the feature progresses toward Tech Preview. The test sets up two clusters with distinct DNS Operator groups, confirms the initial active group resolves correctly, switches the active group to trigger failover, and validates that DNS resolves to the correct cluster while the other reports inactive record conditions. Related to Kuadrant/dns-operator#783.
Changes
kubectl-kuadrant_dnsbinary to the container image (auto-fetches latest release)zone_domainproperty onDNSPolicyExposerfor direct access to the provider's base domainkubectl_dnsfixture from coredns tests to the shared multicluster conftestVerification
Configure 2 clusters in the testsuite settings file, and the correct name for
kubectl-kuadrant_dnsbinary on your system. Then execute the test with:make testsuite/tests/multicluster/failover/ flags="-vv"Summary by CodeRabbit
New Features
Bug Fixes
Tests