Reverse app names when fetching s3 data (#2652)

This matches the behavior of other EnvironmentRepositories like Git.

#Fixes #2642
This commit is contained in:
Ryan Baxter
2024-11-25 14:41:27 -05:00
committed by GitHub
parent 1018c3957b
commit 28f2b7af3b
2 changed files with 5 additions and 2 deletions

View File

@@ -86,6 +86,7 @@ public class AwsS3EnvironmentRepository implements EnvironmentRepository, Ordere
String[] profileArray = parseProfiles(profiles);
List<String> apps = Arrays.asList(StringUtils.commaDelimitedListToStringArray(application.replace(" ", "")));
Collections.reverse(apps);
if (!apps.contains(serverProperties.getDefaultApplicationName())) {
apps = new ArrayList<>(apps);
apps.add(serverProperties.getDefaultApplicationName());

View File

@@ -257,10 +257,12 @@ public class AwsS3EnvironmentRepositoryTests {
@Test
public void findWithMultipleApplicationAllFound() throws UnsupportedEncodingException {
putFiles("foo-profile1.yml", jsonContent);
String versionId = putFiles("bar-profile1.yml", jsonContent);
String versionId = putFiles("foo-profile1.yml", jsonContent);
putFiles("bar-profile1.yml", jsonContent);
final Environment env = envRepo.findOne("foo,bar", "profile1", null);
assertThat(env.getPropertySources().get(0).getName()).isEqualTo("s3:bar-profile1");
assertThat(env.getPropertySources().get(1).getName()).isEqualTo("s3:foo-profile1");
assertExpectedEnvironment(env, "foo,bar", null, versionId, 2, "profile1");