diff options
author | zpencer <spencerfang@google.com> | 2017-11-07 15:01:03 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-07 15:01:03 -0800 |
commit | 2d212646bc13d7663591523bdc5a61fbdd69e508 (patch) | |
tree | 3961dc71f99ec305cb4c8fac6a3b1cd7d44cbf16 /gae-interop-testing | |
parent | 6827f537857133f852ba5b255ea99f6d6c37eca0 (diff) | |
download | grpc-grpc-java-2d212646bc13d7663591523bdc5a61fbdd69e508.tar.gz |
gae-interop-testing: use ManagedChannelBuilder, abort if devserver (#3680)
Turns out the ManagedChannelBuilder was misbehaving because the
devserver launcher ignores the app's jdk7 configuration and uses
whatever jdk is in JAVA_HOME. This is the reason
GrpcUtil.IS_RESTRICTED_APPENGINE was wrong.
Changing JAVA_HOME to point to jdk7 reveals that devservers lack
conscrypt. Adding an explicit check to make sure the jdk7 test is not
running in a dev server.
Diffstat (limited to 'gae-interop-testing')
2 files changed, 27 insertions, 6 deletions
diff --git a/gae-interop-testing/gae-jdk7/src/main/java/io/grpc/testing/integration/OkHttpClientInteropServlet.java b/gae-interop-testing/gae-jdk7/src/main/java/io/grpc/testing/integration/OkHttpClientInteropServlet.java index 8f2dd9305..42255bb9e 100644 --- a/gae-interop-testing/gae-jdk7/src/main/java/io/grpc/testing/integration/OkHttpClientInteropServlet.java +++ b/gae-interop-testing/gae-jdk7/src/main/java/io/grpc/testing/integration/OkHttpClientInteropServlet.java @@ -16,7 +16,11 @@ package io.grpc.testing.integration; +import static junit.framework.TestCase.assertEquals; +import static org.junit.Assert.assertTrue; + import io.grpc.ManagedChannel; +import io.grpc.ManagedChannelBuilder; import io.grpc.okhttp.OkHttpChannelBuilder; import java.io.IOException; import java.io.PrintWriter; @@ -131,9 +135,18 @@ public final class OkHttpClientInteropServlet extends HttpServlet { public static final class Tester extends AbstractInteropTest { @Override protected ManagedChannel createChannel() { - OkHttpChannelBuilder builder = - OkHttpChannelBuilder.forTarget(INTEROP_TEST_ADDRESS) + assertEquals( + "jdk7 required", + "1.7", + System.getProperty("java.specification.version")); + assertEquals( + "Can not run in dev servers because they lack org.conscrypt.OpenSSLProvider support", + "Production", + System.getProperty("com.google.appengine.runtime.environment")); + ManagedChannelBuilder<?> builder = + ManagedChannelBuilder.forTarget(INTEROP_TEST_ADDRESS) .maxInboundMessageSize(AbstractInteropTest.MAX_MESSAGE_SIZE); + assertTrue(builder instanceof OkHttpChannelBuilder); return builder.build(); } diff --git a/gae-interop-testing/gae-jdk8/src/main/java/io/grpc/testing/integration/NettyClientInteropServlet.java b/gae-interop-testing/gae-jdk8/src/main/java/io/grpc/testing/integration/NettyClientInteropServlet.java index d3d29890b..14cab1eda 100644 --- a/gae-interop-testing/gae-jdk8/src/main/java/io/grpc/testing/integration/NettyClientInteropServlet.java +++ b/gae-interop-testing/gae-jdk8/src/main/java/io/grpc/testing/integration/NettyClientInteropServlet.java @@ -16,7 +16,11 @@ package io.grpc.testing.integration; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import io.grpc.ManagedChannel; +import io.grpc.ManagedChannelBuilder; import io.grpc.netty.NettyChannelBuilder; import java.io.IOException; import java.io.PrintWriter; @@ -79,11 +83,15 @@ public final class NettyClientInteropServlet extends HttpServlet { public static final class Tester extends AbstractInteropTest { @Override protected ManagedChannel createChannel() { - NettyChannelBuilder builder = - NettyChannelBuilder.forTarget(INTEROP_TEST_ADDRESS) + assertEquals( + "jdk8 required", + "1.8", + System.getProperty("java.specification.version")); + ManagedChannelBuilder<?> builder = + ManagedChannelBuilder.forTarget(INTEROP_TEST_ADDRESS) .maxInboundMessageSize(AbstractInteropTest.MAX_MESSAGE_SIZE); - - builder.flowControlWindow(65 * 1024); + assertTrue(builder instanceof NettyChannelBuilder); + ((NettyChannelBuilder) builder).flowControlWindow(65 * 1024); return builder.build(); } |