public abstract class AbstractInteropTest
extends java.lang.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. |
static int |
TEST_FLOW_CONTROL_WINDOW
Use a small flow control to help detect flow control bugs.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractInteropTest()
Constructor for tests.
|
| Modifier and Type | Method and Description |
|---|---|
protected static void |
assertSuccess(io.grpc.internal.testing.StreamRecorder<?> recorder) |
protected void |
assertX500SubjectDn(java.lang.String tlsInfo)
Helper for asserting TLS info in SSLSession
ServerCall.getAttributes() |
protected static void |
assumeEnoughMemory()
Some tests run on memory constrained environments.
|
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(java.lang.String defaultServiceAccount,
io.grpc.testing.integration.TestServiceGrpc.TestServiceBlockingStub computeEngineStub)
Sends an unary rpc with ComputeEngineChannelBuilder.
|
void |
computeEngineCreds(java.lang.String serviceAccount,
java.lang.String oauthScope)
Sends a large unary rpc with compute engine credentials.
|
protected io.grpc.ClientInterceptor |
createCensusStatsClientInterceptor() |
protected io.grpc.ManagedChannel |
createChannel() |
protected abstract io.grpc.ManagedChannelBuilder<?> |
createChannelBuilder() |
protected io.grpc.ServerStreamTracer.Factory |
createCustomCensusTracerFactory() |
protected boolean |
customCensusModulePresent()
Override this when custom census module presence is different from
metricsExpected(). |
void |
customMetadata() |
void |
deadlineExceeded() |
void |
deadlineExceededServerStreaming() |
void |
deadlineInPast() |
void |
deadlineNotExceeded() |
void |
emptyStream() |
void |
emptyUnary() |
void |
emptyUnaryWithRetriableStream() |
void |
exchangeMetadataStreamingCall() |
void |
exchangeMetadataUnaryCall() |
void |
fullDuplexCallShouldSucceed() |
protected io.grpc.ClientInterceptor[] |
getAdditionalInterceptors() |
void |
getServerAddressAndLocalAddressFromClient()
Verifies remote server address and local client address are available from ClientCall
Attributes via ClientInterceptor.
|
protected io.grpc.ServerBuilder<?> |
getServerBuilder()
Returns the server builder used to create server for each test run.
|
void |
googleDefaultCredentials(java.lang.String defaultServiceAccount,
io.grpc.testing.integration.TestServiceGrpc.TestServiceBlockingStub googleDefaultStub)
Sends an unary rpc with "google default credentials".
|
void |
gracefulShutdown() |
void |
halfDuplexCallShouldSucceed() |
void |
jwtTokenCreds(java.io.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(java.lang.String jsonKey,
java.io.InputStream credentialsStream,
java.lang.String authScope)
Sends a unary rpc with raw oauth2 access token credentials.
|
protected java.net.SocketAddress |
obtainLocalClientAddr()
Helper for getting local address from
ClientCall.getAttributes() |
protected java.net.SocketAddress |
obtainLocalServerAddr()
Helper for getting local address from
ServerCall.getAttributes() |
protected java.net.SocketAddress |
obtainRemoteClientAddr()
Helper for getting remote address from
ServerCall.getAttributes() |
protected java.net.SocketAddress |
obtainRemoteServerAddr()
Helper for getting remote address from
ClientCall.getAttributes() |
protected int |
operationTimeoutMillis() |
void |
perRpcCreds(java.lang.String jsonKey,
java.io.InputStream credentialsStream,
java.lang.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(java.lang.String jsonKey,
java.io.InputStream credentialsStream,
java.lang.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.public static final int TEST_FLOW_CONTROL_WINDOW
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 io.grpc.ManagedChannel createChannel()
protected abstract io.grpc.ManagedChannelBuilder<?> createChannelBuilder()
@Nullable protected io.grpc.ClientInterceptor[] getAdditionalInterceptors()
@Nullable protected io.grpc.ServerBuilder<?> getServerBuilder()
null if
it shouldn't start a server in the same process.protected final io.grpc.ClientInterceptor createCensusStatsClientInterceptor()
protected final io.grpc.ServerStreamTracer.Factory createCustomCensusTracerFactory()
protected boolean customCensusModulePresent()
metricsExpected().protected boolean metricsExpected()
public void emptyUnary()
throws java.lang.Exception
java.lang.Exceptionpublic void emptyUnaryWithRetriableStream()
throws java.lang.Exception
java.lang.Exceptionpublic void cacheableUnary()
public void largeUnary()
throws java.lang.Exception
java.lang.Exceptionpublic void clientCompressedUnary(boolean probe)
throws java.lang.Exception
java.lang.Exceptionpublic void serverCompressedUnary()
throws java.lang.Exception
java.lang.Exceptionpublic void pickFirstUnary()
throws java.lang.Exception
java.lang.Exceptionpublic void serverStreaming()
throws java.lang.Exception
java.lang.Exceptionpublic void clientStreaming()
throws java.lang.Exception
java.lang.Exceptionpublic void clientCompressedStreaming(boolean probe)
throws java.lang.Exception
java.lang.Exceptionpublic void serverCompressedStreaming()
throws java.lang.Exception
java.lang.Exceptionpublic void pingPong()
throws java.lang.Exception
java.lang.Exceptionpublic void emptyStream()
throws java.lang.Exception
java.lang.Exceptionpublic void cancelAfterBegin()
throws java.lang.Exception
java.lang.Exceptionpublic void cancelAfterFirstResponse()
throws java.lang.Exception
java.lang.Exceptionpublic void fullDuplexCallShouldSucceed()
throws java.lang.Exception
java.lang.Exceptionpublic void halfDuplexCallShouldSucceed()
throws java.lang.Exception
java.lang.Exceptionpublic void serverStreamingShouldBeFlowControlled()
throws java.lang.Exception
java.lang.Exceptionpublic void veryLargeRequest()
throws java.lang.Exception
java.lang.Exceptionpublic void veryLargeResponse()
throws java.lang.Exception
java.lang.Exceptionpublic void exchangeMetadataUnaryCall()
throws java.lang.Exception
java.lang.Exceptionpublic void exchangeMetadataStreamingCall()
throws java.lang.Exception
java.lang.Exceptionpublic void sendsTimeoutHeader()
public void deadlineNotExceeded()
public void deadlineExceeded()
throws java.lang.Exception
java.lang.Exceptionpublic void deadlineExceededServerStreaming()
throws java.lang.Exception
java.lang.Exceptionpublic void deadlineInPast()
throws java.lang.Exception
java.lang.Exceptionpublic void maxInboundSize_exact()
public void maxInboundSize_tooBig()
public void maxOutboundSize_exact()
public void maxOutboundSize_tooBig()
protected int unaryPayloadLength()
public void gracefulShutdown()
throws java.lang.Exception
java.lang.Exceptionpublic void customMetadata()
throws java.lang.Exception
java.lang.Exceptionpublic void censusContextsPropagated()
public void statusCodeAndMessage()
throws java.lang.Exception
java.lang.Exceptionpublic void specialStatusMessage()
throws java.lang.Exception
java.lang.Exceptionpublic void unimplementedMethod()
public void unimplementedService()
public void timeoutOnSleepingServer()
throws java.lang.Exception
java.lang.Exceptionpublic void getServerAddressAndLocalAddressFromClient()
public void serviceAccountCreds(java.lang.String jsonKey,
java.io.InputStream credentialsStream,
java.lang.String authScope)
throws java.lang.Exception
java.lang.Exceptionpublic void computeEngineCreds(java.lang.String serviceAccount,
java.lang.String oauthScope)
throws java.lang.Exception
java.lang.Exceptionpublic void computeEngineChannelCredentials(java.lang.String defaultServiceAccount,
io.grpc.testing.integration.TestServiceGrpc.TestServiceBlockingStub computeEngineStub)
throws java.lang.Exception
java.lang.Exceptionpublic void jwtTokenCreds(java.io.InputStream serviceAccountJson)
throws java.lang.Exception
java.lang.Exceptionpublic void oauth2AuthToken(java.lang.String jsonKey,
java.io.InputStream credentialsStream,
java.lang.String authScope)
throws java.lang.Exception
java.lang.Exceptionpublic void perRpcCreds(java.lang.String jsonKey,
java.io.InputStream credentialsStream,
java.lang.String oauthScope)
throws java.lang.Exception
java.lang.Exceptionpublic void googleDefaultCredentials(java.lang.String defaultServiceAccount,
io.grpc.testing.integration.TestServiceGrpc.TestServiceBlockingStub googleDefaultStub)
throws java.lang.Exception
java.lang.Exceptionprotected static void assertSuccess(io.grpc.internal.testing.StreamRecorder<?> recorder)
protected java.net.SocketAddress obtainRemoteClientAddr()
ServerCall.getAttributes()protected java.net.SocketAddress obtainRemoteServerAddr()
ClientCall.getAttributes()protected java.net.SocketAddress obtainLocalServerAddr()
ServerCall.getAttributes()protected java.net.SocketAddress obtainLocalClientAddr()
ClientCall.getAttributes()protected void assertX500SubjectDn(java.lang.String tlsInfo)
ServerCall.getAttributes()protected int operationTimeoutMillis()
protected static void assumeEnoughMemory()