Skip to content

Commit

Permalink
Fixed integration test and local tests with Testcontainers on macOS (…
Browse files Browse the repository at this point in the history
  • Loading branch information
BjoernKW committed Oct 7, 2020
1 parent 980149d commit 8ea4ac7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion application/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies {
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
def testcontainersVersion = '1.14.3'
def testcontainersVersion = '1.15.0-rc2'
testCompile('org.testcontainers:localstack:' + testcontainersVersion)
testCompile('org.testcontainers:junit-jupiter:' + testcontainersVersion)
}
Expand Down
5 changes: 5 additions & 0 deletions application/src/main/java/dev/aws101/config/AwsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public NotificationMessagingTemplate notificationMessagingTemplate(AmazonSNS ama
}

@Bean
@ConditionalOnProperty(
value = "custom.local-sns-enabled",
havingValue = "false",
matchIfMissing = true
)
public AmazonSNS amazonSNS(AWSCredentialsProvider awsCredentialsProvider) {
AwsClientBuilder.EndpointConfiguration endpointConfiguration = null;
if (endpoint != null) {
Expand Down
3 changes: 3 additions & 0 deletions application/src/test/java/dev/aws101/AwsTestConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.amazonaws.services.sqs.AmazonSQSAsyncClientBuilder;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;

import static dev.aws101.TodoApplicationTests.localStack;
import static org.testcontainers.containers.localstack.LocalStackContainer.Service.SNS;
Expand All @@ -15,6 +16,7 @@
public class AwsTestConfig {

@Bean
@Primary
public AmazonSQSAsync amazonSQS() {
return AmazonSQSAsyncClientBuilder.standard()
.withCredentials(localStack.getDefaultCredentialsProvider())
Expand All @@ -23,6 +25,7 @@ public AmazonSQSAsync amazonSQS() {
}

@Bean
@Primary
public AmazonSNS amazonSNS() {
return AmazonSNSClientBuilder
.standard()
Expand Down
5 changes: 5 additions & 0 deletions application/src/test/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,10 @@ spring:
usernameAttribute: username

custom:
security:
enabled: false
sharing-queue: test-todo-sharing
updates-topic: test-todo-updates
websocket-url: ws://localhost:8080/websocket
external-url: ${EXTERNAL_URL:#{null}}
local-sns-enabled: true

0 comments on commit 8ea4ac7

Please sign in to comment.