Merge pull request #3895 from jacksontj/issue_3881

Correctly format ipv6 resolver config for lua
This commit is contained in:
Kubernetes Prow Robot 2019-03-14 11:22:27 -07:00 committed by GitHub
commit 614a2d43bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -250,11 +250,15 @@ func buildResolversForLua(res interface{}, disableIpv6 interface{}) string {
r := []string{} r := []string{}
for _, ns := range nss { for _, ns := range nss {
if ing_net.IsIPV6(ns) && no6 { if ing_net.IsIPV6(ns) {
if no6 {
continue continue
} }
r = append(r, fmt.Sprintf("\"[%v]\"", ns))
} else {
r = append(r, fmt.Sprintf("\"%v\"", ns)) r = append(r, fmt.Sprintf("\"%v\"", ns))
} }
}
return strings.Join(r, ", ") return strings.Join(r, ", ")
} }

View file

@ -516,7 +516,7 @@ func TestBuildResolversForLua(t *testing.T) {
t.Errorf("Expected '%v' but returned '%v'", expected, actual) t.Errorf("Expected '%v' but returned '%v'", expected, actual)
} }
expected = "\"192.0.0.1\", \"2001:db8:1234::\"" expected = "\"192.0.0.1\", \"[2001:db8:1234::]\""
actual = buildResolversForLua(ipList, false) actual = buildResolversForLua(ipList, false)
if expected != actual { if expected != actual {