Skip to content

Commit 8ea4ac7

Browse files
committed
Fixed integration test and local tests with Testcontainers on macOS (see testcontainers/testcontainers-java#3166 )
1 parent 980149d commit 8ea4ac7

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

application/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ dependencies {
4242
testImplementation('org.springframework.boot:spring-boot-starter-test') {
4343
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
4444
}
45-
def testcontainersVersion = '1.14.3'
45+
def testcontainersVersion = '1.15.0-rc2'
4646
testCompile('org.testcontainers:localstack:' + testcontainersVersion)
4747
testCompile('org.testcontainers:junit-jupiter:' + testcontainersVersion)
4848
}

application/src/main/java/dev/aws101/config/AwsConfig.java

+5
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ public NotificationMessagingTemplate notificationMessagingTemplate(AmazonSNS ama
5050
}
5151

5252
@Bean
53+
@ConditionalOnProperty(
54+
value = "custom.local-sns-enabled",
55+
havingValue = "false",
56+
matchIfMissing = true
57+
)
5358
public AmazonSNS amazonSNS(AWSCredentialsProvider awsCredentialsProvider) {
5459
AwsClientBuilder.EndpointConfiguration endpointConfiguration = null;
5560
if (endpoint != null) {

application/src/test/java/dev/aws101/AwsTestConfig.java

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.amazonaws.services.sqs.AmazonSQSAsyncClientBuilder;
77
import org.springframework.boot.test.context.TestConfiguration;
88
import org.springframework.context.annotation.Bean;
9+
import org.springframework.context.annotation.Primary;
910

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

1718
@Bean
19+
@Primary
1820
public AmazonSQSAsync amazonSQS() {
1921
return AmazonSQSAsyncClientBuilder.standard()
2022
.withCredentials(localStack.getDefaultCredentialsProvider())
@@ -23,6 +25,7 @@ public AmazonSQSAsync amazonSQS() {
2325
}
2426

2527
@Bean
28+
@Primary
2629
public AmazonSNS amazonSNS() {
2730
return AmazonSNSClientBuilder
2831
.standard()

application/src/test/resources/application.yml

+5
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,10 @@ spring:
2424
usernameAttribute: username
2525

2626
custom:
27+
security:
28+
enabled: false
2729
sharing-queue: test-todo-sharing
2830
updates-topic: test-todo-updates
31+
websocket-url: ws://localhost:8080/websocket
32+
external-url: ${EXTERNAL_URL:#{null}}
33+
local-sns-enabled: true

0 commit comments

Comments
 (0)