more tests

Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
Miek Gieben
2020-01-17 16:51:19 +01:00
parent 9433da1a67
commit c7dcd633e0

View File

@@ -41,7 +41,9 @@ func TestTraffic(t *testing.T) {
}, },
{ {
cla: &xdspb.ClusterLoadAssignment{}, cla: &xdspb.ClusterLoadAssignment{},
cluster: "does-not-exist", qtype: dns.TypeA, rcode: dns.RcodeNameError, ns: true}, cluster: "does-not-exist", qtype: dns.TypeA, rcode: dns.RcodeNameError, ns: true,
},
// healthy backend
{ {
cla: &xdspb.ClusterLoadAssignment{ cla: &xdspb.ClusterLoadAssignment{
ClusterName: "web", ClusterName: "web",
@@ -49,6 +51,7 @@ func TestTraffic(t *testing.T) {
}, },
cluster: "web", qtype: dns.TypeA, rcode: dns.RcodeSuccess, answer: "127.0.0.1", cluster: "web", qtype: dns.TypeA, rcode: dns.RcodeSuccess, answer: "127.0.0.1",
}, },
// unknown backend
{ {
cla: &xdspb.ClusterLoadAssignment{ cla: &xdspb.ClusterLoadAssignment{
ClusterName: "web", ClusterName: "web",
@@ -56,6 +59,17 @@ func TestTraffic(t *testing.T) {
}, },
cluster: "web", qtype: dns.TypeA, rcode: dns.RcodeSuccess, ns: true, cluster: "web", qtype: dns.TypeA, rcode: dns.RcodeSuccess, ns: true,
}, },
// unknown backend and healthy backend
{
cla: &xdspb.ClusterLoadAssignment{
ClusterName: "web",
Endpoints: endpoints([]EndpointHealth{
{"127.0.0.1", corepb.HealthStatus_UNKNOWN},
{"127.0.0.2", corepb.HealthStatus_HEALTHY},
}),
},
cluster: "web", qtype: dns.TypeA, rcode: dns.RcodeSuccess, answer: "127.0.0.2",
},
} }
ctx := context.TODO() ctx := context.TODO()