From a80342e6536ee60001c0b24e8fde074029ce2497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Nussbaumer?= Date: Tue, 22 Mar 2022 09:39:42 +0100 Subject: [PATCH] test: add ipv6 tests as well --- internal/controller/csr_controller_test.go | 8 ++++---- internal/controller/testenv_setup_test.go | 12 ++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/internal/controller/csr_controller_test.go b/internal/controller/csr_controller_test.go index c168826..4bcdf55 100644 --- a/internal/controller/csr_controller_test.go +++ b/internal/controller/csr_controller_test.go @@ -64,10 +64,10 @@ func TestWrongSignerCsr(t *testing.T) { func TestNonMatchingCommonNameUsername(t *testing.T) { csrParams := CsrParams{ - csrName: "csr-non-matching", - commonName: "funny-common-name", - - ipAddresses: testNodeIpAddresses, nodeName: testNodeName} + csrName: "csr-non-matching", + commonName: "funny-common-name", + ipAddresses: testNodeIpAddresses, + nodeName: testNodeName} csr := createCsr(t, csrParams) _, nodeClientSet, _ := createControlPlaneUser(t, csr.Spec.Username, []string{"system:masters"}) diff --git a/internal/controller/testenv_setup_test.go b/internal/controller/testenv_setup_test.go index 8e37245..5754cd1 100644 --- a/internal/controller/testenv_setup_test.go +++ b/internal/controller/testenv_setup_test.go @@ -82,7 +82,6 @@ type CsrParams struct { var ( testNodeName string - testNodeIps []string testNodeIpAddresses []net.IP ) @@ -168,15 +167,20 @@ func packageSetup() { } adminClientset = clientset.NewForConfigOrDie(cfg) - testNodeIps := []string{"192.168.14.34"} - for _, ip := range testNodeIps { + testNodeIpv4 := []string{"192.168.14.34"} + testNodeIpv6 := []string{"fc00:1291:feed::cafe"} + for _, ip := range testNodeIpv4 { + testNodeIpAddresses = append(testNodeIpAddresses, net.ParseIP(ip)) + } + for _, ip := range testNodeIpv6 { testNodeIpAddresses = append(testNodeIpAddresses, net.ParseIP(ip)) } testNodeName = randstr.String(4, "0123456789abcdefghijklmnopqrstuvwxyz") dnsResolver = mockdns.Resolver{ Zones: map[string]mockdns.Zone{ testNodeName + ".test.ch.": { - A: testNodeIps, + A: testNodeIpv4, + AAAA: testNodeIpv6, }, }, }