diff --git a/spring-cloud-kubernetes-client-config/src/main/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientBootstrapConfiguration.java b/spring-cloud-kubernetes-client-config/src/main/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientBootstrapConfiguration.java index 93018d0d42..d5b00a07fb 100644 --- a/spring-cloud-kubernetes-client-config/src/main/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientBootstrapConfiguration.java +++ b/spring-cloud-kubernetes-client-config/src/main/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientBootstrapConfiguration.java @@ -19,8 +19,6 @@ import io.kubernetes.client.openapi.apis.CoreV1Api; import org.springframework.boot.autoconfigure.AutoConfigureAfter; -import org.springframework.boot.autoconfigure.condition.ConditionalOnCloudPlatform; -import org.springframework.boot.cloud.CloudPlatform; import org.springframework.cloud.kubernetes.client.KubernetesClientAutoConfiguration; import org.springframework.cloud.kubernetes.commons.ConditionalOnKubernetesConfigEnabled; import org.springframework.cloud.kubernetes.commons.ConditionalOnKubernetesEnabled; @@ -43,7 +41,6 @@ @ConditionalOnKubernetesEnabled @AutoConfigureAfter(KubernetesBootstrapConfiguration.class) @Import({ KubernetesCommonsAutoConfiguration.class, KubernetesClientAutoConfiguration.class }) -@ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES) public class KubernetesClientBootstrapConfiguration { @Bean diff --git a/spring-cloud-kubernetes-client-config/src/main/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientRetryBootstrapConfiguration.java b/spring-cloud-kubernetes-client-config/src/main/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientRetryBootstrapConfiguration.java index 0dff4e67f6..6e038735a3 100644 --- a/spring-cloud-kubernetes-client-config/src/main/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientRetryBootstrapConfiguration.java +++ b/spring-cloud-kubernetes-client-config/src/main/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientRetryBootstrapConfiguration.java @@ -20,8 +20,6 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.AutoConfigureBefore; -import org.springframework.boot.autoconfigure.condition.ConditionalOnCloudPlatform; -import org.springframework.boot.cloud.CloudPlatform; import org.springframework.cloud.kubernetes.client.KubernetesClientAutoConfiguration; import org.springframework.cloud.kubernetes.commons.ConditionalOnKubernetesEnabled; import org.springframework.cloud.kubernetes.commons.KubernetesCommonsAutoConfiguration; @@ -44,7 +42,6 @@ @AutoConfigureAfter(KubernetesBootstrapConfiguration.class) @AutoConfigureBefore(KubernetesClientBootstrapConfiguration.class) @Import({ KubernetesCommonsAutoConfiguration.class, KubernetesClientAutoConfiguration.class }) -@ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES) @ConditionalOnKubernetesConfigOrSecretsRetryEnabled public class KubernetesClientRetryBootstrapConfiguration { diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientBootstrapConfigurationTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientBootstrapConfigurationTests.java index 5d7b0810b8..8b037658ad 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientBootstrapConfigurationTests.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientBootstrapConfigurationTests.java @@ -55,7 +55,7 @@ void configAndSecretsBeansAreNotPresent() { @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, properties = { "spring.cloud.kubernetes.secrets.enabled=true", - "spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES" }) + "spring.cloud.kubernetes.client.namespace=default" }) @Nested class KubernetesEnabledOnPurpose { @@ -71,8 +71,7 @@ void configAndSecretsBeansArePresent() { } @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, - properties = { "spring.cloud.kubernetes.client.namespace=default", - "spring.main.cloud-platform=KUBERNETES" }) + properties = { "spring.cloud.kubernetes.client.namespace=default" }) @Nested class KubernetesEnabled { @@ -88,7 +87,7 @@ void configAndSecretsBeansArePresent() { } @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, - properties = { "spring.cloud.kubernetes.config.enabled=false", "spring.main.cloud-platform=KUBERNETES" }) + properties = { "spring.cloud.kubernetes.config.enabled=false" }) @Nested class KubernetesEnabledConfigDisabled { @@ -105,7 +104,7 @@ void secretsOnlyPresent() { @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, properties = { "spring.cloud.kubernetes.secrets.enabled=false", - "spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES" }) + "spring.cloud.kubernetes.client.namespace=default" }) @Nested class KubernetesEnabledSecretsDisabled { @@ -122,7 +121,7 @@ void secretsOnlyPresent() { @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, properties = { "spring.cloud.kubernetes.secrets.enabled=false", - "spring.cloud.kubernetes.config.enabled=false", "spring.main.cloud-platform=KUBERNETES" }) + "spring.cloud.kubernetes.config.enabled=false" }) @Nested class KubernetesEnabledSecretsAndConfigDisabled { @@ -137,40 +136,4 @@ void secretsOnlyPresent() { } - // tests that @ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES) has the desired - // effect, meaning when it is enabled, both property sources are present - @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, - properties = { "spring.main.cloud-platform=KUBERNETES", "spring.cloud.kubernetes.client.namespace=abc" }) - @Nested - class KubernetesClientBootstrapConfigurationInsideK8s { - - @Autowired - ConfigurableApplicationContext context; - - @Test - public void bothPresent() { - assertThat(context.getBeanNamesForType(KubernetesClientConfigMapPropertySourceLocator.class)).hasSize(1); - assertThat(context.getBeanNamesForType(KubernetesClientSecretsPropertySourceLocator.class)).hasSize(1); - } - - } - - // tests that @ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES) has the desired - // effect, meaning when it is disabled, no property source bean is present - @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, - properties = { "kubernetes.informer.enabled=false" }) - @Nested - class KubernetesClientBootstrapConfigurationNotInsideK8s { - - @Autowired - ConfigurableApplicationContext context; - - @Test - public void bothMissing() { - assertThat(context.getBeanNamesForType(KubernetesClientConfigMapPropertySourceLocator.class)).hasSize(0); - assertThat(context.getBeanNamesForType(KubernetesClientSecretsPropertySourceLocator.class)).hasSize(0); - } - - } - } diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigMapIncludeProfileSpecificSourcesTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigMapIncludeProfileSpecificSourcesTests.java index a1fb50f13d..12c1d26d9f 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigMapIncludeProfileSpecificSourcesTests.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigMapIncludeProfileSpecificSourcesTests.java @@ -40,7 +40,7 @@ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = IncludeProfileSpecificSourcesApp.class, properties = { "spring.cloud.bootstrap.name=include-profile-specific-sources", - "include.profile.specific.sources=true", "spring.main.cloud-platform=KUBERNETES" }) + "include.profile.specific.sources=true" }) @AutoConfigureWebTestClient @ActiveProfiles("dev") class KubernetesClientConfigMapIncludeProfileSpecificSourcesTests { diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigMapNameAsPrefixTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigMapNameAsPrefixTests.java index 77ffd97f86..8ad5656ead 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigMapNameAsPrefixTests.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigMapNameAsPrefixTests.java @@ -37,8 +37,7 @@ */ @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = WithPrefixApp.class, - properties = { "spring.cloud.bootstrap.name=config-map-name-as-prefix", "config.map.name.as.prefix.stub=true", - "spring.main.cloud-platform=KUBERNETES" }) + properties = { "spring.cloud.bootstrap.name=config-map-name-as-prefix", "config.map.name.as.prefix.stub=true" }) @AutoConfigureWebTestClient public class KubernetesClientConfigMapNameAsPrefixTests { diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigMapPropertySourceLocatorRetryTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigMapPropertySourceLocatorRetryTests.java index 4a7923177c..75eef237e8 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigMapPropertySourceLocatorRetryTests.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigMapPropertySourceLocatorRetryTests.java @@ -120,7 +120,7 @@ public void afterEach() { @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = { "spring.cloud.kubernetes.client.namespace=default", "spring.cloud.kubernetes.config.fail-fast=true", - "spring.cloud.kubernetes.config.retry.max-attempts=5", "spring.main.cloud-platform=KUBERNETES" }, + "spring.cloud.kubernetes.config.retry.max-attempts=5" }, classes = App.class) class ConfigRetryEnabled { @@ -202,7 +202,7 @@ public void locateShouldRetryAndFail() { @Nested @SpringBootTest( webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = { - "spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES" }, + "spring.cloud.kubernetes.client.namespace=default" }, classes = App.class) class ConfigFailFastDisabled { @@ -227,7 +227,7 @@ public void locateShouldNotRetry() { properties = { "spring.cloud.kubernetes.client.namespace=default", "spring.cloud.kubernetes.config.fail-fast=true", "spring.cloud.kubernetes.config.retry.enabled=false", - "spring.cloud.kubernetes.secrets.fail-fast=true", "spring.main.cloud-platform=KUBERNETES" }, + "spring.cloud.kubernetes.secrets.fail-fast=true" }, classes = App.class) class ConfigRetryDisabledButSecretsRetryEnabled { @@ -264,7 +264,7 @@ public void locateShouldFailWithoutRetrying() { @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = { "spring.cloud.kubernetes.client.namespace=default", "spring.cloud.kubernetes.config.fail-fast=true", - "spring.cloud.kubernetes.config.retry.enabled=false", "spring.main.cloud-platform=KUBERNETES" }, + "spring.cloud.kubernetes.config.retry.enabled=false" }, classes = App.class) class ConfigFailFastEnabledButRetryDisabled { @@ -321,8 +321,7 @@ public void afterEach() { @Test public void doesNotContainRetryableConfigMapPropertySourceLocator() throws Exception { stubFor(get(API).willReturn(aResponse().withStatus(500).withBody("Internal Server Error"))); - setup("debug=true", "spring.main.cloud-platform=KUBERNETES", - "spring.cloud.kubernetes.test.enable-retry=true"); + setup("debug=true", "spring.cloud.kubernetes.test.enable-retry=true"); assertThat(context.containsBean("retryableConfigMapPropertySourceLocator")).isFalse(); } diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientSecretsPropertySourceLocatorRetryTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientSecretsPropertySourceLocatorRetryTests.java index 02629b962a..bcd355e029 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientSecretsPropertySourceLocatorRetryTests.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientSecretsPropertySourceLocatorRetryTests.java @@ -120,7 +120,7 @@ public void afterEach() { @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = { "spring.cloud.kubernetes.client.namespace=default", "spring.cloud.kubernetes.secrets.fail-fast=true", "spring.cloud.kubernetes.secrets.retry.max-attempts=5", "spring.cloud.kubernetes.secrets.name=my-secret", - "spring.cloud.kubernetes.secrets.enable-api=true", "spring.main.cloud-platform=KUBERNETES" }, + "spring.cloud.kubernetes.secrets.enable-api=true" }, classes = App.class) class SecretsRetryEnabled { @@ -202,8 +202,7 @@ public void locateShouldRetryAndFail() { @Nested @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = { "spring.cloud.kubernetes.client.namespace=default", - "spring.cloud.kubernetes.secrets.name=my-secret", "spring.cloud.kubernetes.secrets.enable-api=true", - "spring.main.cloud-platform=KUBERNETES" }, + "spring.cloud.kubernetes.secrets.name=my-secret", "spring.cloud.kubernetes.secrets.enable-api=true" }, classes = App.class) class SecretsFailFastDisabled { @@ -229,7 +228,7 @@ public void locateShouldNotRetry() { "spring.cloud.kubernetes.secrets.fail-fast=true", "spring.cloud.kubernetes.secrets.retry.enabled=false", "spring.cloud.kubernetes.config.fail-fast=true", "spring.cloud.kubernetes.secrets.name=my-secret", - "spring.cloud.kubernetes.secrets.enable-api=true", "spring.main.cloud-platform=KUBERNETES" }, + "spring.cloud.kubernetes.secrets.enable-api=true" }, classes = App.class) class SecretsRetryDisabledButConfigRetryEnabled { @@ -266,7 +265,7 @@ public void locateShouldFailWithoutRetrying() { @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = { "spring.cloud.kubernetes.client.namespace=default", "spring.cloud.kubernetes.secrets.fail-fast=true", "spring.cloud.kubernetes.secrets.retry.enabled=false", "spring.cloud.kubernetes.secrets.name=my-secret", - "spring.cloud.kubernetes.secrets.enable-api=true", "spring.main.cloud-platform=KUBERNETES" }, + "spring.cloud.kubernetes.secrets.enable-api=true" }, classes = App.class) class SecretsFailFastEnabledButRetryDisabled { @@ -323,7 +322,7 @@ public void afterEach() { @Test public void doesNotContainRetryableSecretsPropertySourceLocator() throws Exception { stubFor(get(API).willReturn(aResponse().withStatus(500).withBody("Internal Server Error"))); - setup("debug=true", "spring.main.cloud-platform=KUBERNETES", + setup("debug=true", "spring.cloud.kubernetes.test.enable-retry=true", "spring.cloud.kubernetes.secrets.name=my-secret", "spring.cloud.kubernetes.secrets.enable-api=true"); assertThat(context.containsBean("retryableSecretsPropertySourceLocator")).isFalse(); diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesClientConfigReloadAutoConfigurationTest.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesClientConfigReloadAutoConfigurationTest.java index 3bf9927544..eda9d23618 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesClientConfigReloadAutoConfigurationTest.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesClientConfigReloadAutoConfigurationTest.java @@ -152,8 +152,7 @@ public void kubernetesReloadEnabledButSecretAndConfigDisabled() throws Exception @Test public void kubernetesReloadEnabledWithPolling() throws Exception { - setup("spring.cloud.kubernetes.reload.enabled=true", "spring.cloud.kubernetes.reload.mode=polling", - "spring.main.cloud-platform=KUBERNETES"); + setup("spring.cloud.kubernetes.reload.enabled=true", "spring.cloud.kubernetes.reload.mode=polling"); assertThat(context.containsBean("configMapPropertySourceLocator")).isTrue(); assertThat(context.containsBean("secretsPropertySourceLocator")).isTrue(); assertThat(context.containsBean("configMapPropertyChangePollingWatcher")).isTrue(); @@ -164,8 +163,7 @@ public void kubernetesReloadEnabledWithPolling() throws Exception { @Test public void kubernetesReloadEnabledWithEvent() throws Exception { - setup("spring.cloud.kubernetes.reload.enabled=true", "spring.cloud.kubernetes.reload.mode=event", - "spring.main.cloud-platform=KUBERNETES"); + setup("spring.cloud.kubernetes.reload.enabled=true", "spring.cloud.kubernetes.reload.mode=event"); assertThat(context.containsBean("configMapPropertyChangePollingWatcher")).isFalse(); assertThat(context.containsBean("secretsPropertyChangePollingWatcher")).isFalse(); assertThat(context.containsBean("configMapPropertyChangeEventWatcher")).isTrue(); @@ -176,21 +174,21 @@ public void kubernetesReloadEnabledWithEvent() throws Exception { @Test public void kubernetesConfigAndSecretEnabledByDefault() throws Exception { - setup("spring.main.cloud-platform=KUBERNETES"); + setup(); assertThat(context.containsBean("configMapPropertySourceLocator")).isTrue(); assertThat(context.containsBean("secretsPropertySourceLocator")).isTrue(); } @Test public void kubernetesConfigEnabledButSecretDisabled() throws Exception { - setup("spring.cloud.kubernetes.secrets.enabled=false", "spring.main.cloud-platform=KUBERNETES"); + setup("spring.cloud.kubernetes.secrets.enabled=false"); assertThat(context.containsBean("configMapPropertySourceLocator")).isTrue(); assertThat(context.containsBean("secretsPropertySourceLocator")).isFalse(); } @Test public void kubernetesSecretsEnabledButConfigDisabled() throws Exception { - setup("spring.cloud.kubernetes.config.enabled=false", "spring.main.cloud-platform=KUBERNETES"); + setup("spring.cloud.kubernetes.config.enabled=false"); assertThat(context.containsBean("configMapPropertySourceLocator")).isFalse(); assertThat(context.containsBean("secretsPropertySourceLocator")).isTrue(); } diff --git a/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8BootstrapConfiguration.java b/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8BootstrapConfiguration.java index b10b579706..d457036cd7 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8BootstrapConfiguration.java +++ b/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8BootstrapConfiguration.java @@ -22,8 +22,6 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnCloudPlatform; -import org.springframework.boot.cloud.CloudPlatform; import org.springframework.cloud.kubernetes.commons.ConditionalOnKubernetesConfigEnabled; import org.springframework.cloud.kubernetes.commons.ConditionalOnKubernetesEnabled; import org.springframework.cloud.kubernetes.commons.ConditionalOnKubernetesSecretsEnabled; @@ -50,7 +48,6 @@ @Import({ KubernetesCommonsAutoConfiguration.class, Fabric8AutoConfiguration.class }) @ConditionalOnClass({ ConfigMap.class, Secret.class }) @AutoConfigureAfter(KubernetesBootstrapConfiguration.class) -@ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES) public class Fabric8BootstrapConfiguration { @Bean diff --git a/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8RetryBootstrapConfiguration.java b/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8RetryBootstrapConfiguration.java index 5e2009d11e..2e2dd3764b 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8RetryBootstrapConfiguration.java +++ b/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8RetryBootstrapConfiguration.java @@ -23,8 +23,6 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnCloudPlatform; -import org.springframework.boot.cloud.CloudPlatform; import org.springframework.cloud.kubernetes.commons.ConditionalOnKubernetesEnabled; import org.springframework.cloud.kubernetes.commons.KubernetesCommonsAutoConfiguration; import org.springframework.cloud.kubernetes.commons.KubernetesNamespaceProvider; @@ -48,7 +46,6 @@ @Import({ KubernetesCommonsAutoConfiguration.class, Fabric8AutoConfiguration.class }) @ConditionalOnClass({ ConfigMap.class, Secret.class }) @AutoConfigureAfter(KubernetesBootstrapConfiguration.class) -@ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES) @ConditionalOnKubernetesConfigOrSecretsRetryEnabled public class Fabric8RetryBootstrapConfiguration { diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapWithIncludeProfileSpecificSourcesTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapWithIncludeProfileSpecificSourcesTests.java index 8a1b7aa615..a6b87fce47 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapWithIncludeProfileSpecificSourcesTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapWithIncludeProfileSpecificSourcesTests.java @@ -42,8 +42,7 @@ @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = IncludeProfileSpecificSourcesApp.class, - properties = { "spring.cloud.bootstrap.name=include-profile-specific-sources", - "spring.main.cloud-platform=KUBERNETES" }) + properties = { "spring.cloud.bootstrap.name=include-profile-specific-sources" }) @AutoConfigureWebTestClient @EnableKubernetesMockClient(crud = true, https = false) @ActiveProfiles("dev") diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapWithPrefixTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapWithPrefixTests.java index 86d8698729..2a360f5d74 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapWithPrefixTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapWithPrefixTests.java @@ -40,8 +40,7 @@ */ @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = WithPrefixApp.class, - properties = { "spring.cloud.bootstrap.name=config-map-name-as-prefix", - "spring.main.cloud-platform=KUBERNETES" }) + properties = { "spring.cloud.bootstrap.name=config-map-name-as-prefix"}) @AutoConfigureWebTestClient @EnableKubernetesMockClient(crud = true, https = false) class ConfigMapWithPrefixTests { diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsFromFilePathsTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsFromFilePathsTests.java index afb245c3e7..ff9cb4e56a 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsFromFilePathsTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsFromFilePathsTests.java @@ -42,8 +42,7 @@ "spring.cloud.kubernetes.config.enableApi=false", "spring.cloud.kubernetes.config.paths=" + ConfigMapsFromFilePathsTests.FIRST_FILE_NAME_FULL_PATH + "," + ConfigMapsFromFilePathsTests.SECOND_FILE_NAME_FULL_PATH + "," - + ConfigMapsFromFilePathsTests.FIRST_FILE_NAME_DUPLICATED_FULL_PATH, - "spring.main.cloud-platform=KUBERNETES" }) + + ConfigMapsFromFilePathsTests.FIRST_FILE_NAME_DUPLICATED_FULL_PATH }) @EnableKubernetesMockClient(crud = true, https = false) public class ConfigMapsFromFilePathsTests { diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsMixedTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsMixedTests.java index 11ec267d18..32532029e7 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsMixedTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsMixedTests.java @@ -43,8 +43,7 @@ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class, properties = { "spring.application.name=" + ConfigMapsMixedTests.APPLICATION_NAME, "spring.cloud.kubernetes.config.enableApi=true", - "spring.cloud.kubernetes.config.paths=" + ConfigMapsMixedTests.FILE_NAME_FULL_PATH, - "spring.main.cloud-platform=KUBERNETES" }) + "spring.cloud.kubernetes.config.paths=" + ConfigMapsMixedTests.FILE_NAME_FULL_PATH }) @EnableKubernetesMockClient(crud = true, https = false) public class ConfigMapsMixedTests { diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsTests.java index e40ad1a056..3863d689a5 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsTests.java @@ -41,8 +41,7 @@ */ @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class, - properties = { "spring.application.name=configmap-example", "spring.cloud.kubernetes.reload.enabled=false", - "spring.main.cloud-platform=KUBERNETES" }) + properties = { "spring.application.name=configmap-example", "spring.cloud.kubernetes.reload.enabled=false"}) @AutoConfigureWebTestClient @EnableKubernetesMockClient(crud = true, https = false) public class ConfigMapsTests { diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithActiveProfilesNameTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithActiveProfilesNameTests.java index b5b1716f23..785def068d 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithActiveProfilesNameTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithActiveProfilesNameTests.java @@ -43,7 +43,7 @@ @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = RANDOM_PORT, classes = App.class, properties = { "spring.application.name=configmap-with-active-profile-name-example", - "spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES" }) + "spring.cloud.kubernetes.reload.enabled=false" }) @ActiveProfiles("development") @AutoConfigureWebTestClient @EnableKubernetesMockClient(crud = true, https = false) diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithProfileExpressionTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithProfileExpressionTests.java index 46d7c52570..5d790e7bee 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithProfileExpressionTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithProfileExpressionTests.java @@ -41,7 +41,7 @@ @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class, properties = { "spring.application.name=configmap-with-profile-example", - "spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES" }) + "spring.cloud.kubernetes.reload.enabled=false" }) @ActiveProfiles({ "production", "us-east" }) @AutoConfigureWebTestClient @EnableKubernetesMockClient(crud = true, https = false) diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithProfilesNoActiveProfileTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithProfilesNoActiveProfileTests.java index e81a6fa04f..9cd411b11a 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithProfilesNoActiveProfileTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithProfilesNoActiveProfileTests.java @@ -41,7 +41,7 @@ @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class, properties = { "spring.application.name=configmap-with-profile-no-active-profiles-example", - "spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES" }) + "spring.cloud.kubernetes.reload.enabled=false" }) @AutoConfigureWebTestClient @EnableKubernetesMockClient(crud = true, https = false) public class ConfigMapsWithProfilesNoActiveProfileTests { diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithProfilesTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithProfilesTests.java index 0ac709d3b3..e2efaa4fcb 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithProfilesTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithProfilesTests.java @@ -40,7 +40,7 @@ @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class, properties = { "spring.application.name=configmap-with-profile-example", - "spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES" }) + "spring.cloud.kubernetes.reload.enabled=false" }) @ActiveProfiles("development") @AutoConfigureWebTestClient @EnableKubernetesMockClient(crud = true, https = false) diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithoutProfilesTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithoutProfilesTests.java index 3c26bb93dd..433ef83c84 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithoutProfilesTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapsWithoutProfilesTests.java @@ -37,7 +37,7 @@ @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class, properties = { "spring.application.name=configmap-without-profile-example", - "spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES" }) + "spring.cloud.kubernetes.reload.enabled=false" }) @ActiveProfiles("development") @AutoConfigureWebTestClient @EnableKubernetesMockClient(crud = true, https = false) diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/CoreTest.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/CoreTest.java index 677c4bc44d..9cb9e8244b 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/CoreTest.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/CoreTest.java @@ -39,7 +39,7 @@ @SpringBootTest(classes = TestApplication.class, properties = { "spring.application.name=testapp", "spring.cloud.kubernetes.client.namespace=testns", "spring.cloud.kubernetes.client.trustCerts=true", "spring.cloud.kubernetes.config.namespace=testns", - "spring.cloud.kubernetes.secrets.enableApi=true", "spring.main.cloud-platform=KUBERNETES" }) + "spring.cloud.kubernetes.secrets.enableApi=true" }) @EnableKubernetesMockClient(crud = true, https = false) public class CoreTest { diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8BootstrapConfigurationTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8BootstrapConfigurationTests.java index 4a29a32574..6d87403ca9 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8BootstrapConfigurationTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8BootstrapConfigurationTests.java @@ -48,7 +48,7 @@ public void configAndSecretsBeansAreNotPresent() { @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, properties = { "spring.cloud.kubernetes.secrets.enabled=true", - "spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES" }) + "spring.cloud.kubernetes.client.namespace=default" }) @Nested class KubernetesEnabledOnPurpose { @@ -64,8 +64,7 @@ public void configAndSecretsBeansArePresent() { } @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, - properties = { "spring.cloud.kubernetes.client.namespace=default", - "spring.main.cloud-platform=KUBERNETES" }) + properties = { "spring.cloud.kubernetes.client.namespace=default" }) @Nested class KubernetesEnabled { @@ -81,7 +80,7 @@ public void configAndSecretsBeansArePresent() { } @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, - properties = { "spring.cloud.kubernetes.config.enabled=false", "spring.main.cloud-platform=KUBERNETES" }) + properties = { "spring.cloud.kubernetes.config.enabled=false" }) @Nested class KubernetesEnabledConfigDisabled { @@ -98,7 +97,7 @@ public void secretsOnlyPresent() { @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, properties = { "spring.cloud.kubernetes.secrets.enabled=false", - "spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES" }) + "spring.cloud.kubernetes.client.namespace=default" }) @Nested class KubernetesEnabledSecretsDisabled { @@ -130,39 +129,4 @@ public void secretsOnlyPresent() { } - // tests that @ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES) has the desired - // effect, meaning when it is enabled, both property sources are present - @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, - properties = { "spring.main.cloud-platform=KUBERNETES", "spring.cloud.kubernetes.client.namespace=abc" }) - @Nested - class Fabric8BootstrapConfigurationInsideK8s { - - @Autowired - ConfigurableApplicationContext context; - - @Test - public void bothPresent() { - assertThat(context.getBeanNamesForType(Fabric8ConfigMapPropertySourceLocator.class)).hasSize(1); - assertThat(context.getBeanNamesForType(Fabric8SecretsPropertySourceLocator.class)).hasSize(1); - } - - } - - // tests that @ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES) has the desired - // effect, meaning when it is disabled, no property source bean is present - @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class) - @Nested - class Fabric8BootstrapConfigurationNotInsideK8s { - - @Autowired - ConfigurableApplicationContext context; - - @Test - public void bothMissing() { - assertThat(context.getBeanNamesForType(Fabric8ConfigMapPropertySourceLocator.class)).hasSize(0); - assertThat(context.getBeanNamesForType(Fabric8SecretsPropertySourceLocator.class)).hasSize(0); - } - - } - } diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigMapPropertySourceLocatorRetryTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigMapPropertySourceLocatorRetryTests.java index 1a6502742e..d009d4b60c 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigMapPropertySourceLocatorRetryTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigMapPropertySourceLocatorRetryTests.java @@ -84,7 +84,7 @@ public static void setup() { @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = { "spring.cloud.kubernetes.client.namespace=default", "spring.cloud.kubernetes.config.fail-fast=true", - "spring.cloud.kubernetes.config.retry.max-attempts=5", "spring.main.cloud-platform=KUBERNETES" }, + "spring.cloud.kubernetes.config.retry.max-attempts=5" }, classes = Application.class) @EnableKubernetesMockClient class ConfigRetryEnabled { @@ -153,7 +153,7 @@ public void locateShouldRetryAndFail() { @Nested @SpringBootTest( webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = { - "spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES" }, + "spring.cloud.kubernetes.client.namespace=default" }, classes = Application.class) @EnableKubernetesMockClient class ConfigFailFastDisabled { @@ -178,7 +178,7 @@ public void locateShouldNotRetry() { properties = { "spring.cloud.kubernetes.client.namespace=default", "spring.cloud.kubernetes.config.fail-fast=true", "spring.cloud.kubernetes.config.retry.enabled=false", - "spring.cloud.kubernetes.secrets.fail-fast=true", "spring.main.cloud-platform=KUBERNETES" }, + "spring.cloud.kubernetes.secrets.fail-fast=true" }, classes = Application.class) @EnableKubernetesMockClient class ConfigRetryDisabledButSecretsRetryEnabled { @@ -216,7 +216,7 @@ public void locateShouldFailWithoutRetrying() { @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = { "spring.cloud.kubernetes.client.namespace=default", "spring.cloud.kubernetes.config.fail-fast=true", - "spring.cloud.kubernetes.config.retry.enabled=false", "spring.main.cloud-platform=KUBERNETES" }, + "spring.cloud.kubernetes.config.retry.enabled=false" }, classes = Application.class) @EnableKubernetesMockClient class ConfigFailFastEnabledButRetryDisabled { @@ -274,8 +274,7 @@ public void afterEach() { @Test public void doesNotContainRetryableConfigMapPropertySourceLocator() throws Exception { mockServer.expect().withPath(API).andReturn(500, "Internal Server Error").once(); - setup("debug=true", "spring.main.cloud-platform=KUBERNETES", - "spring.cloud.kubernetes.test.enable-retry=true"); + setup("debug=true", "spring.cloud.kubernetes.test.enable-retry=true"); assertThat(context.containsBean("retryableConfigMapPropertySourceLocator")).isFalse(); } diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretsPropertySourceLocatorRetryTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretsPropertySourceLocatorRetryTests.java index b840da4f9e..abe707bc8e 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretsPropertySourceLocatorRetryTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretsPropertySourceLocatorRetryTests.java @@ -91,7 +91,7 @@ public static void setup() { @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = { "spring.cloud.kubernetes.client.namespace=default", "spring.cloud.kubernetes.secrets.fail-fast=true", "spring.cloud.kubernetes.secrets.retry.max-attempts=5", "spring.cloud.kubernetes.secrets.name=my-secret", - "spring.cloud.kubernetes.secrets.enable-api=true", "spring.main.cloud-platform=KUBERNETES" }, + "spring.cloud.kubernetes.secrets.enable-api=true" }, classes = Application.class) @EnableKubernetesMockClient class SecretsRetryEnabled { @@ -162,8 +162,7 @@ public void locateShouldRetryAndFail() { @Nested @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = { "spring.cloud.kubernetes.client.namespace=default", - "spring.cloud.kubernetes.secrets.name=my-secret", "spring.cloud.kubernetes.secrets.enable-api=true", - "spring.main.cloud-platform=KUBERNETES" }, + "spring.cloud.kubernetes.secrets.name=my-secret", "spring.cloud.kubernetes.secrets.enable-api=true" }, classes = Application.class) @EnableKubernetesMockClient class SecretsFailFastDisabled { @@ -189,7 +188,7 @@ public void locateShouldNotRetry() { "spring.cloud.kubernetes.secrets.fail-fast=true", "spring.cloud.kubernetes.secrets.retry.enabled=false", "spring.cloud.kubernetes.config.fail-fast=true", "spring.cloud.kubernetes.secrets.name=my-secret", - "spring.cloud.kubernetes.secrets.enable-api=true", "spring.main.cloud-platform=KUBERNETES" }, + "spring.cloud.kubernetes.secrets.enable-api=true" }, classes = Application.class) @EnableKubernetesMockClient class SecretsRetryDisabledButConfigRetryEnabled { @@ -227,7 +226,7 @@ public void locateShouldFailWithoutRetrying() { @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = { "spring.cloud.kubernetes.client.namespace=default", "spring.cloud.kubernetes.secrets.fail-fast=true", "spring.cloud.kubernetes.secrets.retry.enabled=false", "spring.cloud.kubernetes.secrets.name=my-secret", - "spring.cloud.kubernetes.secrets.enable-api=true", "spring.main.cloud-platform=KUBERNETES" }, + "spring.cloud.kubernetes.secrets.enable-api=true" }, classes = Application.class) @EnableKubernetesMockClient class SecretsFailFastEnabledButRetryDisabled { @@ -285,7 +284,7 @@ public void afterEach() { @Test public void doesNotContainRetryableSecretsPropertySourceLocator() throws Exception { mockServer.expect().withPath(API).andReturn(500, "Internal Server Error").once(); - setup("debug=true", "spring.main.cloud-platform=KUBERNETES", + setup("debug=true", "spring.cloud.kubernetes.test.enable-retry=true", "spring.cloud.kubernetes.secrets.name=my-secret", "spring.cloud.kubernetes.secrets.enable-api=true"); assertThat(context.containsBean("retryableSecretsPropertySourceLocator")).isFalse(); diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretsPropertySourceTest.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretsPropertySourceTest.java index d6816bc557..4f53bcba4f 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretsPropertySourceTest.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretsPropertySourceTest.java @@ -39,8 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat; @ExtendWith(SpringExtension.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class, - properties = "spring.main.cloud-platform=KUBERNETES") +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class) @TestPropertySource("classpath:/application-secrets.properties") @EnableKubernetesMockClient(crud = true, https = false) class Fabric8SecretsPropertySourceTest { diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/KubernetesConfigConfigurationTest.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/KubernetesConfigConfigurationTest.java index 9276ccef8b..7c9532e241 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/KubernetesConfigConfigurationTest.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/KubernetesConfigConfigurationTest.java @@ -43,7 +43,7 @@ public class KubernetesConfigConfigurationTest extends KubernetesConfigTestBase @Test public void kubernetesWhenKubernetesDefaultEnabled() { setup(KubernetesClientTestConfiguration.class, "spring.cloud.kubernetes.enabled=true", - "spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES"); + "spring.cloud.kubernetes.client.namespace=default"); assertThat(getContext().containsBean("configMapPropertySourceLocator")).isTrue(); assertThat(getContext().containsBean("secretsPropertySourceLocator")).isTrue(); } @@ -66,8 +66,7 @@ public void kubernetesWhenKubernetesConfigAndSecretDisabled() { @Test public void kubernetesWhenKubernetesConfigEnabledButSecretDisabled() { setup(KubernetesClientTestConfiguration.class, "spring.cloud.kubernetes.config.enabled=true", - "spring.cloud.kubernetes.secrets.enabled=false", "spring.cloud.kubernetes.client.namespace=default", - "spring.main.cloud-platform=KUBERNETES"); + "spring.cloud.kubernetes.secrets.enabled=false", "spring.cloud.kubernetes.client.namespace=default"); assertThat(getContext().containsBean("configMapPropertySourceLocator")).isTrue(); assertThat(getContext().containsBean("secretsPropertySourceLocator")).isFalse(); } @@ -75,7 +74,7 @@ public void kubernetesWhenKubernetesConfigEnabledButSecretDisabled() { @Test public void kubernetesWhenKubernetesConfigDisabledButSecretEnabled() { setup(KubernetesClientTestConfiguration.class, "spring.cloud.kubernetes.config.enabled=false", - "spring.cloud.kubernetes.secrets.enabled=true", "spring.main.cloud-platform=KUBERNETES"); + "spring.cloud.kubernetes.secrets.enabled=true"); assertThat(getContext().containsBean("configMapPropertySourceLocator")).isFalse(); assertThat(getContext().containsBean("secretsPropertySourceLocator")).isTrue(); } @@ -83,8 +82,7 @@ public void kubernetesWhenKubernetesConfigDisabledButSecretEnabled() { @Test public void kubernetesConfigWhenKubernetesEnabledAndKubernetesConfigEnabled() { setup(KubernetesClientTestConfiguration.class, "spring.cloud.kubernetes.config.enabled=true", - "spring.cloud.kubernetes.secrets.enabled=true", "spring.cloud.kubernetes.client.namespace=default", - "spring.main.cloud-platform=KUBERNETES"); + "spring.cloud.kubernetes.secrets.enabled=true", "spring.cloud.kubernetes.client.namespace=default"); assertThat(getContext().containsBean("configMapPropertySourceLocator")).isTrue(); assertThat(getContext().containsBean("secretsPropertySourceLocator")).isTrue(); } @@ -106,5 +104,4 @@ KubernetesClient kubernetesClient() { } } - } diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/MultipleConfigMapsTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/MultipleConfigMapsTests.java index 6b54f403a2..7c8e74fbcb 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/MultipleConfigMapsTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/MultipleConfigMapsTests.java @@ -39,7 +39,7 @@ */ @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = ExampleApp.class, - properties = { "spring.cloud.bootstrap.name=multiplecms", "spring.main.cloud-platform=KUBERNETES" }) + properties = { "spring.cloud.bootstrap.name=multiplecms" }) @AutoConfigureWebTestClient @EnableKubernetesMockClient(crud = true, https = false) public class MultipleConfigMapsTests { diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/MultipleSecretsTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/MultipleSecretsTests.java index 7e254bcc02..81621cbc44 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/MultipleSecretsTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/MultipleSecretsTests.java @@ -41,7 +41,7 @@ */ @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = MultiSecretsApp.class, - properties = { "spring.cloud.bootstrap.name=multiple-secrets", "spring.main.cloud-platform=KUBERNETES" }) + properties = { "spring.cloud.bootstrap.name=multiple-secrets" }) @AutoConfigureWebTestClient @EnableKubernetesMockClient(crud = true, https = false) public class MultipleSecretsTests { diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/reload/ConfigReloadAutoConfigurationTest.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/reload/ConfigReloadAutoConfigurationTest.java index a26dc713ae..6ff7672498 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/reload/ConfigReloadAutoConfigurationTest.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/reload/ConfigReloadAutoConfigurationTest.java @@ -99,7 +99,7 @@ public void kubernetesConfigReloadWhenKubernetesDisabled() { public void kubernetesReloadEnabled() { setup(KubernetesClientTestConfiguration.class, "spring.cloud.kubernetes.enabled=true", "spring.cloud.kubernetes.config.enabled=true", "spring.cloud.kubernetes.secrets.enabled=true", - "spring.cloud.kubernetes.reload.enabled=true", "spring.main.cloud-platform=KUBERNETES"); + "spring.cloud.kubernetes.reload.enabled=true"); assertThat(this.getContext().containsBean("configMapPropertySourceLocator")).isTrue(); assertThat(this.getContext().containsBean("secretsPropertySourceLocator")).isTrue(); assertThat(this.getContext().containsBean("configMapPropertyChangeEventWatcher")).isTrue(); @@ -110,7 +110,7 @@ public void kubernetesReloadEnabled() { public void kubernetesReloadEnabledButSecretDisabled() { setup(KubernetesClientTestConfiguration.class, "spring.cloud.kubernetes.enabled=true", "spring.cloud.kubernetes.config.enabled=true", "spring.cloud.kubernetes.secrets.enabled=false", - "spring.cloud.kubernetes.reload.enabled=true", "spring.main.cloud-platform=KUBERNETES"); + "spring.cloud.kubernetes.reload.enabled=true"); assertThat(this.getContext().containsBean("configMapPropertySourceLocator")).isTrue(); assertThat(this.getContext().containsBean("secretsPropertySourceLocator")).isFalse(); assertThat(this.getContext().containsBean("configMapPropertyChangeEventWatcher")).isTrue(); diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/secrets_with_labels/SecretsWithLabelsTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/secrets_with_labels/SecretsWithLabelsTests.java index 61adb1b420..d22d9af847 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/secrets_with_labels/SecretsWithLabelsTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/secrets_with_labels/SecretsWithLabelsTests.java @@ -37,8 +37,7 @@ * @author wind57 */ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SecretsWithLabelsApp.class, - properties = { "spring.cloud.bootstrap.name=secret-with-labels-config", - "spring.main.cloud-platform=KUBERNETES" }) + properties = { "spring.cloud.bootstrap.name=secret-with-labels-config"}) @EnableKubernetesMockClient(crud = true, https = false) class SecretsWithLabelsTests {