From c7dcd633e02ac8f700d252d9c4acb693a1f35844 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Fri, 17 Jan 2020 16:51:19 +0100 Subject: [PATCH] more tests Signed-off-by: Miek Gieben --- plugin/traffic/traffic_test.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/plugin/traffic/traffic_test.go b/plugin/traffic/traffic_test.go index 5db7cc451..7f1fb2648 100644 --- a/plugin/traffic/traffic_test.go +++ b/plugin/traffic/traffic_test.go @@ -41,7 +41,9 @@ func TestTraffic(t *testing.T) { }, { 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{ ClusterName: "web", @@ -49,6 +51,7 @@ func TestTraffic(t *testing.T) { }, cluster: "web", qtype: dns.TypeA, rcode: dns.RcodeSuccess, answer: "127.0.0.1", }, + // unknown backend { cla: &xdspb.ClusterLoadAssignment{ ClusterName: "web", @@ -56,6 +59,17 @@ func TestTraffic(t *testing.T) { }, 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()