@@ -1555,12 +1555,16 @@ public void cdsResponseErrorHandling_badUpstreamTlsContext() {
1555
1555
call .sendResponse (CDS , clusters , VERSION_1 , "0000" );
1556
1556
1557
1557
// The response NACKed with errors indicating indices of the failed resources.
1558
- call .verifyRequestNack (CDS , CDS_RESOURCE , "" , "0000" , NODE , ImmutableList .of (
1559
- "CDS response Cluster 'cluster.googleapis.com' validation error: "
1558
+ String errorMsg = "CDS response Cluster 'cluster.googleapis.com' validation error: "
1560
1559
+ "Cluster cluster.googleapis.com: malformed UpstreamTlsContext: "
1561
1560
+ "io.grpc.xds.ClientXdsClient$ResourceInvalidException: "
1562
- + "ca_certificate_provider_instance is required in upstream-tls-context" ));
1563
- verifyNoInteractions (cdsResourceWatcher );
1561
+ + "ca_certificate_provider_instance is required in upstream-tls-context" ;
1562
+ call .verifyRequestNack (CDS , CDS_RESOURCE , "" , "0000" , NODE , ImmutableList .of (errorMsg ));
1563
+ ArgumentCaptor <Status > captor = ArgumentCaptor .forClass (Status .class );
1564
+ verify (cdsResourceWatcher ).onError (captor .capture ());
1565
+ Status errorStatus = captor .getValue ();
1566
+ assertThat (errorStatus .getCode ()).isEqualTo (Status .UNAVAILABLE .getCode ());
1567
+ assertThat (errorStatus .getDescription ()).isEqualTo (errorMsg );
1564
1568
}
1565
1569
1566
1570
/**
@@ -1579,10 +1583,14 @@ public void cdsResponseErrorHandling_badTransportSocketName() {
1579
1583
call .sendResponse (CDS , clusters , VERSION_1 , "0000" );
1580
1584
1581
1585
// The response NACKed with errors indicating indices of the failed resources.
1582
- call .verifyRequestNack (CDS , CDS_RESOURCE , "" , "0000" , NODE , ImmutableList .of (
1583
- "CDS response Cluster 'cluster.googleapis.com' validation error: "
1584
- + "transport-socket with name envoy.transport_sockets.bad not supported." ));
1585
- verifyNoInteractions (cdsResourceWatcher );
1586
+ String errorMsg = "CDS response Cluster 'cluster.googleapis.com' validation error: "
1587
+ + "transport-socket with name envoy.transport_sockets.bad not supported." ;
1588
+ call .verifyRequestNack (CDS , CDS_RESOURCE , "" , "0000" , NODE , ImmutableList .of (errorMsg ));
1589
+ ArgumentCaptor <Status > captor = ArgumentCaptor .forClass (Status .class );
1590
+ verify (cdsResourceWatcher ).onError (captor .capture ());
1591
+ Status errorStatus = captor .getValue ();
1592
+ assertThat (errorStatus .getCode ()).isEqualTo (Status .UNAVAILABLE .getCode ());
1593
+ assertThat (errorStatus .getDescription ()).isEqualTo (errorMsg );
1586
1594
}
1587
1595
1588
1596
@ Test
@@ -2429,10 +2437,15 @@ public void serverSideListenerResponseErrorHandling_badDownstreamTlsContext() {
2429
2437
List <Any > listeners = ImmutableList .of (Any .pack (listener ));
2430
2438
call .sendResponse (ResourceType .LDS , listeners , "0" , "0000" );
2431
2439
// The response NACKed with errors indicating indices of the failed resources.
2432
- call .verifyRequestNack (LDS , LISTENER_RESOURCE , "" , "0000" , NODE , ImmutableList .of (
2433
- "LDS response Listener \' grpc/server?xds.resource.listening_address=0.0.0.0:7000\' "
2434
- + "validation error: common-tls-context is required in downstream-tls-context" ));
2435
- verifyNoInteractions (ldsResourceWatcher );
2440
+ String errorMsg = "LDS response Listener \' grpc/server?xds.resource.listening_address="
2441
+ + "0.0.0.0:7000\' validation error: "
2442
+ + "common-tls-context is required in downstream-tls-context" ;
2443
+ call .verifyRequestNack (LDS , LISTENER_RESOURCE , "" , "0000" , NODE , ImmutableList .of (errorMsg ));
2444
+ ArgumentCaptor <Status > captor = ArgumentCaptor .forClass (Status .class );
2445
+ verify (ldsResourceWatcher ).onError (captor .capture ());
2446
+ Status errorStatus = captor .getValue ();
2447
+ assertThat (errorStatus .getCode ()).isEqualTo (Status .UNAVAILABLE .getCode ());
2448
+ assertThat (errorStatus .getDescription ()).isEqualTo (errorMsg );
2436
2449
}
2437
2450
2438
2451
@ Test
@@ -2453,11 +2466,16 @@ public void serverSideListenerResponseErrorHandling_badTransportSocketName() {
2453
2466
List <Any > listeners = ImmutableList .of (Any .pack (listener ));
2454
2467
call .sendResponse (ResourceType .LDS , listeners , "0" , "0000" );
2455
2468
// The response NACKed with errors indicating indices of the failed resources.
2469
+ String errorMsg = "LDS response Listener \' grpc/server?xds.resource.listening_address="
2470
+ + "0.0.0.0:7000\' validation error: "
2471
+ + "transport-socket with name envoy.transport_sockets.bad1 not supported." ;
2456
2472
call .verifyRequestNack (LDS , LISTENER_RESOURCE , "" , "0000" , NODE , ImmutableList .of (
2457
- "LDS response Listener \' grpc/server?xds.resource.listening_address=0.0.0.0:7000\' "
2458
- + "validation error: "
2459
- + "transport-socket with name envoy.transport_sockets.bad1 not supported." ));
2460
- verifyNoInteractions (ldsResourceWatcher );
2473
+ errorMsg ));
2474
+ ArgumentCaptor <Status > captor = ArgumentCaptor .forClass (Status .class );
2475
+ verify (ldsResourceWatcher ).onError (captor .capture ());
2476
+ Status errorStatus = captor .getValue ();
2477
+ assertThat (errorStatus .getCode ()).isEqualTo (Status .UNAVAILABLE .getCode ());
2478
+ assertThat (errorStatus .getDescription ()).isEqualTo (errorMsg );
2461
2479
}
2462
2480
2463
2481
private DiscoveryRpcCall startResourceWatcher (
0 commit comments