diff options
author | Eric Anderson <ejona@google.com> | 2018-05-02 09:02:00 -0700 |
---|---|---|
committer | Eric Anderson <ejona@google.com> | 2018-05-24 09:51:45 -0700 |
commit | e41e0547769f7ac1b56b9200e9000dc1282f9f08 (patch) | |
tree | c1d736f0d23727059e1110e53b8cc982afd7d3fa /testing | |
parent | 27439876f28858b3293bc0f790d091b5eba36245 (diff) | |
download | grpc-grpc-java-e41e0547769f7ac1b56b9200e9000dc1282f9f08.tar.gz |
Propagate CallCredentials.ATTR_SECURITY_LEVEL from transports
Previously no transport provided the key so CallCredentials would always
see the security as NONE.
Diffstat (limited to 'testing')
-rw-r--r-- | testing/src/main/java/io/grpc/internal/testing/AbstractTransportTest.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/testing/src/main/java/io/grpc/internal/testing/AbstractTransportTest.java b/testing/src/main/java/io/grpc/internal/testing/AbstractTransportTest.java index 6847e7586..2bd2d4570 100644 --- a/testing/src/main/java/io/grpc/internal/testing/AbstractTransportTest.java +++ b/testing/src/main/java/io/grpc/internal/testing/AbstractTransportTest.java @@ -44,6 +44,7 @@ import com.google.common.collect.Lists; import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.SettableFuture; import io.grpc.Attributes; +import io.grpc.CallCredentials; import io.grpc.CallOptions; import io.grpc.ClientStreamTracer; import io.grpc.Grpc; @@ -56,6 +57,7 @@ import io.grpc.internal.Channelz.TransportStats; import io.grpc.internal.ClientStream; import io.grpc.internal.ClientStreamListener; import io.grpc.internal.ClientTransport; +import io.grpc.internal.ConnectionClientTransport; import io.grpc.internal.Instrumented; import io.grpc.internal.InternalServer; import io.grpc.internal.IoUtils; @@ -335,6 +337,19 @@ public abstract class AbstractTransportTest { } @Test + public void checkClientAttributes() throws Exception { + server.start(serverListener); + client = newClientTransport(server); + assumeTrue(client instanceof ConnectionClientTransport); + ConnectionClientTransport connectionClient = (ConnectionClientTransport) client; + startTransport(connectionClient, mockClientTransportListener); + verify(mockClientTransportListener, timeout(TIMEOUT_MS)).transportReady(); + + assertNotNull("security level should be set in client attributes", + connectionClient.getAttributes().get(CallCredentials.ATTR_SECURITY_LEVEL)); + } + + @Test public void serverAlreadyListening() throws Exception { client = null; server.start(serverListener); |