Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AXFR integration tests for kubernetes plugin #157

Conversation

davidmccormick
Copy link
Contributor

@davidmccormick davidmccormick commented Sep 13, 2024

Whilst testing a CoreDNS upgrade, we discovered that Zone Transfers / AXFR requests were failing to produce the expected results. This occurred around the introduction of the transfer plugin. We noticed that AXFR is not covered by the existing ci integration tests.

Before we write integration tests to support coredns/kubernetai#66 which adds AXFR back into the kubernetai plugin we want some tests that prove that the embedded kubernetes plugin is working as anticipated.

Details

  1. Add two AXFR tests - one with services and one which tests pod endpoints.
  2. Regex matches any IPV4 address because these can change between test environments and different runs.
  3. Changing the pause container from gcr.io/google_containers/pause-amd64:3.0 to k8s.gcr.io/pause:3.9 helps developers run the tests on ARM hardware (e.g. modern Macs).
  4. Added some custom code paths for testing AXFR queries and parsing AXFR responses because they differ from the existing tests.
  5. AXFR tests are performed in test-4 and test-5 namespaces so that they do interfere with existing test suites.
  6. Checking for a nil test result rather than panicking gives us the opportunity of displaying the logs.

@davidmccormick davidmccormick force-pushed the add-kubernetes-axfr-integration-tests branch 2 times, most recently from a34c43f to 999b80f Compare September 16, 2024 08:34
@davidmccormick
Copy link
Contributor Author

Looks like the build of the metadata plugin is failing...

github.com/coredns/metadata_edns0
# github.com/coredns/metadata_edns0
link: golang.org/x/net/internal/socket: invalid reference to syscall.recvmsg
make: *** [Makefile:32: build] Error 1
[+] Building 0.3s (13/13) FINISHED                               docker:default
 => [internal] load build definition from Dockerfile                       0.0s

Don't panic tests when there is no result - it is better to capture the logs.
Update pause container to be valid on x86_64 or arm64.

Signed-off-by: Dave McCormick <d_mccormick@apple.com>

Match AXFR responses by searching through ALL repeatedly for each expected record until they have all been found.
Implement special matchers for SOA, A, SRV to allow for differences is the output result.

Signed-off-by: Dave McCormick <d_mccormick@apple.com>
@davidmccormick
Copy link
Contributor Author

This PR fixes the failed build coredns/metadata_edns0#22

@davidmccormick
Copy link
Contributor Author

The Kubernetes plugin already supports the transfer plugin and post-merge these additional AXFR tests will pass.

@chrisohaver
Copy link
Member

Thanks for adding this!

@chrisohaver chrisohaver merged commit 547ff42 into coredns:master Sep 17, 2024
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants