From 54c121ab1ea15955cd4b14ea6a77e57b8126eb0e Mon Sep 17 00:00:00 2001 From: spencergibb Date: Fri, 7 Aug 2020 17:09:03 -0400 Subject: [PATCH] Updates tests to use use-legacy-processing property --- ...onsulPropertySourceLocatorAppNameCustomizedTests.java | 5 ++++- .../config/ConsulPropertySourceLocatorFailFastTests.java | 1 + .../config/ConsulPropertySourceLocatorFilesTests.java | 1 + .../config/ConsulPropertySourceLocatorRetryTests.java | 1 + .../consul/config/ConsulPropertySourceLocatorTests.java | 9 ++++++--- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorAppNameCustomizedTests.java b/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorAppNameCustomizedTests.java index ea5e6d77..f21fde0e 100644 --- a/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorAppNameCustomizedTests.java +++ b/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorAppNameCustomizedTests.java @@ -78,6 +78,7 @@ public class ConsulPropertySourceLocatorAppNameCustomizedTests { this.context = new SpringApplicationBuilder(Config.class) .web(WebApplicationType.NONE) .run("--spring.application.name=testConsulPropertySourceLocatorAppNameCustomized", + "--spring.config.use-legacy-processing=true", "--spring.cloud.consul.config.name=" + CONFIG_NAME, "--spring.cloud.consul.config.prefix=" + ROOT); @@ -89,7 +90,9 @@ public class ConsulPropertySourceLocatorAppNameCustomizedTests { @After public void teardown() { this.client.deleteKVValues(PREFIX); - this.context.close(); + if (context != null) { + this.context.close(); + } } @Test diff --git a/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorFailFastTests.java b/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorFailFastTests.java index 14b1e1dc..8def913b 100644 --- a/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorFailFastTests.java +++ b/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorFailFastTests.java @@ -32,6 +32,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen @RunWith(SpringRunner.class) @SpringBootTest(classes = ConsulPropertySourceLocatorFailFastTests.Config.class, properties = { "spring.application.name=testConsulPropertySourceLocatorFailFast", + "spring.config.use-legacy-processing=true", "spring.cloud.consul.host=53210a7c-4809-42cb-8b30-057d2db85fcc", "spring.cloud.consul.port=65530", "spring.cloud.consul.retry.enabled=false", diff --git a/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorFilesTests.java b/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorFilesTests.java index 4f9872ea..0f92bb1f 100644 --- a/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorFilesTests.java +++ b/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorFilesTests.java @@ -78,6 +78,7 @@ public class ConsulPropertySourceLocatorFilesTests { this.context = new SpringApplicationBuilder(Config.class) .web(WebApplicationType.NONE).run("--spring.application.name=" + APP_NAME, + "--spring.config.use-legacy-processing=true", "--spring.cloud.consul.config.prefix=" + ROOT, "--spring.cloud.consul.config.format=FILES", "--spring.profiles.active=dev", diff --git a/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorRetryTests.java b/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorRetryTests.java index 6058a13c..721f2c43 100644 --- a/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorRetryTests.java +++ b/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorRetryTests.java @@ -41,6 +41,7 @@ public class ConsulPropertySourceLocatorRetryTests { Assert.assertThrows(TransportException.class, () -> { new SpringApplicationBuilder(Config.class).properties( "spring.application.name=testConsulPropertySourceLocatorRetry", + "spring.config.use-legacy-processing=true", "spring.cloud.consul.host=53210a7c-4809-42cb-8b30-057d2db85fcc", "logging.level.org.springframework.retry=TRACE", "server.port=0", "spring.cloud.consul.port=65530", diff --git a/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorTests.java b/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorTests.java index a359d789..f8b70b62 100644 --- a/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorTests.java +++ b/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorTests.java @@ -93,6 +93,7 @@ public class ConsulPropertySourceLocatorTests { this.context = new SpringApplicationBuilder(Config.class) .web(WebApplicationType.NONE).run("--SPRING_APPLICATION_NAME=" + APP_NAME, + "--spring.config.use-legacy-processing=true", "--spring.cloud.consul.config.prefix=" + ROOT, "spring.cloud.consul.config.watch.delay=10"); @@ -104,7 +105,9 @@ public class ConsulPropertySourceLocatorTests { @After public void teardown() { this.client.deleteKVValues(PREFIX); - this.context.close(); + if (context != null) { + this.context.close(); + } } @Test @@ -114,7 +117,7 @@ public class ConsulPropertySourceLocatorTests { } @Test - @Ignore // FIXME broken tests with boot 2.0.0 + @Ignore // FIXME: broken tests with boot 2.0.0 public void propertyLoadedAndUpdated() throws Exception { String testProp = this.environment.getProperty(TEST_PROP_CANONICAL); assertThat(testProp).as("testProp was wrong").isEqualTo(VALUE1); @@ -132,7 +135,7 @@ public class ConsulPropertySourceLocatorTests { } @Test - @Ignore // FIXME broken tests with boot 2.0.0 + @Ignore // FIXME: broken tests with boot 2.0.0 public void contextDoesNotExistThenExists() throws Exception { String testProp = this.environment.getProperty(TEST_PROP3_CANONICAL); assertThat(testProp).as("testProp was wrong").isNull();