diff --git a/plugin/backend_lookup_test.go b/plugin/backend_lookup_test.go index a1dd49c63..604a610f4 100644 --- a/plugin/backend_lookup_test.go +++ b/plugin/backend_lookup_test.go @@ -213,8 +213,9 @@ func TestCNAMEHostIsNameAndIpIgnored(t *testing.T) { func TestCNAMEChainLimitAndLoop(t *testing.T) { // Construct internal CNAME chain longer than maxCnameChainLength and ensure truncation of chain - var names []string - for i := range maxCnameChainLength + 2 { + chainLength := maxCnameChainLength + 2 + names := make([]string, 0, chainLength) + for i := range chainLength { names = append(names, fmt.Sprintf("c%d.example.org.", i)) } chain := map[string]string{}