mirror of https://github.com/grpc/grpc-java.git
interop-test: orca test change gradle dependency to xds non-shaded to allow bazel run (#9230)
Co-authored-by: Eric Anderson <ejona@google.com>
This commit is contained in:
parent
a206cda1a8
commit
3624d59b18
|
|
@ -3,11 +3,14 @@ plugins {
|
||||||
id "java"
|
id "java"
|
||||||
id "maven-publish"
|
id "maven-publish"
|
||||||
|
|
||||||
|
id "com.github.johnrengelman.shadow"
|
||||||
id "com.google.protobuf"
|
id "com.google.protobuf"
|
||||||
}
|
}
|
||||||
|
|
||||||
description = "gRPC: Integration Testing"
|
description = "gRPC: Integration Testing"
|
||||||
startScripts.enabled = false
|
startShadowScripts.enabled = false
|
||||||
|
installDist.dependsOn(installShadowDist)
|
||||||
|
installDist.enabled = false
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
alpnagent
|
alpnagent
|
||||||
|
|
@ -26,13 +29,16 @@ dependencies {
|
||||||
project(':grpc-services'),
|
project(':grpc-services'),
|
||||||
project(':grpc-stub'),
|
project(':grpc-stub'),
|
||||||
project(':grpc-testing'),
|
project(':grpc-testing'),
|
||||||
project(path: ':grpc-xds', configuration: 'shadow'),
|
|
||||||
libraries.hdrhistogram,
|
libraries.hdrhistogram,
|
||||||
libraries.junit,
|
libraries.junit,
|
||||||
libraries.truth,
|
libraries.truth,
|
||||||
libraries.opencensus_contrib_grpc_metrics,
|
libraries.opencensus_contrib_grpc_metrics,
|
||||||
libraries.google_auth_oauth2_http
|
libraries.google_auth_oauth2_http
|
||||||
|
def xdsDependency = implementation project(':grpc-xds')
|
||||||
|
|
||||||
compileOnly libraries.javax_annotation
|
compileOnly libraries.javax_annotation
|
||||||
|
shadow configurations.implementation.getDependencies().minus(xdsDependency)
|
||||||
|
shadow project(path: ':grpc-xds', configuration: 'shadow')
|
||||||
// TODO(sergiitk): replace with com.google.cloud:google-cloud-logging
|
// TODO(sergiitk): replace with com.google.cloud:google-cloud-logging
|
||||||
// Used instead of google-cloud-logging because it's failing
|
// Used instead of google-cloud-logging because it's failing
|
||||||
// due to a circular dependency on grpc.
|
// due to a circular dependency on grpc.
|
||||||
|
|
@ -60,6 +66,19 @@ compileJava {
|
||||||
// This isn't a library; it can use beta APIs
|
// This isn't a library; it can use beta APIs
|
||||||
options.errorprone.check("BetaApi", CheckSeverity.OFF)
|
options.errorprone.check("BetaApi", CheckSeverity.OFF)
|
||||||
}
|
}
|
||||||
|
jar {
|
||||||
|
// Must use a different archiveClassifier to avoid conflicting with shadowJar
|
||||||
|
archiveClassifier = 'original'
|
||||||
|
}
|
||||||
|
|
||||||
|
def xdsPrefixName = 'io.grpc.xds'
|
||||||
|
shadowJar {
|
||||||
|
archiveClassifier = null
|
||||||
|
dependencies {
|
||||||
|
exclude(dependency {true})
|
||||||
|
}
|
||||||
|
relocate 'com.github.xds', "${xdsPrefixName}.shaded.com.github.xds"
|
||||||
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
// For the automated tests, use Jetty ALPN.
|
// For the automated tests, use Jetty ALPN.
|
||||||
|
|
@ -69,6 +88,8 @@ test {
|
||||||
// For the generated scripts, use Netty tcnative (i.e. OpenSSL).
|
// 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.
|
// Note that OkHttp currently only supports ALPN, so OpenSSL version >= 1.0.2 is required.
|
||||||
|
|
||||||
|
var startScriptsClasspath = shadowJar.outputs.files + configurations.shadow
|
||||||
|
|
||||||
task test_client(type: CreateStartScripts) {
|
task test_client(type: CreateStartScripts) {
|
||||||
mainClass = "io.grpc.testing.integration.TestServiceClient"
|
mainClass = "io.grpc.testing.integration.TestServiceClient"
|
||||||
applicationName = "test-client"
|
applicationName = "test-client"
|
||||||
|
|
@ -76,7 +97,7 @@ task test_client(type: CreateStartScripts) {
|
||||||
"-javaagent:JAVAAGENT_APP_HOME" + configurations.alpnagent.singleFile.name
|
"-javaagent:JAVAAGENT_APP_HOME" + configurations.alpnagent.singleFile.name
|
||||||
]
|
]
|
||||||
outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
|
outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
|
||||||
classpath = startScripts.classpath
|
classpath = startScriptsClasspath
|
||||||
doLast {
|
doLast {
|
||||||
unixScript.text = unixScript.text.replace('JAVAAGENT_APP_HOME', '\'"\$APP_HOME"\'/lib/')
|
unixScript.text = unixScript.text.replace('JAVAAGENT_APP_HOME', '\'"\$APP_HOME"\'/lib/')
|
||||||
windowsScript.text = windowsScript.text.replace('JAVAAGENT_APP_HOME', '%APP_HOME%\\lib\\')
|
windowsScript.text = windowsScript.text.replace('JAVAAGENT_APP_HOME', '%APP_HOME%\\lib\\')
|
||||||
|
|
@ -87,21 +108,21 @@ task test_server(type: CreateStartScripts) {
|
||||||
mainClass = "io.grpc.testing.integration.TestServiceServer"
|
mainClass = "io.grpc.testing.integration.TestServiceServer"
|
||||||
applicationName = "test-server"
|
applicationName = "test-server"
|
||||||
outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
|
outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
|
||||||
classpath = startScripts.classpath
|
classpath = startScriptsClasspath
|
||||||
}
|
}
|
||||||
|
|
||||||
task reconnect_test_client(type: CreateStartScripts) {
|
task reconnect_test_client(type: CreateStartScripts) {
|
||||||
mainClass = "io.grpc.testing.integration.ReconnectTestClient"
|
mainClass = "io.grpc.testing.integration.ReconnectTestClient"
|
||||||
applicationName = "reconnect-test-client"
|
applicationName = "reconnect-test-client"
|
||||||
outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
|
outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
|
||||||
classpath = startScripts.classpath
|
classpath = startScriptsClasspath
|
||||||
}
|
}
|
||||||
|
|
||||||
task stresstest_client(type: CreateStartScripts) {
|
task stresstest_client(type: CreateStartScripts) {
|
||||||
mainClass = "io.grpc.testing.integration.StressTestClient"
|
mainClass = "io.grpc.testing.integration.StressTestClient"
|
||||||
applicationName = "stresstest-client"
|
applicationName = "stresstest-client"
|
||||||
outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
|
outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
|
||||||
classpath = startScripts.classpath
|
classpath = startScriptsClasspath
|
||||||
defaultJvmOpts = [
|
defaultJvmOpts = [
|
||||||
"-verbose:gc",
|
"-verbose:gc",
|
||||||
"-XX:+PrintFlagsFinal"
|
"-XX:+PrintFlagsFinal"
|
||||||
|
|
@ -112,14 +133,14 @@ task http2_client(type: CreateStartScripts) {
|
||||||
mainClass = "io.grpc.testing.integration.Http2Client"
|
mainClass = "io.grpc.testing.integration.Http2Client"
|
||||||
applicationName = "http2-client"
|
applicationName = "http2-client"
|
||||||
outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
|
outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
|
||||||
classpath = startScripts.classpath
|
classpath = startScriptsClasspath
|
||||||
}
|
}
|
||||||
|
|
||||||
task grpclb_long_lived_affinity_test_client(type: CreateStartScripts) {
|
task grpclb_long_lived_affinity_test_client(type: CreateStartScripts) {
|
||||||
mainClass = "io.grpc.testing.integration.GrpclbLongLivedAffinityTestClient"
|
mainClass = "io.grpc.testing.integration.GrpclbLongLivedAffinityTestClient"
|
||||||
applicationName = "grpclb-long-lived-affinity-test-client"
|
applicationName = "grpclb-long-lived-affinity-test-client"
|
||||||
outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
|
outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
|
||||||
classpath = startScripts.classpath
|
classpath = startScriptsClasspath
|
||||||
defaultJvmOpts = [
|
defaultJvmOpts = [
|
||||||
"-Dio.grpc.internal.DnsNameResolverProvider.enable_service_config=true"
|
"-Dio.grpc.internal.DnsNameResolverProvider.enable_service_config=true"
|
||||||
]
|
]
|
||||||
|
|
@ -129,7 +150,7 @@ task grpclb_fallback_test_client (type: CreateStartScripts) {
|
||||||
mainClass = "io.grpc.testing.integration.GrpclbFallbackTestClient"
|
mainClass = "io.grpc.testing.integration.GrpclbFallbackTestClient"
|
||||||
applicationName = "grpclb-fallback-test-client"
|
applicationName = "grpclb-fallback-test-client"
|
||||||
outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
|
outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
|
||||||
classpath = startScripts.classpath
|
classpath = startScriptsClasspath
|
||||||
defaultJvmOpts = [
|
defaultJvmOpts = [
|
||||||
"-Dio.grpc.internal.DnsNameResolverProvider.enable_service_config=true"
|
"-Dio.grpc.internal.DnsNameResolverProvider.enable_service_config=true"
|
||||||
]
|
]
|
||||||
|
|
@ -139,17 +160,17 @@ task xds_test_client(type: CreateStartScripts) {
|
||||||
mainClass = "io.grpc.testing.integration.XdsTestClient"
|
mainClass = "io.grpc.testing.integration.XdsTestClient"
|
||||||
applicationName = "xds-test-client"
|
applicationName = "xds-test-client"
|
||||||
outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
|
outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
|
||||||
classpath = startScripts.classpath
|
classpath = startScriptsClasspath
|
||||||
}
|
}
|
||||||
|
|
||||||
task xds_test_server(type: CreateStartScripts) {
|
task xds_test_server(type: CreateStartScripts) {
|
||||||
mainClass = "io.grpc.testing.integration.XdsTestServer"
|
mainClass = "io.grpc.testing.integration.XdsTestServer"
|
||||||
applicationName = "xds-test-server"
|
applicationName = "xds-test-server"
|
||||||
outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
|
outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
|
||||||
classpath = startScripts.classpath
|
classpath = startScriptsClasspath
|
||||||
}
|
}
|
||||||
|
|
||||||
applicationDistribution.into("bin") {
|
distributions.shadow.contents.into("bin") {
|
||||||
from(test_client)
|
from(test_client)
|
||||||
from(test_server)
|
from(test_server)
|
||||||
from(reconnect_test_client)
|
from(reconnect_test_client)
|
||||||
|
|
@ -162,15 +183,23 @@ applicationDistribution.into("bin") {
|
||||||
fileMode = 0755
|
fileMode = 0755
|
||||||
}
|
}
|
||||||
|
|
||||||
applicationDistribution.into("lib") {
|
distributions.shadow.contents.into("lib") {
|
||||||
from(configurations.alpnagent)
|
from(configurations.alpnagent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
distributions.shadow.distributionBaseName = project.name
|
||||||
|
// to please shadowJar
|
||||||
|
mainClassName = 'io.grpc.testing.integration.TestServiceClient'
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
maven(MavenPublication) {
|
maven(MavenPublication) {
|
||||||
artifact distZip
|
// We want this to throw an exception if it isn't working
|
||||||
artifact distTar
|
def originalJar = artifacts.find { dep -> dep.classifier == 'original'}
|
||||||
|
artifacts.remove(originalJar)
|
||||||
|
|
||||||
|
artifact shadowDistZip
|
||||||
|
artifact shadowDistTar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ package io.grpc.testing.integration;
|
||||||
import static io.grpc.testing.integration.AbstractInteropTest.ORCA_OOB_REPORT_KEY;
|
import static io.grpc.testing.integration.AbstractInteropTest.ORCA_OOB_REPORT_KEY;
|
||||||
import static io.grpc.testing.integration.AbstractInteropTest.ORCA_RPC_REPORT_KEY;
|
import static io.grpc.testing.integration.AbstractInteropTest.ORCA_RPC_REPORT_KEY;
|
||||||
|
|
||||||
|
import com.github.xds.data.orca.v3.OrcaLoadReport;
|
||||||
import io.grpc.ConnectivityState;
|
import io.grpc.ConnectivityState;
|
||||||
import io.grpc.LoadBalancer;
|
import io.grpc.LoadBalancer;
|
||||||
import io.grpc.LoadBalancerProvider;
|
import io.grpc.LoadBalancerProvider;
|
||||||
|
|
@ -28,7 +29,6 @@ import io.grpc.util.ForwardingLoadBalancer;
|
||||||
import io.grpc.util.ForwardingLoadBalancerHelper;
|
import io.grpc.util.ForwardingLoadBalancerHelper;
|
||||||
import io.grpc.xds.orca.OrcaOobUtil;
|
import io.grpc.xds.orca.OrcaOobUtil;
|
||||||
import io.grpc.xds.orca.OrcaPerRequestUtil;
|
import io.grpc.xds.orca.OrcaPerRequestUtil;
|
||||||
import io.grpc.xds.shaded.com.github.xds.data.orca.v3.OrcaLoadReport;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue