@@ -53,16 +53,51 @@ dependencies {
5353 agent(" io.opentelemetry.javaagent:opentelemetry-javaagent" )
5454}
5555
56- tasks {
57- test {
58- useJUnitPlatform()
59- // Unset relevant environment variables to provide a clean state for the tests
60- environment(" GOOGLE_CLOUD_PROJECT" , " " )
61- environment(" GOOGLE_CLOUD_QUOTA_PROJECT" , " " )
62- // exclude integration test
63- exclude(" io/opentelemetry/contrib/gcp/auth/GcpAuthExtensionEndToEndTest.class" )
56+ testing {
57+ suites {
58+ val test by getting(JvmTestSuite ::class ) {
59+ // Unset relevant environment variables to provide a clean state for the tests
60+ environment(" GOOGLE_CLOUD_PROJECT" , " " )
61+ environment(" GOOGLE_CLOUD_QUOTA_PROJECT" , " " )
62+ // exclude integration test
63+ exclude(" io/opentelemetry/contrib/gcp/auth/GcpAuthExtensionEndToEndTest.class" )
64+ }
65+
66+ val integrationTestUserCreds by registering(JvmTestSuite ::class ) {
67+ dependencies {
68+ implementation(project())
69+ }
70+
71+ dependsOn(tasks.shadowJar)
72+ dependsOn(tasks.named(" copyAgent" ))
73+
74+ // include only the integration test file
75+ include(" io/opentelemetry/contrib/gcp/auth/GcpAuthExtensionEndToEndTest.class" )
76+
77+ val fakeCredsFilePath = project.file(" src/test/resources/fake_user_creds.json" ).absolutePath
78+
79+ environment(" GOOGLE_CLOUD_QUOTA_PROJECT" , " quota-project-id" )
80+ environment(" GOOGLE_APPLICATION_CREDENTIALS" , fakeCredsFilePath)
81+ jvmArgs(
82+ " -javaagent:$javaAgentJarPath " ,
83+ " -Dotel.javaagent.extensions=$authExtensionJarPath " ,
84+ " -Dgoogle.cloud.project=my-gcp-project" ,
85+ " -Dotel.java.global-autoconfigure.enabled=true" ,
86+ " -Dotel.exporter.otlp.endpoint=http://localhost:4318" ,
87+ " -Dotel.resource.providers.gcp.enabled=true" ,
88+ " -Dotel.traces.exporter=otlp" ,
89+ " -Dotel.bsp.schedule.delay=2000" ,
90+ " -Dotel.metrics.exporter=none" ,
91+ " -Dotel.logs.exporter=none" ,
92+ " -Dotel.exporter.otlp.protocol=http/protobuf" ,
93+ " -Dotel.javaagent.debug=false" ,
94+ " -Dmockserver.logLevel=trace"
95+ )
96+ }
6497 }
98+ }
6599
100+ tasks {
66101 shadowJar {
67102 /* *
68103 * Shaded version of this extension is required when using it as a OpenTelemetry Java Agent
@@ -101,35 +136,3 @@ tasks.register<Copy>("copyAgent") {
101136 rename(" opentelemetry-javaagent(.*).jar" , " otel-agent.jar" )
102137 })
103138}
104-
105- tasks.register<Test >(" IntegrationTestUserCreds" ) {
106- testClassesDirs = sourceSets.test.get().output.classesDirs
107- classpath = sourceSets.test.get().runtimeClasspath
108-
109- dependsOn(tasks.shadowJar)
110- dependsOn(tasks.named(" copyAgent" ))
111-
112- useJUnitPlatform()
113- // include only the integration test file
114- include(" io/opentelemetry/contrib/gcp/auth/GcpAuthExtensionEndToEndTest.class" )
115-
116- val fakeCredsFilePath = project.file(" src/test/resources/fake_user_creds.json" ).absolutePath
117-
118- environment(" GOOGLE_CLOUD_QUOTA_PROJECT" , " quota-project-id" )
119- environment(" GOOGLE_APPLICATION_CREDENTIALS" , fakeCredsFilePath)
120- jvmArgs = listOf (
121- " -javaagent:$javaAgentJarPath " ,
122- " -Dotel.javaagent.extensions=$authExtensionJarPath " ,
123- " -Dgoogle.cloud.project=my-gcp-project" ,
124- " -Dotel.java.global-autoconfigure.enabled=true" ,
125- " -Dotel.exporter.otlp.endpoint=http://localhost:4318" ,
126- " -Dotel.resource.providers.gcp.enabled=true" ,
127- " -Dotel.traces.exporter=otlp" ,
128- " -Dotel.bsp.schedule.delay=2000" ,
129- " -Dotel.metrics.exporter=none" ,
130- " -Dotel.logs.exporter=none" ,
131- " -Dotel.exporter.otlp.protocol=http/protobuf" ,
132- " -Dotel.javaagent.debug=false" ,
133- " -Dmockserver.logLevel=trace"
134- )
135- }
0 commit comments