Skip to content

Commit

Permalink
Introduce Localstack tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MatejNedic committed Nov 13, 2023
1 parent 53445ca commit 80b6486
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 111 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<spotless.version>2.31.0</spotless.version>
<jacoco.version>0.8.8</jacoco.version>
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
<testcontainers.version>1.18.0</testcontainers.version>
<testcontainers.version>1.19.1</testcontainers.version>
</properties>

<modules>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class AppConfigPropertySource extends AwsPropertySource<AppConfigProperty
private static final Log LOG = LogFactory.getLog(AppConfigPropertySource.class);

private static final String YAML_TYPE = "application/x-yaml";
private static final String YAML_TYPE_ALTERNATIVE = "text/yaml";
private static final String TEXT_TYPE = "text/plain";
private static final String JSON_TYPE = "application/json";

Expand Down Expand Up @@ -70,7 +71,7 @@ public void init() {
if (sessionToken == null) {
StartConfigurationSessionRequest sessionRequest = StartConfigurationSessionRequest.builder()
.environmentIdentifier(this.environmentIdentifier).applicationIdentifier(this.applicationIdentifier)
.configurationProfileIdentifier(this.configurationProfileIdentifier).build();
.configurationProfileIdentifier(this.configurationProfileIdentifier).requiredMinimumPollIntervalInSeconds(1000).build();
StartConfigurationSessionResponse response = this.source.startConfigurationSession(sessionRequest);
sessionToken = response.initialConfigurationToken();
}
Expand Down Expand Up @@ -103,7 +104,7 @@ public Object getProperty(String name) {
}

private void getParameters(GetLatestConfigurationResponse response) throws IOException {
if (response.contentType().equals(YAML_TYPE) || response.contentType().equals(JSON_TYPE)) {
if (response.contentType().equals(YAML_TYPE) || response.contentType().equals(YAML_TYPE_ALTERNATIVE) || response.contentType().equals(JSON_TYPE)) {
resolveYamlOrJson(response);
}
else if (response.contentType().equals(TEXT_TYPE)) {
Expand Down
5 changes: 5 additions & 0 deletions spring-cloud-aws-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@
<artifactId>localstack</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>appconfig</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down
Loading

0 comments on commit 80b6486

Please sign in to comment.