controlplane: only enable STATIC dns when all adresses are IP addresses (#1822)

This commit is contained in:
Caleb Doxsey 2021-01-25 15:49:58 -07:00 committed by GitHub
parent 979e8f9cec
commit bcc8c17855
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 7 deletions

View file

@ -211,7 +211,7 @@ func Test_buildCluster(t *testing.T) {
rootCA := srv.filemgr.FileDataSource(rootCAPath).GetFilename()
t.Run("insecure", func(t *testing.T) {
endpoints := srv.buildPolicyEndpoints(&config.Policy{
Destinations: mustParseURLs("http://example.com"),
Destinations: mustParseURLs("http://example.com", "http://1.2.3.4"),
})
cluster := newDefaultEnvoyClusterConfig()
cluster.DnsLookupFamily = envoy_config_cluster_v3.Cluster_V4_ONLY
@ -240,6 +240,16 @@ func Test_buildCluster(t *testing.T) {
}
}
}
}, {
"endpoint": {
"address": {
"socketAddress": {
"address": "1.2.3.4",
"ipv4Compat": true,
"portValue": 80
}
}
}
}]
}]
}
@ -340,9 +350,9 @@ func Test_buildCluster(t *testing.T) {
}
`, cluster)
})
t.Run("ip address", func(t *testing.T) {
t.Run("ip addresses", func(t *testing.T) {
endpoints := srv.buildPolicyEndpoints(&config.Policy{
Destinations: mustParseURLs("http://127.0.0.1"),
Destinations: mustParseURLs("http://127.0.0.1", "http://127.0.0.2"),
})
cluster := newDefaultEnvoyClusterConfig()
err := buildCluster(cluster, "example", endpoints, true)
@ -369,6 +379,16 @@ func Test_buildCluster(t *testing.T) {
}
}
}
},{
"endpoint": {
"address": {
"socketAddress": {
"address": "127.0.0.2",
"ipv4Compat": true,
"portValue": 80
}
}
}
}]
}]
}