Polish pr 2053 (#2234)

* AWS S3 environment repository can read the default property file as well a profile-specific file. Fixes gh-1611.

* Unit test to assert no default profile when querying S3 repository

* Polishing PR

---------

Co-authored-by: Daniel Aiken <dmaiken13@gmail.com>
Co-authored-by: Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com>
This commit is contained in:
Ryan Baxter
2023-02-24 16:55:56 -05:00
committed by GitHub
parent 920013a5ce
commit da14c2debe
2 changed files with 45 additions and 14 deletions

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", null);
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", null);
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,28 @@ 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
public void findWithOneProfileDefaultOneFound() throws UnsupportedEncodingException {
putFiles("foo-profile1.yml", jsonContent);
String versionId = putFiles("foo.yml", yamlContent);
final Environment env = envRepo.findOne("foo", "profile1", null);
assertExpectedEnvironment(env, "foo", null, versionId, 2, "profile1", "");
}
@Test
public void findWithNoProfileAndNoServerDefaultOneFound() throws UnsupportedEncodingException {
server.setDefaultProfile(null);
String versionId = putFiles("foo.yml", yamlContent);
final Environment env = envRepo.findOne("foo", null, null);
assertExpectedEnvironment(env, "foo", null, versionId, 1, "");
}
@Test
@@ -218,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
@@ -227,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
@@ -237,7 +258,8 @@ 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", "");
}
@Test