-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat : using aws Serviceconnection for testcontainers in dev mode (#665)
* feat : using aws Serviceconnection for testcontainers in dev mode * using aws-testcontainers for sqs * adds testcontainers to sns and ses projects * prepare for upgrade * adds aws containers and polish
- Loading branch information
1 parent
86bb1dd
commit 45475ab
Showing
22 changed files
with
199 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
aws-cloudwatch-project/src/test/java/com/example/awsspring/TestApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.example.awsspring; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.test.context.TestConfiguration; | ||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection; | ||
import org.springframework.context.annotation.Bean; | ||
import org.testcontainers.containers.PostgreSQLContainer; | ||
import org.testcontainers.containers.localstack.LocalStackContainer; | ||
import org.testcontainers.utility.DockerImageName; | ||
|
||
@TestConfiguration(proxyBeanMethods = false) | ||
public class TestApplication { | ||
|
||
@Bean | ||
@ServiceConnection | ||
LocalStackContainer localstackContainer() { | ||
return new LocalStackContainer( | ||
DockerImageName.parse("localstack/localstack").withTag("3.3.0")); | ||
} | ||
|
||
@Bean | ||
@ServiceConnection | ||
PostgreSQLContainer<?> postgreSQLContainer() { | ||
return new PostgreSQLContainer<>(DockerImageName.parse("postgres").withTag("16.2-alpine")); | ||
} | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.from(Application::main).with(TestApplication.class).run(args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
...cloudwatch-project/src/test/java/com/example/awsspring/common/DBContainerInitializer.java
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
aws-cloudwatch-project/src/test/java/com/example/awsspring/common/LocalStackConfig.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,6 @@ class ApplicationIntegrationTest extends AbstractIntegrationTest { | |
|
||
@Test | ||
void contextLoads() { | ||
assertThat(LOCAL_STACK_CONTAINER.isRunning()).isTrue(); | ||
|
||
UUID id = UUID.randomUUID(); | ||
String email = "[email protected]"; | ||
|
37 changes: 37 additions & 0 deletions
37
aws-dynamodb-project/src/test/java/com/learning/awsspring/TestApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.learning.awsspring; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.test.context.TestConfiguration; | ||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection; | ||
import org.springframework.context.annotation.Bean; | ||
import org.testcontainers.containers.localstack.LocalStackContainer; | ||
import org.testcontainers.containers.output.Slf4jLogConsumer; | ||
import org.testcontainers.containers.wait.strategy.Wait; | ||
import org.testcontainers.utility.DockerImageName; | ||
import org.testcontainers.utility.MountableFile; | ||
|
||
@Slf4j | ||
@TestConfiguration(proxyBeanMethods = false) | ||
public class TestApplication { | ||
|
||
@Bean | ||
@ServiceConnection | ||
LocalStackContainer localstackContainer() { | ||
LocalStackContainer localstackContainer = | ||
new LocalStackContainer( | ||
DockerImageName.parse("localstack/localstack").withTag("3.3.0")) | ||
.withCopyFileToContainer( | ||
MountableFile.forHostPath(".localstack/"), | ||
"/etc/localstack/init/ready.d/") | ||
.waitingFor(Wait.forLogMessage(".*Initialized\\.\n", 1)); | ||
localstackContainer.start(); | ||
Slf4jLogConsumer logConsumer = new Slf4jLogConsumer(log); | ||
localstackContainer.followOutput(logConsumer); | ||
return localstackContainer; | ||
} | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.from(Application::main).with(TestApplication.class).run(args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 0 additions & 38 deletions
38
aws-dynamodb-project/src/test/java/com/learning/awsspring/common/LocalStackConfig.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.