mirror of https://github.com/grpc/grpc-java.git
interop-testing: Add special_status_message test
This commit is contained in:
parent
d66ba24272
commit
75b48b4dfe
|
|
@ -1532,6 +1532,27 @@ public abstract class AbstractInteropTest {
|
||||||
assertStatsTrace("grpc.testing.TestService/FullDuplexCall", Status.Code.UNKNOWN);
|
assertStatsTrace("grpc.testing.TestService/FullDuplexCall", Status.Code.UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void specialStatusMessage() throws Exception {
|
||||||
|
int errorCode = 2;
|
||||||
|
String errorMessage = "\t\ntest with whitespace\r\nand Unicode BMP ☺ and non-BMP 😈\t\n";
|
||||||
|
SimpleRequest simpleRequest = SimpleRequest.newBuilder()
|
||||||
|
.setResponseStatus(EchoStatus.newBuilder()
|
||||||
|
.setCode(errorCode)
|
||||||
|
.setMessage(errorMessage)
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
try {
|
||||||
|
blockingStub.unaryCall(simpleRequest);
|
||||||
|
fail();
|
||||||
|
} catch (StatusRuntimeException e) {
|
||||||
|
assertEquals(Status.UNKNOWN.getCode(), e.getStatus().getCode());
|
||||||
|
assertEquals(errorMessage, e.getStatus().getDescription());
|
||||||
|
}
|
||||||
|
assertStatsTrace("grpc.testing.TestService/UnaryCall", Status.Code.UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
/** Sends an rpc to an unimplemented method within TestService. */
|
/** Sends an rpc to an unimplemented method within TestService. */
|
||||||
@Test
|
@Test
|
||||||
public void unimplementedMethod() {
|
public void unimplementedMethod() {
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ public enum TestCases {
|
||||||
PER_RPC_CREDS("per rpc raw oauth2 access token auth"),
|
PER_RPC_CREDS("per rpc raw oauth2 access token auth"),
|
||||||
CUSTOM_METADATA("unary and full duplex calls with metadata"),
|
CUSTOM_METADATA("unary and full duplex calls with metadata"),
|
||||||
STATUS_CODE_AND_MESSAGE("request error code and message"),
|
STATUS_CODE_AND_MESSAGE("request error code and message"),
|
||||||
|
SPECIAL_STATUS_MESSAGE("special characters in status message"),
|
||||||
UNIMPLEMENTED_METHOD("call an unimplemented RPC method"),
|
UNIMPLEMENTED_METHOD("call an unimplemented RPC method"),
|
||||||
UNIMPLEMENTED_SERVICE("call an unimplemented RPC service"),
|
UNIMPLEMENTED_SERVICE("call an unimplemented RPC service"),
|
||||||
CANCEL_AFTER_BEGIN("cancel stream after starting it"),
|
CANCEL_AFTER_BEGIN("cancel stream after starting it"),
|
||||||
|
|
|
||||||
|
|
@ -301,6 +301,10 @@ public class TestServiceClient {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case SPECIAL_STATUS_MESSAGE:
|
||||||
|
tester.specialStatusMessage();
|
||||||
|
break;
|
||||||
|
|
||||||
case UNIMPLEMENTED_METHOD: {
|
case UNIMPLEMENTED_METHOD: {
|
||||||
tester.unimplementedMethod();
|
tester.unimplementedMethod();
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ public class TestCasesTest {
|
||||||
"per_rpc_creds",
|
"per_rpc_creds",
|
||||||
"custom_metadata",
|
"custom_metadata",
|
||||||
"status_code_and_message",
|
"status_code_and_message",
|
||||||
|
"special_status_message",
|
||||||
"unimplemented_method",
|
"unimplemented_method",
|
||||||
"unimplemented_service",
|
"unimplemented_service",
|
||||||
"cancel_after_begin",
|
"cancel_after_begin",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue