Reverse app names when fetching s3 data (#2652)
This matches the behavior of other EnvironmentRepositories like Git. #Fixes #2642
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user