Skip to content
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package co.elastic.apm.agent.embeddedotel;

import co.elastic.apm.agent.embeddedotel.proxy.ProxyMeter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.4.0</version>
<version>3.4.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.4.0</version> <!-- update IT in case of major upgrade -->
<version>3.4.1</version> <!-- update IT in case of major upgrade -->
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package co.elastic.apm.agent.springwebflux;

import co.elastic.apm.agent.testutils.Java17OnlyTest;
import org.junit.jupiter.api.BeforeEach;

public class Spring6ServerAnnotatedInstrumentationTest extends Java17OnlyTest {

Expand All @@ -28,10 +27,5 @@ public Spring6ServerAnnotatedInstrumentationTest() {
}

public static class Impl extends ServerAnnotatedInstrumentationTest {

@BeforeEach
void setUp() {
expectedFrameworkVersion = "6.2.0";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package co.elastic.apm.agent.springwebflux;

import co.elastic.apm.agent.testutils.Java17OnlyTest;
import org.junit.jupiter.api.BeforeEach;

public class Spring6ServerFunctionalInstrumentationTest extends Java17OnlyTest {

Expand All @@ -28,9 +27,5 @@ public Spring6ServerFunctionalInstrumentationTest() {
}

public static class Impl extends ServerFunctionalInstrumentationTest {
@BeforeEach
void setUp() {
expectedFrameworkVersion = "6.2.0";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,9 @@
*/
package co.elastic.apm.agent.springwebflux;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.condition.EnabledForJreRange;
import org.junit.jupiter.api.condition.JRE;

@EnabledForJreRange(min = JRE.JAVA_17)
public class Spring6ServletContainerTest extends ServletContainerTest {

@BeforeEach
void setUp() {
expectedFrameworkVersion = "6.2.0";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.springframework.core.SpringVersion;
import org.springframework.http.codec.ServerSentEvent;
import org.springframework.web.reactive.function.client.WebClientResponseException;
import reactor.core.publisher.Hooks;
Expand All @@ -58,7 +59,6 @@ public abstract class AbstractServerInstrumentationTest extends AbstractInstrume
private static final String BASIC_AUTH_HEADER_VALUE = "Basic ZWxhc3RpYzpjaGFuZ2VtZQ==";

protected static WebFluxApplication.App app;
protected String expectedFrameworkVersion = "5.3.30";
protected GreetingWebClient client;

@BeforeAll
Expand Down Expand Up @@ -134,7 +134,7 @@ private void hello(boolean expectHeaders) {

assertThat(headersCount)
.describedAs("unexpected headers count")
.isEqualTo(6);
.isGreaterThanOrEqualTo(6);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[for reviewer] there is now 7 headers when only 6 were previously reported, here we don't really have a strict assertion on all of them, only a few are expected with specific values as seen in the assertions just below.


assertThat(headers.getFirst("random-value"))
.describedAs("non-standard request headers should be captured")
Expand Down Expand Up @@ -452,11 +452,7 @@ protected ErrorCaptureImpl getFirstError() {
return reporter.getFirstError(200);
}

TransactionImpl checkTransaction(TransactionImpl transaction, String expectedName, String expectedMethod, int expectedStatus) {
return checkTransaction(transaction, expectedName, expectedMethod, expectedStatus, expectedFrameworkVersion);
}

static TransactionImpl checkTransaction(TransactionImpl transaction, String expectedName, String expectedMethod, int expectedStatus, String expectedFrameworkVersion) {
static TransactionImpl checkTransaction(TransactionImpl transaction, String expectedName, String expectedMethod, int expectedStatus) {
assertThat(transaction.getType()).isEqualTo("request");
assertThat(transaction.getNameAsString()).isEqualTo(expectedName);

Expand All @@ -473,7 +469,8 @@ static TransactionImpl checkTransaction(TransactionImpl transaction, String expe
.isEqualTo("Spring Webflux");

assertThat(transaction.getFrameworkVersion())
.isEqualTo(expectedFrameworkVersion);
.isNotBlank()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#3936 added hard-coded versions to the tests, which would bite us on every version bump. With this change we still check for the version, but use spring itself to get the expected value.

.isEqualTo(SpringVersion.getVersion());

return transaction;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public class ServletContainerTest extends AbstractInstrumentationTest {

protected static WebFluxApplication.App app;
protected static GreetingWebClient client;
protected String expectedFrameworkVersion = "5.3.30";

@BeforeAll
static void startApp() {
Expand Down Expand Up @@ -75,7 +74,7 @@ void shouldOnlyCreateOneTransaction() throws InterruptedException {
TransactionImpl transaction = reporter.getFirstTransaction(200);

// transaction naming should be set by webflux instrumentation
AbstractServerInstrumentationTest.checkTransaction(transaction, "GET /functional/with-parameters/{id}", "GET", 200, expectedFrameworkVersion);
AbstractServerInstrumentationTest.checkTransaction(transaction, "GET /functional/with-parameters/{id}", "GET", 200);

// transaction HTTP part should be provided by servlet instrumentation
AbstractServerInstrumentationTest.checkUrl(client, transaction, "/with-parameters/42");
Expand Down
2 changes: 1 addition & 1 deletion apm-agent-plugins/apm-spring-webflux/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<!-- spring boot version to use for dependency management & testing -->
<version.spring-boot-2>2.7.16</version.spring-boot-2>
<version.spring-boot-3>3.4.0</version.spring-boot-3>
<version.spring-boot-3>3.4.1</version.spring-boot-3>
</properties>

<modules>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.4.0</version> <!-- must be 3.X to correspond to spring 6 -->
<version>3.4.1</version> <!-- must be 3.X to correspond to spring 6 -->
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
2 changes: 1 addition & 1 deletion apm-agent-plugins/apm-spring-webmvc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.4.0</version> <!-- must be 3.X to correspond to spring 6 -->
<version>3.4.1</version> <!-- must be 3.X to correspond to spring 6 -->
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/spring-boot-3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.4.0</version>
<version>3.4.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Loading