use @LocalManagementPort (#1119)
This commit is contained in:
@@ -20,9 +20,9 @@ import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.server.LocalManagementPort;
|
||||
import org.springframework.cloud.kubernetes.client.example.App;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
@@ -42,7 +42,7 @@ class ActuatorDisabledHealthTest {
|
||||
@Autowired
|
||||
private WebTestClient webClient;
|
||||
|
||||
@Value("${local.server.port}")
|
||||
@LocalManagementPort
|
||||
private int port;
|
||||
|
||||
@Test
|
||||
|
||||
@@ -20,9 +20,9 @@ import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.server.LocalManagementPort;
|
||||
import org.springframework.cloud.kubernetes.client.example.App;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
@@ -39,7 +39,7 @@ class ActuatorEnabledHealthTest {
|
||||
@Autowired
|
||||
private ReactiveHealthContributorRegistry registry;
|
||||
|
||||
@Value("${local.server.port}")
|
||||
@LocalManagementPort
|
||||
private int port;
|
||||
|
||||
@Test
|
||||
|
||||
@@ -23,8 +23,8 @@ import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.server.LocalManagementPort;
|
||||
import org.springframework.cloud.kubernetes.example.App;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
@@ -39,7 +39,7 @@ class Fabric8HealthIndicatorDisabledTest {
|
||||
@Autowired
|
||||
private WebTestClient webClient;
|
||||
|
||||
@Value("${local.server.port}")
|
||||
@LocalManagementPort
|
||||
private int port;
|
||||
|
||||
@BeforeAll
|
||||
|
||||
@@ -26,8 +26,8 @@ import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.server.LocalManagementPort;
|
||||
import org.springframework.cloud.kubernetes.commons.PodUtils;
|
||||
import org.springframework.cloud.kubernetes.example.App;
|
||||
import org.springframework.cloud.kubernetes.fabric8.Fabric8HealthIndicator;
|
||||
@@ -51,7 +51,7 @@ class Fabric8InsideHealthIndicatorTest {
|
||||
@Autowired
|
||||
private WebTestClient webClient;
|
||||
|
||||
@Value("${local.server.port}")
|
||||
@LocalManagementPort
|
||||
private int port;
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,8 +24,8 @@ import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.server.LocalManagementPort;
|
||||
import org.springframework.cloud.kubernetes.example.App;
|
||||
import org.springframework.cloud.kubernetes.fabric8.Fabric8PodUtils;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -48,7 +48,7 @@ class Fabric8InsideInfoContributorTest {
|
||||
@Autowired
|
||||
private WebTestClient webClient;
|
||||
|
||||
@Value("${local.server.port}")
|
||||
@LocalManagementPort
|
||||
private int port;
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,8 +24,8 @@ import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.server.LocalManagementPort;
|
||||
import org.springframework.cloud.kubernetes.example.App;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
@@ -40,7 +40,7 @@ class Fabric8NotInsideHealthIndicatorTest {
|
||||
@Autowired
|
||||
private WebTestClient webClient;
|
||||
|
||||
@Value("${local.server.port}")
|
||||
@LocalManagementPort
|
||||
private int port;
|
||||
|
||||
@BeforeAll
|
||||
|
||||
@@ -21,8 +21,8 @@ import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.server.LocalManagementPort;
|
||||
import org.springframework.cloud.kubernetes.example.App;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
@@ -38,7 +38,7 @@ class Fabric8NotInsideInfoContributorTest {
|
||||
@Autowired
|
||||
private WebTestClient webClient;
|
||||
|
||||
@Value("${local.server.port}")
|
||||
@LocalManagementPort
|
||||
private int port;
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,8 +23,8 @@ import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.server.LocalManagementPort;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
@@ -36,7 +36,7 @@ class HealthIndicatorTest {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@Value("${local.server.port}")
|
||||
@LocalManagementPort
|
||||
private int port;
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -20,9 +20,9 @@ import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.server.LocalManagementPort;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
@@ -42,7 +42,7 @@ class DisabledHealthTest {
|
||||
@Autowired
|
||||
private WebTestClient webClient;
|
||||
|
||||
@Value("${local.server.port}")
|
||||
@LocalManagementPort
|
||||
private int port;
|
||||
|
||||
@Test
|
||||
|
||||
@@ -20,9 +20,9 @@ import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.server.LocalManagementPort;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
@@ -42,7 +42,7 @@ class EnabledHealthTest {
|
||||
@Autowired
|
||||
private ReactiveHealthContributorRegistry registry;
|
||||
|
||||
@Value("${local.server.port}")
|
||||
@LocalManagementPort
|
||||
private int port;
|
||||
|
||||
@Test
|
||||
|
||||
@@ -21,10 +21,10 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringBootConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.server.LocalManagementPort;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
@@ -37,7 +37,7 @@ import static org.hamcrest.Matchers.containsString;
|
||||
"management.info.kubernetes.enabled=true" })
|
||||
public class Fabric8LeaderAutoConfigurationTests {
|
||||
|
||||
@Value("${local.server.port}")
|
||||
@LocalManagementPort
|
||||
private int port;
|
||||
|
||||
@Autowired
|
||||
|
||||
Reference in New Issue
Block a user