Merge branch '3.1.x'

This commit is contained in:
Ryan Baxter
2023-05-03 16:49:34 -04:00
3 changed files with 59 additions and 41 deletions

View File

@@ -90,6 +90,10 @@ public class AwsS3IntegrationTests {
RequestBody.fromString("this is a test in main"));
s3Client.putObject((request) -> request.bucket("test-bucket").key("application.properties"),
RequestBody.fromString("foo=1"));
s3Client.putObject((request) -> request.bucket("test-bucket").key("data.properties"),
RequestBody.fromString("bar=1"));
s3Client.putObject((request) -> request.bucket("test-bucket").key("data-dev.properties"),
RequestBody.fromString("bar=1"));
}
}
@@ -107,6 +111,17 @@ public class AwsS3IntegrationTests {
.isEqualTo("this is a test");
}
@Test
public void defaultApplicationAndProfileIncluded() throws IOException {
RestTemplate rest = new RestTemplateBuilder().build();
String configServerUrl = "http://localhost:" + configServerPort;
Environment env = rest.getForObject(configServerUrl + "/data/dev", Environment.class);
assertThat(env.getPropertySources().size()).isEqualTo(3);
assertThat(env.getPropertySources().get(0).getName()).isEqualTo("s3:data-dev");
assertThat(env.getPropertySources().get(1).getName()).isEqualTo("s3:data");
assertThat(env.getPropertySources().get(2).getName()).isEqualTo("s3:application");
}
@AfterAll
public static void after() {
server.close();

View File

@@ -145,7 +145,7 @@ public class AwsS3EnvironmentRepositoryTests {
final Environment env = envRepo.findOne("foo", "bar", null);
assertExpectedEnvironment(env, "foo", null, versionId, 1, "bar", "");
assertExpectedEnvironment(env, "foo", null, versionId, 1, "bar");
}
@Test
@@ -154,7 +154,7 @@ public class AwsS3EnvironmentRepositoryTests {
final Environment env = envRepo.findOne("foo", "bar", null);
assertExpectedEnvironment(env, "foo", null, versionId, 1, "bar", "");
assertExpectedEnvironment(env, "foo", null, versionId, 1, "bar");
}
@Test
@@ -163,7 +163,7 @@ public class AwsS3EnvironmentRepositoryTests {
final Environment env = envRepo.findOne("foo", "bar", null);
assertExpectedEnvironment(env, "foo", null, versionId, 1, "bar", "");
assertExpectedEnvironment(env, "foo", null, versionId, 1, "bar");
}
@Test
@@ -172,7 +172,7 @@ public class AwsS3EnvironmentRepositoryTests {
final Environment env = envRepo.findOne("foo", "bar", null);
assertExpectedEnvironment(env, "foo", null, versionId, 1, "bar", "");
assertExpectedEnvironment(env, "foo", null, versionId, 1, "bar");
}
@Test
@@ -181,7 +181,7 @@ public class AwsS3EnvironmentRepositoryTests {
final Environment env = envRepo.findOne("foo", null, null);
assertExpectedEnvironment(env, "foo", null, versionId, 1, "default", "");
assertExpectedEnvironment(env, "foo", null, versionId, 1, "default");
}
@Test
@@ -190,7 +190,7 @@ public class AwsS3EnvironmentRepositoryTests {
final Environment env = envRepo.findOne("foo", null, null);
assertExpectedEnvironment(env, "foo", null, versionId, 1, "default", "");
assertExpectedEnvironment(env, "foo", null, versionId, 1, "default");
}
@Test
@@ -200,7 +200,7 @@ public class AwsS3EnvironmentRepositoryTests {
final Environment env = envRepo.findOne("foo", "profile1,profile2", null);
assertExpectedEnvironment(env, "foo", null, versionId, 2, "profile1", "profile2", "");
assertExpectedEnvironment(env, "foo", null, versionId, 2, "profile1", "profile2");
}
@Test
@@ -209,7 +209,7 @@ public class AwsS3EnvironmentRepositoryTests {
final Environment env = envRepo.findOne("foo", "profile1,profile2", null);
assertExpectedEnvironment(env, "foo", null, versionId, 1, "profile1", "profile2", "");
assertExpectedEnvironment(env, "foo", null, versionId, 1, "profile1", "profile2");
}
@Test
@@ -219,7 +219,7 @@ public class AwsS3EnvironmentRepositoryTests {
final Environment env = envRepo.findOne("foo", "profile1", null);
assertExpectedEnvironment(env, "foo", null, versionId, 2, "profile1", "");
assertExpectedEnvironment(env, "foo", null, versionId, 2, "profile1");
}
@Test
@@ -229,7 +229,7 @@ public class AwsS3EnvironmentRepositoryTests {
final Environment env = envRepo.findOne("foo", null, null);
assertExpectedEnvironment(env, "foo", null, versionId, 1, "");
assertExpectedEnvironment(env, "foo", null, versionId, 1);
}
@@ -239,7 +239,7 @@ public class AwsS3EnvironmentRepositoryTests {
final Environment env = envRepo.findOne("foo", "bar", "label1");
assertExpectedEnvironment(env, "foo", "label1", versionId, 1, "bar", "");
assertExpectedEnvironment(env, "foo", "label1", versionId, 1, "bar");
}
@Test
@@ -248,7 +248,7 @@ public class AwsS3EnvironmentRepositoryTests {
final Environment env = envRepo.findOne("foo", "bar", null);
assertExpectedEnvironment(env, "foo", null, versionId, 1, "bar", "");
assertExpectedEnvironment(env, "foo", null, versionId, 1, "bar");
}
@Test
@@ -258,7 +258,7 @@ public class AwsS3EnvironmentRepositoryTests {
final Environment env = envRepo.findOne("foo,bar", "profile1", null);
assertExpectedEnvironment(env, "foo,bar", null, versionId, 2, "profile1", "");
assertExpectedEnvironment(env, "foo,bar", null, versionId, 2, "profile1");
}