Skip to content

Commit 26fd7f4

Browse files
committed
fix first test
1 parent e49aa18 commit 26fd7f4

File tree

14 files changed

+850
-755
lines changed

14 files changed

+850
-755
lines changed

instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/build.gradle.kts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,9 @@ dependencies {
6060
testLibrary("org.springframework.boot:spring-boot-starter-test:2.0.0.RELEASE")
6161
testLibrary("org.springframework.boot:spring-boot-starter-reactor-netty:2.0.0.RELEASE")
6262

63-
// tests don't work with spring boot 4 yet
64-
latestDepTestLibrary("org.springframework.boot:spring-boot-starter-webflux:3.+") // documented limitation
65-
latestDepTestLibrary("org.springframework.boot:spring-boot-starter-test:3.+") // documented limitation
66-
latestDepTestLibrary("org.springframework.boot:spring-boot-starter-reactor-netty:3.+") // documented limitation
63+
latestDepTestLibrary("org.springframework.boot:spring-boot-starter-webflux:3.+") // see testing-webflux7 module
64+
latestDepTestLibrary("org.springframework.boot:spring-boot-starter-test:3.+") // see testing-webflux7 module
65+
latestDepTestLibrary("org.springframework.boot:spring-boot-starter-reactor-netty:3.+") // see testing-webflux7 module
6766
}
6867

6968
val latestDepTest = findProperty("testLatestDeps") as Boolean

instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/v5_0/server/SpringWebfluxTest.java

Lines changed: 2 additions & 741 deletions
Large diffs are not rendered by default.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
plugins {
2+
id("otel.java-conventions")
3+
id("otel.javaagent-testing")
4+
}
5+
6+
dependencies {
7+
// Register instrumentations with the test agent
8+
testInstrumentation(project(":instrumentation:spring:spring-core-2.0:javaagent"))
9+
testInstrumentation(project(":instrumentation:spring:spring-webflux:spring-webflux-5.0:javaagent"))
10+
testInstrumentation(project(":instrumentation:netty:netty-4.1:javaagent"))
11+
testInstrumentation(project(":instrumentation:reactor:reactor-3.1:javaagent"))
12+
testInstrumentation(project(":instrumentation:reactor:reactor-netty:reactor-netty-1.0:javaagent"))
13+
14+
testImplementation(project(":instrumentation:spring:spring-webflux:spring-webflux-5.0:testing"))
15+
16+
testImplementation("org.springframework.boot:spring-boot-starter-webflux:4.0.0")
17+
testImplementation("org.springframework.boot:spring-boot-starter-test:4.0.0")
18+
testImplementation("org.springframework.boot:spring-boot-starter-reactor-netty:4.0.0")
19+
}
20+
21+
otelJava {
22+
minJavaVersionSupported.set(JavaVersion.VERSION_17)
23+
}
24+
25+
tasks.withType<Test>().configureEach {
26+
// required on jdk17
27+
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
28+
jvmArgs("-XX:+IgnoreUnrecognizedVMOptions")
29+
jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true")
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.javaagent.instrumentation.spring.webflux.v7_0;
7+
8+
import io.opentelemetry.instrumentation.spring.webflux.server.AbstractSpringWebfluxTest;
9+
import org.junit.jupiter.api.extension.ExtendWith;
10+
import org.springframework.boot.reactor.netty.NettyReactiveWebServerFactory;
11+
import org.springframework.boot.test.context.SpringBootTest;
12+
import org.springframework.boot.test.context.TestConfiguration;
13+
import org.springframework.context.annotation.Bean;
14+
import org.springframework.test.context.junit.jupiter.SpringExtension;
15+
import server.SpringWebFluxTestApplication;
16+
17+
@ExtendWith(SpringExtension.class)
18+
@SpringBootTest(
19+
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
20+
classes = {
21+
SpringWebFluxTestApplication.class,
22+
SpringWebfluxTest.ForceNettyAutoConfiguration.class
23+
})
24+
class SpringWebfluxTest extends AbstractSpringWebfluxTest {
25+
@TestConfiguration
26+
static class ForceNettyAutoConfiguration {
27+
@Bean
28+
NettyReactiveWebServerFactory nettyFactory() {
29+
return new NettyReactiveWebServerFactory();
30+
}
31+
}
32+
}

instrumentation/spring/spring-webflux/spring-webflux-5.0/testing/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ dependencies {
88
compileOnly("org.springframework:spring-webflux:5.0.0.RELEASE")
99
compileOnly("org.springframework.boot:spring-boot-starter-reactor-netty:2.0.0.RELEASE")
1010
compileOnly("org.springframework.boot:spring-boot:2.0.0.RELEASE")
11+
compileOnly("org.springframework.boot:spring-boot-starter-test:2.0.0.RELEASE")
1112
}

0 commit comments

Comments
 (0)