From 4a9d3bedf95f199d64d9dc5775dc23e4c145db8b Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Wed, 18 May 2022 20:14:18 +0200 Subject: [PATCH] Use new names to resolve magic dns --- integration_test.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/integration_test.go b/integration_test.go index da3bc8a..d1fb887 100644 --- a/integration_test.go +++ b/integration_test.go @@ -639,9 +639,13 @@ func (s *IntegrationTestSuite) TestMagicDNS() { for namespace, scales := range s.namespaces { ips, err := getIPs(scales.tailscales) assert.Nil(s.T(), err) + + hostnames, err := getDNSNames(&s.headscale) + assert.Nil(s.T(), err) + for hostname, tailscale := range scales.tailscales { - for peername, ips := range ips { - if peername == hostname { + for _, peername := range hostnames { + if strings.Contains(peername, hostname) { continue } s.T().Run(fmt.Sprintf("%s-%s", hostname, peername), func(t *testing.T) { @@ -663,7 +667,9 @@ func (s *IntegrationTestSuite) TestMagicDNS() { assert.Nil(t, err) log.Printf("Result for %s: %s\n", hostname, result) - for _, ip := range ips { + peerBaseName := peername[:len(peername)-MachineGivenNameHashLength-1] + expectedAddresses := ips[peerBaseName] + for _, ip := range expectedAddresses { assert.Contains(t, result, ip.String()) } })