Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BROKEN on Windows: Avoid using Jetty ALPN #4857

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,6 @@ for reviewers:
Project maintainers are obligated to squash those commits into one when
merging.

## Running tests

### Jetty ALPN setup for IntelliJ

The tests in interop-testing project require jetty-alpn agent running in the background
otherwise they'll fail. Here are instructions on how to setup IntellJ IDEA to enable running
those tests in IDE:

* Settings -> Build Tools -> Gradle -> Runner -> select Gradle Test Runner
* View -> Tool Windows -> Gradle -> Edit Run Configuration -> Defaults -> JUnit -> Before lauch -> + -> Run Gradle task, enter the task in the build.gradle that sets the javaagent.

Step 1 must be taken, otherwise by the default JUnit Test Runner running a single test in IDE will trigger all the tests.

## Guidelines for Pull Requests
How to get your contributions merged smoothly and quickly.

Expand Down
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