public abstract class AbstractInteropTest extends Object
New tests should avoid using Mockito to support running on AppEngine.
| Modifier and Type | Field and Description |
|---|---|
protected io.grpc.testing.integration.TestServiceGrpc.TestServiceStub |
asyncStub |
protected io.grpc.testing.integration.TestServiceGrpc.TestServiceBlockingStub |
blockingStub |
protected io.grpc.ManagedChannel |
channel |
protected static io.grpc.testing.integration.EmptyProtos.Empty |
EMPTY |
org.junit.rules.TestRule |
globalTimeout |
static int |
MAX_MESSAGE_SIZE
Must be at least
unaryPayloadLength(), plus some to account for encoding overhead. |
| Constructor and Description |
|---|
AbstractInteropTest()
Constructor for tests.
|
| Modifier and Type | Method and Description |
|---|---|
protected static void |
assertSuccess(io.grpc.internal.testing.StreamRecorder<?> recorder) |
protected void |
assertX500SubjectDn(String tlsInfo)
Helper for asserting TLS info in SSLSession
ServerCall.getAttributes() |
void |
cacheableUnary()
Sends a cacheable unary rpc using GET.
|
void |
cancelAfterBegin() |
void |
cancelAfterFirstResponse() |
void |
censusContextsPropagated() |
void |
clientCompressedStreaming(boolean probe)
Tests client per-message compression for streaming calls.
|
void |
clientCompressedUnary(boolean probe)
Tests client per-message compression for unary calls.
|
void |
clientStreaming() |
void |
computeEngineChannelCredentials(String defaultServiceAccount,
io.grpc.testing.integration.TestServiceGrpc.TestServiceBlockingStub computeEngineStub)
Sends an unary rpc with ComputeEngineChannelBuilder.
|
void |
computeEngineCreds(String serviceAccount,
String oauthScope)
Sends a large unary rpc with compute engine credentials.
|
protected abstract io.grpc.ManagedChannel |
createChannel() |
protected io.grpc.internal.CensusStatsModule |
createClientCensusStatsModule() |
void |
customMetadata() |
void |
deadlineExceeded() |
void |
deadlineExceededServerStreaming() |
void |
deadlineInPast() |
void |
deadlineNotExceeded() |
void |
emptyStream() |
void |
emptyUnary() |
void |
exchangeMetadataStreamingCall() |
void |
exchangeMetadataUnaryCall() |
void |
fullDuplexCallShouldSucceed() |
protected io.grpc.ClientInterceptor[] |
getAdditionalInterceptors() |
protected io.grpc.internal.AbstractServerImplBuilder<?> |
getServerBuilder()
Returns the server builder used to create server for each test run.
|
void |
googleDefaultCredentials(String defaultServiceAccount,
io.grpc.testing.integration.TestServiceGrpc.TestServiceBlockingStub googleDefaultStub)
Sends an unary rpc with "google default credentials".
|
void |
gracefulShutdown() |
void |
halfDuplexCallShouldSucceed() |
void |
jwtTokenCreds(InputStream serviceAccountJson)
Test JWT-based auth.
|
void |
largeUnary() |
void |
maxInboundSize_exact() |
void |
maxInboundSize_tooBig() |
void |
maxOutboundSize_exact() |
void |
maxOutboundSize_tooBig() |
protected boolean |
metricsExpected()
Return true if exact metric values should be checked.
|
void |
oauth2AuthToken(String jsonKey,
InputStream credentialsStream,
String authScope)
Sends a unary rpc with raw oauth2 access token credentials.
|
protected SocketAddress |
obtainLocalClientAddr()
Helper for getting local address from
ServerCall.getAttributes() |
protected SocketAddress |
obtainRemoteClientAddr()
Helper for getting remote address from
ServerCall.getAttributes() |
protected int |
operationTimeoutMillis() |
void |
perRpcCreds(String jsonKey,
InputStream credentialsStream,
String oauthScope)
Sends a unary rpc with "per rpc" raw oauth2 access token credentials.
|
void |
pickFirstUnary()
Assuming "pick_first" policy is used, tests that all requests are sent to the same server.
|
void |
pingPong() |
void |
sendsTimeoutHeader() |
void |
serverCompressedStreaming()
Tests server per-message compression in a streaming response.
|
void |
serverCompressedUnary()
Tests if the server can send a compressed unary response.
|
void |
serverStreaming() |
void |
serverStreamingShouldBeFlowControlled() |
void |
serviceAccountCreds(String jsonKey,
InputStream credentialsStream,
String authScope)
Sends a large unary rpc with service account credentials.
|
void |
setUp()
Must be called by the subclass setup method if overridden.
|
void |
specialStatusMessage() |
void |
statusCodeAndMessage() |
void |
tearDown()
Clean up.
|
void |
timeoutOnSleepingServer()
Start a fullDuplexCall which the server will not respond, and verify the deadline expires.
|
protected int |
unaryPayloadLength() |
void |
unimplementedMethod()
Sends an rpc to an unimplemented method within TestService.
|
void |
unimplementedService()
Sends an rpc to an unimplemented service on the server.
|
void |
veryLargeRequest() |
void |
veryLargeResponse() |
public final org.junit.rules.TestRule globalTimeout
public static final int MAX_MESSAGE_SIZE
unaryPayloadLength(), plus some to account for encoding overhead.protected static final io.grpc.testing.integration.EmptyProtos.Empty EMPTY
protected io.grpc.ManagedChannel channel
protected io.grpc.testing.integration.TestServiceGrpc.TestServiceBlockingStub blockingStub
protected io.grpc.testing.integration.TestServiceGrpc.TestServiceStub asyncStub
public void setUp()
public void tearDown()
protected abstract io.grpc.ManagedChannel createChannel()
@Nullable protected io.grpc.ClientInterceptor[] getAdditionalInterceptors()
@Nullable protected io.grpc.internal.AbstractServerImplBuilder<?> getServerBuilder()
null if
it shouldn't start a server in the same process.protected final io.grpc.internal.CensusStatsModule createClientCensusStatsModule()
protected boolean metricsExpected()
public void cacheableUnary()
public void clientCompressedUnary(boolean probe)
throws Exception
Exceptionpublic void serverCompressedUnary()
throws Exception
Exceptionpublic void pickFirstUnary()
throws Exception
Exceptionpublic void clientCompressedStreaming(boolean probe)
throws Exception
Exceptionpublic void serverCompressedStreaming()
throws Exception
Exceptionpublic void fullDuplexCallShouldSucceed()
throws Exception
Exceptionpublic void halfDuplexCallShouldSucceed()
throws Exception
Exceptionpublic void serverStreamingShouldBeFlowControlled()
throws Exception
Exceptionpublic void exchangeMetadataUnaryCall()
throws Exception
Exceptionpublic void exchangeMetadataStreamingCall()
throws Exception
Exceptionpublic void sendsTimeoutHeader()
public void deadlineNotExceeded()
public void deadlineExceededServerStreaming()
throws Exception
Exceptionpublic void maxInboundSize_exact()
public void maxInboundSize_tooBig()
public void maxOutboundSize_exact()
public void maxOutboundSize_tooBig()
protected int unaryPayloadLength()
public void censusContextsPropagated()
public void unimplementedMethod()
public void unimplementedService()
public void timeoutOnSleepingServer()
throws Exception
Exceptionpublic void serviceAccountCreds(String jsonKey, InputStream credentialsStream, String authScope) throws Exception
Exceptionpublic void computeEngineCreds(String serviceAccount, String oauthScope) throws Exception
Exceptionpublic void computeEngineChannelCredentials(String defaultServiceAccount, io.grpc.testing.integration.TestServiceGrpc.TestServiceBlockingStub computeEngineStub) throws Exception
Exceptionpublic void jwtTokenCreds(InputStream serviceAccountJson) throws Exception
Exceptionpublic void oauth2AuthToken(String jsonKey, InputStream credentialsStream, String authScope) throws Exception
Exceptionpublic void perRpcCreds(String jsonKey, InputStream credentialsStream, String oauthScope) throws Exception
Exceptionpublic void googleDefaultCredentials(String defaultServiceAccount, io.grpc.testing.integration.TestServiceGrpc.TestServiceBlockingStub googleDefaultStub) throws Exception
Exceptionprotected static void assertSuccess(io.grpc.internal.testing.StreamRecorder<?> recorder)
protected SocketAddress obtainRemoteClientAddr()
ServerCall.getAttributes()protected SocketAddress obtainLocalClientAddr()
ServerCall.getAttributes()protected void assertX500SubjectDn(String tlsInfo)
ServerCall.getAttributes()protected int operationTimeoutMillis()