Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions spring-cloud-kubernetes-client-autoconfig/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@
<artifactId>spring-cloud-kubernetes-test-support</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-webtestclient</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.health.registry.ReactiveHealthContributorRegistry;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.test.LocalManagementPort;
import org.springframework.boot.test.web.server.LocalManagementPort;
import org.springframework.boot.webtestclient.AutoConfigureWebTestClient;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;

Expand All @@ -33,6 +34,7 @@
properties = { "management.health.kubernetes.enabled=false", "management.endpoint.health.show-details=always",
"management.endpoint.health.show-components=always", "spring.main.cloud-platform=KUBERNETES",
"management.endpoints.web.exposure.include=health" })
@AutoConfigureWebTestClient
class ActuatorDisabledHealthTest {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.health.registry.HealthContributorRegistry;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.test.LocalManagementPort;
import org.springframework.boot.test.web.server.LocalManagementPort;
import org.springframework.boot.webtestclient.AutoConfigureWebTestClient;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApp.class,
properties = { "management.health.kubernetes.enabled=true", "management.endpoint.health.show-details=always",
"management.endpoint.health.show-components=always", "management.endpoints.web.exposure.include=health",
"spring.main.cloud-platform=KUBERNETES" })
@AutoConfigureWebTestClient
class ActuatorEnabledHealthTest {

@Autowired
Expand Down
5 changes: 5 additions & 0 deletions spring-cloud-kubernetes-client-config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@
<artifactId>spring-boot-starter-aspectj</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-webtestclient</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.junit.jupiter.api.Test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.webtestclient.AutoConfigureWebTestClient;
import org.springframework.test.web.reactive.server.WebTestClient;

/**
Expand All @@ -31,6 +32,7 @@
*
* @author wind57
*/
@AutoConfigureWebTestClient
abstract class LabeledConfigMapWithPrefixTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.junit.jupiter.api.Test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.webtestclient.AutoConfigureWebTestClient;
import org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_profile.properties.Blue;
import org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_profile.properties.Green;
import org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_profile.properties.GreenK8s;
Expand All @@ -38,6 +39,7 @@
*
* @author wind57
*/
@AutoConfigureWebTestClient
abstract class LabeledConfigMapWithProfileTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.junit.jupiter.api.Test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.webtestclient.AutoConfigureWebTestClient;
import org.springframework.cloud.kubernetes.client.config.bootstrap.stubs.LabeledSecretWithPrefixConfigurationStub;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.web.reactive.server.WebTestClient;
Expand All @@ -33,6 +34,7 @@
* @author wind57
*/
@TestPropertySource(properties = "spring.cloud.kubernetes.secrets.enabled=true")
@AutoConfigureWebTestClient
abstract class LabeledSecretWithPrefixTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.junit.jupiter.api.Test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.webtestclient.AutoConfigureWebTestClient;
import org.springframework.test.web.reactive.server.WebTestClient;

/**
Expand All @@ -31,6 +32,7 @@
*
* @author wind57
*/
@AutoConfigureWebTestClient
abstract class NamedConfigMapWithPrefixTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.junit.jupiter.api.Test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.webtestclient.AutoConfigureWebTestClient;
import org.springframework.test.web.reactive.server.WebTestClient;

/**
Expand All @@ -31,6 +32,7 @@
*
* @author wind57
*/
@AutoConfigureWebTestClient
abstract class NamedConfigMapWithProfileTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.junit.jupiter.api.Test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.webtestclient.AutoConfigureWebTestClient;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.web.reactive.server.WebTestClient;

Expand All @@ -33,6 +34,7 @@
* @author wind57
*/
@TestPropertySource(properties = "spring.cloud.kubernetes.secrets.enabled=true")
@AutoConfigureWebTestClient
abstract class NamedSecretWithPrefixTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.junit.jupiter.api.Test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.webtestclient.AutoConfigureWebTestClient;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.web.reactive.server.WebTestClient;

Expand All @@ -33,6 +34,7 @@
* @author wind57
*/
@TestPropertySource(properties = "spring.cloud.kubernetes.secrets.enabled=true")
@AutoConfigureWebTestClient
abstract class NamedSecretWithProfileTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.junit.jupiter.api.Test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.webtestclient.AutoConfigureWebTestClient;
import org.springframework.test.web.reactive.server.WebTestClient;

/**
Expand All @@ -34,6 +35,7 @@
* issue: https://github.com/spring-cloud/spring-cloud-kubernetes/issues/640
*
*/
@AutoConfigureWebTestClient
abstract class SingleSourceMultipleFilesTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import org.mockito.MockedStatic;
import org.mockito.Mockito;

import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.webtestclient.AutoConfigureWebTestClient;
import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
import org.springframework.test.context.junit.jupiter.SpringExtension;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import org.junit.jupiter.api.extension.ExtendWith;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.webtestclient.AutoConfigureWebTestClient;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.reactive.server.WebTestClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.endpoint.SanitizableData;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.test.LocalManagementPort;
import org.springframework.boot.test.web.server.LocalManagementPort;
import org.springframework.boot.webtestclient.AutoConfigureWebTestClient;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;

Expand All @@ -36,6 +37,7 @@ class BootstrapKubernetesClientSanitizeConfigpropsEndpointTests {
"management.endpoints.web.exposure.include=*", "spring.cloud.bootstrap.name=sanitize",
"bootstrap.sanitize=true", "spring.cloud.kubernetes.client.namespace=test",
"spring.cloud.kubernetes.secrets.enabled=true" })
@AutoConfigureWebTestClient
@Nested
class DefaultSettingsTest {

Expand Down Expand Up @@ -94,6 +96,7 @@ void test() {
"management.endpoints.web.exposure.include=*", "spring.cloud.bootstrap.name=sanitize",
"management.endpoint.configprops.show-values=NEVER", "bootstrap.sanitize=true",
"spring.cloud.kubernetes.client.namespace=test", "spring.cloud.kubernetes.secrets.enabled=true" })
@AutoConfigureWebTestClient
@Nested
class ExplicitNever {

Expand Down Expand Up @@ -166,6 +169,7 @@ void test() {
"management.endpoint.configprops.show-values=ALWAYS",
"spring.cloud.kubernetes.sanitize.secrets=false", "bootstrap.sanitize=true",
"spring.cloud.kubernetes.client.namespace=test", "spring.cloud.kubernetes.secrets.enabled=true" })
@AutoConfigureWebTestClient
@Nested
class AlwaysWithoutSanitizingFunction {

Expand Down Expand Up @@ -238,6 +242,7 @@ void test() {
"management.endpoint.configprops.show-values=ALWAYS",
"spring.cloud.kubernetes.sanitize.secrets=true", "bootstrap.sanitize=true",
"spring.cloud.kubernetes.client.namespace=test", "spring.cloud.kubernetes.secrets.enabled=true" })
@AutoConfigureWebTestClient
@Nested
class AlwaysWithSanitizingFunction {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.endpoint.SanitizableData;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.test.LocalManagementPort;
import org.springframework.boot.test.web.server.LocalManagementPort;
import org.springframework.boot.webtestclient.AutoConfigureWebTestClient;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;

Expand All @@ -36,6 +37,7 @@ class BootstrapKubernetesClientSanitizeEnvEndpointTests {
"management.endpoints.web.exposure.include=*", "spring.cloud.bootstrap.name=sanitize",
"bootstrap.sanitize=true", "spring.cloud.kubernetes.client.namespace=test",
"spring.cloud.kubernetes.secrets.enabled=true" })
@AutoConfigureWebTestClient
@Nested
class DefaultSettingsTest {

Expand Down Expand Up @@ -98,6 +100,7 @@ void test() {
"management.endpoints.web.exposure.include=*", "spring.cloud.bootstrap.name=sanitize",
"management.endpoint.env.show-values=NEVER", "bootstrap.sanitize=true",
"spring.cloud.kubernetes.client.namespace=test", "spring.cloud.kubernetes.secrets.enabled=true" })
@AutoConfigureWebTestClient
@Nested
class ExplicitNever {

Expand Down Expand Up @@ -170,6 +173,7 @@ void test() {
"management.endpoint.env.show-values=ALWAYS", "spring.cloud.kubernetes.sanitize.secrets=false",
"bootstrap.sanitize=true", "spring.cloud.kubernetes.client.namespace=test",
"spring.cloud.kubernetes.secrets.enabled=true" })
@AutoConfigureWebTestClient
@Nested
class AlwaysWithoutSanitizingFunction {

Expand Down Expand Up @@ -242,6 +246,7 @@ void test() {
"management.endpoint.env.show-values=ALWAYS", "spring.cloud.kubernetes.sanitize.secrets=true",
"bootstrap.sanitize=true", "spring.cloud.kubernetes.client.namespace=test",
"spring.cloud.kubernetes.secrets.enabled=true" })
@AutoConfigureWebTestClient
@Nested
class AlwaysWithSanitizingFunction {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.endpoint.SanitizableData;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.test.LocalManagementPort;
import org.springframework.boot.test.web.server.LocalManagementPort;
import org.springframework.boot.webtestclient.AutoConfigureWebTestClient;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;

Expand All @@ -35,6 +36,7 @@ class ConfigDataFabric8ConfigpropsEndpointTests {
properties = { "spring.main.cloud-platform=KUBERNETES", "management.endpoints.web.exposure.include=*",
"spring.config.import=kubernetes:,classpath:./sanitize.yaml",
"spring.cloud.kubernetes.secrets.enabled=true" })
@AutoConfigureWebTestClient
@Nested
class DefaultSettingsTest extends ConfigDataSanitize {

Expand Down Expand Up @@ -93,6 +95,7 @@ void test() {
"management.endpoint.configprops.show-values=NEVER",
"spring.config.import=kubernetes:,classpath:./sanitize.yaml",
"spring.cloud.kubernetes.secrets.enabled=true" })
@AutoConfigureWebTestClient
@Nested
class ExplicitNever extends ConfigDataSanitize {

Expand Down Expand Up @@ -165,6 +168,7 @@ void test() {
"spring.cloud.kubernetes.sanitize.secrets=false",
"spring.config.import=kubernetes:,classpath:./sanitize.yaml",
"spring.cloud.kubernetes.secrets.enabled=true" })
@AutoConfigureWebTestClient
@Nested
class AlwaysWithoutSanitizingFunction extends ConfigDataSanitize {

Expand Down Expand Up @@ -237,6 +241,7 @@ void test() {
"spring.cloud.kubernetes.sanitize.secrets=true",
"spring.config.import=kubernetes:,classpath:./sanitize-two.yaml",
"spring.cloud.kubernetes.secrets.enabled=true" })
@AutoConfigureWebTestClient
@Nested
class AlwaysWithSanitizingFunction extends ConfigDataSanitize {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.endpoint.SanitizableData;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.test.LocalManagementPort;
import org.springframework.boot.test.web.server.LocalManagementPort;
import org.springframework.boot.webtestclient.AutoConfigureWebTestClient;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;

Expand All @@ -36,6 +37,7 @@ class ConfigDataKubernetesClientSanitizeEnvEndpointTests {
"spring.config.import=kubernetes:,classpath:./sanitize.yaml",
"management.endpoints.web.exposure.include=*", "spring.cloud.kubernetes.client.namespace=test",
"spring.cloud.kubernetes.secrets.enabled=true" })
@AutoConfigureWebTestClient
@Nested
class DefaultSettingsTest extends ConfigDataSanitize {

Expand Down Expand Up @@ -98,6 +100,7 @@ void test() {
"spring.config.import=kubernetes:,classpath:./sanitize.yaml",
"management.endpoint.env.show-values=NEVER", "spring.cloud.kubernetes.client.namespace=test",
"spring.cloud.kubernetes.secrets.enabled=true" })
@AutoConfigureWebTestClient
@Nested
class ExplicitNever extends ConfigDataSanitize {

Expand Down Expand Up @@ -169,6 +172,7 @@ void test() {
"spring.config.import=kubernetes:,classpath:./sanitize.yaml",
"management.endpoint.env.show-values=ALWAYS", "spring.cloud.kubernetes.sanitize.secrets=false",
"spring.cloud.kubernetes.client.namespace=test", "spring.cloud.kubernetes.secrets.enabled=true" })
@AutoConfigureWebTestClient
@Nested
class AlwaysWithoutSanitizingFunction extends ConfigDataSanitize {

Expand Down Expand Up @@ -240,6 +244,7 @@ void test() {
"spring.config.import=kubernetes:,classpath:./sanitize-two.yaml",
"management.endpoint.env.show-values=ALWAYS", "spring.cloud.kubernetes.sanitize.secrets=true",
"spring.cloud.kubernetes.client.namespace=test", "spring.cloud.kubernetes.secrets.enabled=true" })
@AutoConfigureWebTestClient
@Nested
class AlwaysWithSanitizingFunction extends ConfigDataSanitize {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES)
@ConditionalOnClass(name = "org.springframework.boot.actuate.endpoint.SanitizableData")
@ConditionalOnSanitizeSecrets
class KubernetesCommonsSanitizeAutoConfiguration {
public class KubernetesCommonsSanitizeAutoConfiguration {

@Bean
@ConditionalOnMissingBean
Expand Down
Loading
Loading