@@ -840,6 +840,7 @@ func (s) TestAggregateCluster_BadEDSFromError_GoodToBadDNS(t *testing.T) {
840840// good update, this test verifies the cluster_resolver balancer correctly falls
841841// back from the LOGICAL_DNS cluster to the EDS cluster.
842842func (s ) TestAggregateCluster_BadDNS_GoodEDS (t * testing.T ) {
843+ dnsTargetCh , dnsR := setupDNS (t )
843844 // Start an xDS management server.
844845 managementServer := e2e .StartManagementServer (t , e2e.ManagementServerOptions {AllowResourceSubset : true })
845846
@@ -857,12 +858,14 @@ func (s) TestAggregateCluster_BadDNS_GoodEDS(t *testing.T) {
857858 const (
858859 edsClusterName = clusterName + "-eds"
859860 dnsClusterName = clusterName + "-dns"
861+ dnsHostName = "bad.ip.v4.address"
862+ dnsPort = 8080
860863 )
861864 resources := e2e.UpdateOptions {
862865 NodeID : nodeID ,
863866 Clusters : []* v3clusterpb.Cluster {
864867 makeAggregateClusterResource (clusterName , []string {dnsClusterName , edsClusterName }),
865- makeLogicalDNSClusterResource (dnsClusterName , "bad.ip.v4.address" , 8080 ),
868+ makeLogicalDNSClusterResource (dnsClusterName , dnsHostName , dnsPort ),
866869 e2e .DefaultCluster (edsClusterName , edsServiceName , e2e .SecurityLevelNone ),
867870 },
868871 Endpoints : []* v3endpointpb.ClusterLoadAssignment {e2e .DefaultEndpoint (edsServiceName , "localhost" , []uint32 {uint32 (edsPort )})},
@@ -879,6 +882,21 @@ func (s) TestAggregateCluster_BadDNS_GoodEDS(t *testing.T) {
879882 cc , cleanup := setupAndDial (t , bootstrapContents )
880883 defer cleanup ()
881884
885+ // Ensure that the DNS resolver is started for the expected target.
886+ select {
887+ case <- ctx .Done ():
888+ t .Fatal ("Timeout when waiting for DNS resolver to be started" )
889+ case target := <- dnsTargetCh :
890+ got , want := target .Endpoint (), fmt .Sprintf ("%s:%d" , dnsHostName , dnsPort )
891+ if got != want {
892+ t .Fatalf ("DNS resolution started for target %q, want %q" , got , want )
893+ }
894+ }
895+
896+ // Produce a bad resolver update from the DNS resolver.
897+ dnsErr := fmt .Errorf ("DNS error" )
898+ dnsR .ReportError (dnsErr )
899+
882900 // RPCs should work, higher level DNS cluster errors so should fallback to
883901 // EDS cluster.
884902 client := testgrpc .NewTestServiceClient (cc )
0 commit comments