Skip to content

Commit 6dd81bb

Browse files
committed
Fix migrate to LocalStack 3.0.0
1 parent 5625b76 commit 6dd81bb

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

embedded-localstack/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<artifactId>embedded-localstack</artifactId>
1414

1515
<properties>
16-
<aws-java-sdk.version>1.12.261</aws-java-sdk.version>
16+
<aws-java-sdk.version>1.12.643</aws-java-sdk.version>
1717
</properties>
1818

1919
<dependencies>

embedded-localstack/src/main/java/com/playtika/testcontainer/localstack/EmbeddedLocalStackBootstrapConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ public LocalStackContainer localStack(ConfigurableEnvironment environment,
6565
.withExposedPorts(properties.getEdgePort())
6666
.withEnv("EDGE_PORT", String.valueOf(properties.getEdgePort()))
6767
.withEnv("HOSTNAME", properties.getHostname())
68-
.withEnv("HOSTNAME_EXTERNAL", properties.getHostnameExternal())
68+
.withEnv("LOCALSTACK_HOST", properties.getHostnameExternal())
69+
.withEnv("SKIP_SSL_CERT_DOWNLOAD", "1")
6970
.withNetworkAliases(LOCALSTACK_NETWORK_ALIAS);
7071

7172
network.ifPresent(localStackContainer::withNetwork);

embedded-localstack/src/main/java/com/playtika/testcontainer/localstack/LocalStackProperties.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ public class LocalStackProperties extends CommonContainerProperties {
1616
public static final String BEAN_NAME_EMBEDDED_LOCALSTACK = "embeddedLocalstack";
1717
public Collection<LocalStackContainer.Service> services = Collections.emptyList();
1818
public int edgePort = 4566;
19-
public String hostname = "127.0.0.1";
20-
public String hostnameExternal = "127.0.0.1";
19+
public String hostname = "localhost";
20+
public String hostnameExternal = "localhost";
2121

22-
// https://hub.docker.com/r/localstack/localstack
2322
@Override
2423
public String getDefaultDockerImage() {
2524
// Please don`t remove this comment.

embedded-localstack/src/main/resources/META-INF/additional-spring-configuration-metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
{
1515
"name": "embedded.localstack.docker-image",
1616
"type": "java.lang.String",
17-
"defaultValue": "localstack/localstack:0.10.8"
17+
"defaultValue": "localstack/localstack:3.0.0"
1818
}
1919
],
2020
"hints": [
@@ -36,7 +36,7 @@
3636
"values": [
3737
{
3838
"value": "localstack/localstack:3.0.0",
39-
"description": "Default Localstack image in version 0.10.8. Ref https://hub.docker.com/r/localstack/localstack for further info."
39+
"description": "Default Localstack image. Ref https://hub.docker.com/r/localstack/localstack for further info."
4040
}
4141
]
4242
},

embedded-localstack/src/test/java/com/playtika/testcontainer/localstack/EmbeddedLocalStackTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import com.amazonaws.services.sqs.AmazonSQS;
1616
import com.amazonaws.services.sqs.AmazonSQSClientBuilder;
1717
import com.amazonaws.services.sqs.model.CreateQueueResult;
18+
import com.amazonaws.services.sqs.model.SendMessageRequest;
1819
import org.junit.jupiter.api.Test;
1920
import org.springframework.beans.factory.annotation.Autowired;
2021
import org.springframework.beans.factory.annotation.Value;
@@ -91,10 +92,12 @@ public void shouldStartSQS() {
9192

9293
CreateQueueResult queueResult = sqs.createQueue("baz");
9394
String fooQueueUrl = queueResult.getQueueUrl();
94-
assertThat(fooQueueUrl).
95-
contains("http://" + properties.getHostname() + ":" + sqsPort);
9695

97-
sqs.sendMessage(fooQueueUrl, "test");
96+
SendMessageRequest sendMessageRequest = new SendMessageRequest();
97+
sendMessageRequest.setQueueUrl(fooQueueUrl);
98+
sendMessageRequest.setMessageBody("test");
99+
sqs.sendMessage(sendMessageRequest);
100+
98101
long messageCount = sqs.receiveMessage(fooQueueUrl).getMessages().stream()
99102
.filter(message -> message.getBody().equals("test"))
100103
.count();

0 commit comments

Comments
 (0)