|
@@ -33,9 +33,9 @@ import org.junit.jupiter.api.Test;
|
|
import org.junit.jupiter.api.TestMethodOrder;
|
|
import org.junit.jupiter.api.TestMethodOrder;
|
|
import org.springframework.beans.factory.ObjectProvider;
|
|
import org.springframework.beans.factory.ObjectProvider;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
|
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
|
import org.springframework.boot.test.web.client.TestRestTemplate;
|
|
import org.springframework.boot.test.web.client.TestRestTemplate;
|
|
-import org.springframework.boot.test.web.server.LocalServerPort;
|
|
|
|
import org.springframework.boot.web.client.RestTemplateBuilder;
|
|
import org.springframework.boot.web.client.RestTemplateBuilder;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.Configuration;
|
|
@@ -59,9 +59,12 @@ class AbstractOtelSpringStarterSmokeTest extends AbstractSpringStarterSmokeTest
|
|
@Autowired private OtelResourceProperties otelResourceProperties;
|
|
@Autowired private OtelResourceProperties otelResourceProperties;
|
|
@Autowired private OtlpExporterProperties otlpExporterProperties;
|
|
@Autowired private OtlpExporterProperties otlpExporterProperties;
|
|
@Autowired private RestTemplateBuilder restTemplateBuilder;
|
|
@Autowired private RestTemplateBuilder restTemplateBuilder;
|
|
- @LocalServerPort private int port;
|
|
|
|
@Autowired private JdbcTemplate jdbcTemplate;
|
|
@Autowired private JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
|
|
+ // can't use @LocalServerPort annotation since it moved packages between Spring Boot 2 and 3
|
|
|
|
+ @Value("${local.server.port}")
|
|
|
|
+ private int port;
|
|
|
|
+
|
|
@Configuration(proxyBeanMethods = false)
|
|
@Configuration(proxyBeanMethods = false)
|
|
static class TestConfiguration {
|
|
static class TestConfiguration {
|
|
@Autowired private ObjectProvider<JdbcTemplate> jdbcTemplate;
|
|
@Autowired private ObjectProvider<JdbcTemplate> jdbcTemplate;
|
|
@@ -203,10 +206,6 @@ class AbstractOtelSpringStarterSmokeTest extends AbstractSpringStarterSmokeTest
|
|
|
|
|
|
RestTemplate restTemplate = restTemplateBuilder.rootUri("http://localhost:" + port).build();
|
|
RestTemplate restTemplate = restTemplateBuilder.rootUri("http://localhost:" + port).build();
|
|
restTemplate.getForObject(OtelSpringStarterSmokeTestController.PING, String.class);
|
|
restTemplate.getForObject(OtelSpringStarterSmokeTestController.PING, String.class);
|
|
- assertClient();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- protected void assertClient() {
|
|
|
|
testing.waitAndAssertTraces(
|
|
testing.waitAndAssertTraces(
|
|
traceAssert ->
|
|
traceAssert ->
|
|
traceAssert.hasSpansSatisfyingExactly(
|
|
traceAssert.hasSpansSatisfyingExactly(
|