Skip to content

Commit

Permalink
Avoid using Jetty ALPN
Browse files Browse the repository at this point in the history
We still want Netty to test that it continues working with Jetty ALPN,
but otherwise we don't want to use it.

Fixes grpc#2266
  • Loading branch information
ejona86 committed Sep 30, 2019
1 parent 0be86a5 commit d71e174
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 30 deletions.
11 changes: 1 addition & 10 deletions benchmarks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies {
libraries.netty_epoll,
libraries.math
compileOnly libraries.javax_annotation
alpnagent libraries.jetty_alpn_agent
runtime libraries.conscrypt
}

import net.ltgt.gradle.errorprone.CheckSeverity
Expand All @@ -59,19 +59,13 @@ def vmArgs = [
task qps_client(type: CreateStartScripts) {
mainClassName = "io.grpc.benchmarks.qps.AsyncClient"
applicationName = "qps_client"
defaultJvmOpts = [
"-javaagent:" + configurations.alpnagent.asPath
].plus(vmArgs)
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
}

task openloop_client(type: CreateStartScripts) {
mainClassName = "io.grpc.benchmarks.qps.OpenLoopClient"
applicationName = "openloop_client"
defaultJvmOpts = [
"-javaagent:" + configurations.alpnagent.asPath
].plus(vmArgs)
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
}
Expand All @@ -86,9 +80,6 @@ task qps_server(type: CreateStartScripts) {
task benchmark_worker(type: CreateStartScripts) {
mainClassName = "io.grpc.benchmarks.driver.LoadWorker"
applicationName = "benchmark_worker"
defaultJvmOpts = [
"-javaagent:" + configurations.alpnagent.asPath
].plus(vmArgs)
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.grpc.benchmarks.proto.Control.ServerArgs;
import io.grpc.benchmarks.proto.Control.ServerArgs.ArgtypeCase;
import io.grpc.benchmarks.proto.WorkerServiceGrpc;
import io.grpc.internal.testing.TestUtils;
import io.grpc.netty.NettyServerBuilder;
import io.grpc.stub.StreamObserver;
import io.netty.channel.nio.NioEventLoopGroup;
Expand Down Expand Up @@ -107,6 +108,10 @@ public static void main(String[] args) throws Exception {
+ "\n Port to start load servers on. Defaults to any available port");
System.exit(1);
}

// Let Netty or OkHttp use Conscrypt if it is available.
TestUtils.installConscryptIfAvailable();

LoadWorker loadWorker = new LoadWorker(driverPort, serverPort);
loadWorker.start();
loadWorker.driverServer.awaitTermination();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import io.grpc.benchmarks.proto.Messages.Payload;
import io.grpc.benchmarks.proto.Messages.SimpleRequest;
import io.grpc.benchmarks.proto.Messages.SimpleResponse;
import io.grpc.internal.testing.TestUtils;
import io.grpc.stub.StreamObserver;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -303,6 +304,8 @@ private static void shutdown(List<ManagedChannel> channels) {
* checkstyle complains if there is no javadoc comment here.
*/
public static void main(String... args) throws Exception {
// Let Netty or OkHttp use Conscrypt if it is available.
TestUtils.installConscryptIfAvailable();
ClientConfiguration.Builder configBuilder = ClientConfiguration.newBuilder(
ADDRESS, CHANNELS, OUTSTANDING_RPCS, CLIENT_PAYLOAD, SERVER_PAYLOAD,
TLS, TESTCA, TRANSPORT, DURATION, WARMUP_DURATION, DIRECTEXECUTOR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class AsyncServer {
* checkstyle complains if there is no javadoc comment here.
*/
public static void main(String... args) throws Exception {
// Let Netty or OkHttp use Conscrypt if it is available.
TestUtils.installConscryptIfAvailable();
new AsyncServer().run(args);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import io.grpc.benchmarks.proto.BenchmarkServiceGrpc;
import io.grpc.benchmarks.proto.Messages.SimpleRequest;
import io.grpc.benchmarks.proto.Messages.SimpleResponse;
import io.grpc.internal.testing.TestUtils;
import io.grpc.stub.StreamObserver;
import java.util.Random;
import java.util.concurrent.Callable;
Expand All @@ -63,6 +64,8 @@ public OpenLoopClient(ClientConfiguration config) {
* Comment for checkstyle.
*/
public static void main(String... args) throws Exception {
// Let Netty or OkHttp use Conscrypt if it is available.
TestUtils.installConscryptIfAvailable();
ClientConfiguration.Builder configBuilder = ClientConfiguration.newBuilder(
ADDRESS, TARGET_QPS, CLIENT_PAYLOAD, SERVER_PAYLOAD, TLS,
TESTCA, TRANSPORT, DURATION, SAVE_HISTOGRAM, FLOW_CONTROL_WINDOW);
Expand Down
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ subprojects {
]
}

// Define a separate configuration for managing the dependency on Jetty ALPN agent.
configurations {
compile {
// Detect Maven Enforcer's dependencyConvergence failures. We only
Expand Down
21 changes: 2 additions & 19 deletions interop-testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ plugins {
description = "gRPC: Integration Testing"
startScripts.enabled = false

configurations {
alpnagent
}

dependencies {
compile project(':grpc-alts'),
project(':grpc-auth'),
Expand All @@ -28,10 +24,10 @@ dependencies {
compileOnly libraries.javax_annotation
runtime libraries.opencensus_impl,
libraries.netty_tcnative,
project(':grpc-grpclb')
project(':grpc-grpclb'),
libraries.conscrypt // for OkHttp
testCompile project(':grpc-context').sourceSets.test.output,
libraries.mockito
alpnagent libraries.jetty_alpn_agent
}

configureProtoCompilation()
Expand All @@ -43,27 +39,14 @@ compileJava {
options.errorprone.check("BetaApi", CheckSeverity.OFF)
}

test {
// For the automated tests, use Jetty ALPN.
jvmArgs "-javaagent:" + configurations.alpnagent.asPath
}

// For the generated scripts, use Netty tcnative (i.e. OpenSSL).
// Note that OkHttp currently only supports ALPN, so OpenSSL version >= 1.0.2 is required.

task test_client(type: CreateStartScripts) {
mainClassName = "io.grpc.testing.integration.TestServiceClient"
applicationName = "test-client"
defaultJvmOpts = [
"-javaagent:JAVAAGENT_APP_HOME" + configurations.alpnagent.singleFile.name
]
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + configurations.runtime
dependencies { runtime configurations.alpnagent }
doLast {
unixScript.text = unixScript.text.replace('JAVAAGENT_APP_HOME', '\$APP_HOME/lib/')
windowsScript.text = windowsScript.text.replace('JAVAAGENT_APP_HOME', '%APP_HOME%\\lib\\')
}
}

task test_server(type: CreateStartScripts) {
Expand Down

0 comments on commit d71e174

Please sign in to comment.