@@ -916,6 +916,7 @@ func (s) TestAggregateCluster_BadDNS_GoodEDS(t *testing.T) {
916916// error, the test verifies that RPCs fail with the error triggered by the DNS
917917// Discovery Mechanism (from sending an empty address list down).
918918func (s ) TestAggregateCluster_BadEDS_BadDNS (t * testing.T ) {
919+ dnsTargetCh , dnsR := setupDNS (t )
919920 // Start an xDS management server.
920921 managementServer := e2e .StartManagementServer (t , e2e.ManagementServerOptions {AllowResourceSubset : true })
921922
@@ -929,14 +930,16 @@ func (s) TestAggregateCluster_BadEDS_BadDNS(t *testing.T) {
929930 const (
930931 edsClusterName = clusterName + "-eds"
931932 dnsClusterName = clusterName + "-dns"
933+ dnsHostName = "bad.ip.v4.address"
934+ dnsPort = 8080
932935 )
933936 emptyEndpointResource := e2e .DefaultEndpoint (edsServiceName , "localhost" , nil )
934937 resources := e2e.UpdateOptions {
935938 NodeID : nodeID ,
936939 Clusters : []* v3clusterpb.Cluster {
937940 makeAggregateClusterResource (clusterName , []string {edsClusterName , dnsClusterName }),
938941 e2e .DefaultCluster (edsClusterName , edsServiceName , e2e .SecurityLevelNone ),
939- makeLogicalDNSClusterResource (dnsClusterName , "bad.ip.v4.address" , 8080 ),
942+ makeLogicalDNSClusterResource (dnsClusterName , dnsHostName , dnsPort ),
940943 },
941944 Endpoints : []* v3endpointpb.ClusterLoadAssignment {emptyEndpointResource },
942945 SkipValidation : true ,
@@ -952,6 +955,20 @@ func (s) TestAggregateCluster_BadEDS_BadDNS(t *testing.T) {
952955 cc , cleanup := setupAndDial (t , bootstrapContents )
953956 defer cleanup ()
954957
958+ // Ensure that the DNS resolver is started for the expected target.
959+ select {
960+ case <- ctx .Done ():
961+ t .Fatal ("Timeout when waiting for DNS resolver to be started" )
962+ case target := <- dnsTargetCh :
963+ got , want := target .Endpoint (), fmt .Sprintf ("%s:%d" , dnsHostName , dnsPort )
964+ if got != want {
965+ t .Fatalf ("DNS resolution started for target %q, want %q" , got , want )
966+ }
967+ }
968+
969+ // Produce a bad resolver update from the DNS resolver.
970+ dnsR .ReportError (fmt .Errorf ("DNS error" ))
971+
955972 // Ensure that the error from the DNS Resolver leads to an empty address
956973 // update for both priorities.
957974 client := testgrpc .NewTestServiceClient (cc )
0 commit comments