use of io.grpc.xds.XdsClient.ResourceMetadata.UpdateFailureState in project grpc-java by grpc.
the class ClientXdsClientTestBase method verifyResourceMetadataNacked.
/**
* Verify the resource to be nacked, and every i-th line of error details to begin with
* corresponding i-th element of {@code List<String> failedDetails}.
*/
private void verifyResourceMetadataNacked(ResourceType type, String resourceName, Any rawResource, String versionInfo, long updateTime, String failedVersion, long failedUpdateTimeNanos, List<String> failedDetails) {
ResourceMetadata resourceMetadata = verifyResourceMetadata(type, resourceName, rawResource, ResourceMetadataStatus.NACKED, versionInfo, updateTime, true);
UpdateFailureState errorState = resourceMetadata.getErrorState();
assertThat(errorState).isNotNull();
String name = type.toString() + " resource '" + resourceName + "' metadata error ";
assertWithMessage(name + "failedVersion").that(errorState.getFailedVersion()).isEqualTo(failedVersion);
assertWithMessage(name + "failedUpdateTimeNanos").that(errorState.getFailedUpdateTimeNanos()).isEqualTo(failedUpdateTimeNanos);
List<String> errors = Splitter.on('\n').splitToList(errorState.getFailedDetails());
for (int i = 0; i < errors.size(); i++) {
assertWithMessage(name + "failedDetails line " + i).that(errors.get(i)).startsWith(failedDetails.get(i));
}
}
Aggregations