Skip to content

test(failover): add happy path test for DNS Failover#1020

Open
averevki wants to merge 1 commit into
Kuadrant:mainfrom
averevki:dns-failover-tests
Open

test(failover): add happy path test for DNS Failover#1020
averevki wants to merge 1 commit into
Kuadrant:mainfrom
averevki:dns-failover-tests

Conversation

@averevki

@averevki averevki commented Jul 15, 2026

Copy link
Copy Markdown
Member

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

  • Add E2E multi-cluster test for DNS failover switching the DNS Operator active group from one to another
  • Add kubectl-kuadrant_dns binary to the container image (auto-fetches latest release)
  • Extract zone_domain property on DNSPolicyExposer for direct access to the provider's base domain
  • Move kubectl_dns fixture from coredns tests to the shared multicluster conftest

Verification

Configure 2 clusters in the testsuite settings file, and the correct name for kubectl-kuadrant_dns binary on your system. Then execute the test with:

make testsuite/tests/multicluster/failover/ flags="-vv"

Summary by CodeRabbit

  • New Features

    • Added the Kuadrant DNS command-line tool to the container environment.
    • Updated the default configuration to use the Kuadrant DNS command-line tool.
    • Added support for testing DNS failover between clusters, including active-group switching and traffic validation.
  • Bug Fixes

    • Improved DNS domain handling for provider configurations.
  • Tests

    • Centralised command-line tool discovery and validation for multicluster tests.

Signed-off-by: averevki <sandyverevkin@gmail.com>
@averevki averevki self-assigned this Jul 15, 2026
@averevki averevki added the test-case New test case label Jul 15, 2026
@averevki averevki added the DNS Operator Changes related to DNS Operator and resources it manages label Jul 15, 2026
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The 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.

Changes

DNS failover validation

Layer / File(s) Summary
Kuadrant DNS CLI plumbing
Dockerfile, config/settings*.yaml*, testsuite/tests/multicluster/...
The image installs kubectl-kuadrant_dns, configuration references it, and multicluster tests use a shared validated CLI fixture.
Failover environment setup
testsuite/gateway/gateway_api/hostname.py, testsuite/tests/multicluster/failover/conftest.py
Hostname domain handling is split into zone and generated base domains; failover fixtures configure controller groups, active records, cleanup, and policy conditions.
Active-group switching test
testsuite/tests/multicluster/failover/test_dns_failover.py
The test verifies DNS resolution changes from the first gateway to the second after switching active groups and waiting for TTL expiry.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • Kuadrant/testsuite#841: Introduced the KubectlDNS wrapper and related configuration and secret-generation test plumbing.

Suggested labels: DNS

Suggested reviewers: crstrn13, azgabur, silvi-t

Poem

I’m a rabbit hopping through DNS,
Switching gateways with great finesse.
Group one sleeps, group two takes flight,
Records change beneath the moonlight.
kubectl-kuadrant_dns leads the way—
Two clusters dance through failover today!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title matches the change, but the scope failover is not one of the allowed Conventional Commit scopes. Use an allowed scope such as multicluster or dns, e.g. test(multicluster): add happy path test for DNS failover.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description includes Summary, Changes, and Verification sections and covers the main work clearly.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@averevki averevki moved this to Ready For Review in Kuadrant Jul 15, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
testsuite/tests/multicluster/conftest.py (1)

31-39: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Validate the kubectl-dns configuration item.

As per coding guidelines, test fixtures should validate their required config sections before use. Consider validating the kubectl-dns configuration using testconfig.validators.validate to 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

📥 Commits

Reviewing files that changed from the base of the PR and between 5682b36 and 8f3630c.

📒 Files selected for processing (9)
  • Dockerfile
  • config/settings.local.yaml.tpl
  • config/settings.yaml
  • testsuite/gateway/gateway_api/hostname.py
  • testsuite/tests/multicluster/conftest.py
  • testsuite/tests/multicluster/coredns/two_clusters/kubectl_dns/test_secret_generation.py
  • testsuite/tests/multicluster/failover/__init__.py
  • testsuite/tests/multicluster/failover/conftest.py
  • testsuite/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

@averevki
averevki requested a review from philbrookes July 16, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DNS Operator Changes related to DNS Operator and resources it manages test-case New test case

Projects

Status: Ready For Review

Development

Successfully merging this pull request may close these issues.

1 participant