Skip to content

Commit

Permalink
Added more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
akianzadeh committed Aug 13, 2023
1 parent c56a28c commit a2ef349
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
</developers>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j.version>2.0.7</slf4j.version>
<testcontainer.version>1.18.3</testcontainer.version>
Expand Down
14 changes: 6 additions & 8 deletions src/main/java/io/github/alikian/LocalstackManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,10 @@ public LocalstackManager buildSimple() {
if (instance == null) {
instance = new LocalstackManager(imageName, simpleCloudformationFileName);
instance.start();

return instance;
} else {
throw new RuntimeException("Build already called");
}else {
log.warn("Build Already called, ignored this call");
}
return instance;
}

/**
Expand All @@ -145,11 +144,10 @@ public LocalstackManager buildFull() {
if (instance == null) {
instance = new LocalstackManager(imageName, fullCloudformationFileName);
instance.start();

return instance;
} else {
throw new RuntimeException("Build already called");
}else{
log.warn("Build Already called, ignored this call");
}
return instance;
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/test/java/io/github/alikian/LocalstackManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import software.amazon.awssdk.services.secretsmanager.model.GetSecretValueRequest;
import software.amazon.awssdk.services.secretsmanager.model.GetSecretValueResponse;

public class LocalstackManagerTest {
LocalstackManager localstackManager;
Expand All @@ -16,5 +18,9 @@ public void setup() {
public void testSecretsManagers() {
Assert.assertNotNull(localstackManager);
Assert.assertNotNull(localstackManager.getSecretsManagerClient());
GetSecretValueRequest request=GetSecretValueRequest.builder().secretId("/HeroesSecrets").build();
GetSecretValueResponse response= localstackManager.getSecretsManagerClient().getSecretValue(request);
String secretString=response.secretString();
Assert.assertEquals("{\"key1\":\"value1\",\"key2\":\"value2\"}",secretString,secretString);
}
}
6 changes: 1 addition & 5 deletions src/test/resources/cloudformation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ Resources:
Type: 'AWS::SecretsManager::Secret'
Properties:
Name: /HeroesSecrets
SecretString: >
{
"key1": "value1",
"key2": "value2"
}
SecretString: '{"key1":"value1","key2":"value2"}'
MyQueue:
Type: AWS::SQS::Queue
Properties:
Expand Down

0 comments on commit a2ef349

Please sign in to comment.