Skip to content

Commit 9540652

Browse files
authored
Update localstack images in tests (#5783)
`atlassian/pipelines-awscli` is deprecated and it recommends to use `amazon/aws-cli`.
1 parent 1f3a1f7 commit 9540652

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

modules/localstack/src/test/java/org/testcontainers/containers/localstack/LocalstackContainerTest.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.junit.Test;
2727
import org.junit.experimental.runners.Enclosed;
2828
import org.junit.runner.RunWith;
29-
import org.testcontainers.DockerClientFactory;
3029
import org.testcontainers.containers.Container;
3130
import org.testcontainers.containers.GenericContainer;
3231
import org.testcontainers.containers.Network;
@@ -153,12 +152,7 @@ public void sqsTestOverBridgeNetwork() {
153152
String fooQueueUrl = queueResult.getQueueUrl();
154153
assertThat(fooQueueUrl)
155154
.as("Created queue has external hostname URL")
156-
.contains(
157-
"http://" +
158-
DockerClientFactory.instance().dockerHostIpAddress() +
159-
":" +
160-
localstack.getMappedPort(LocalStackContainer.PORT)
161-
);
155+
.contains("http://" + localstack.getHost() + ":" + localstack.getMappedPort(LocalStackContainer.PORT));
162156

163157
sqs.sendMessage(fooQueueUrl, "test");
164158
final long messageCount = sqs
@@ -265,14 +259,17 @@ public static class WithNetwork {
265259
LocalstackTestImages.AWS_CLI_IMAGE
266260
)
267261
.withNetwork(network)
268-
.withCreateContainerCmdModifier(cmd -> cmd.withEntrypoint("top"))
262+
.withCreateContainerCmdModifier(cmd -> cmd.withEntrypoint("tail"))
263+
.withCommand(" -f /dev/null")
269264
.withEnv("AWS_ACCESS_KEY_ID", "accesskey")
270265
.withEnv("AWS_SECRET_ACCESS_KEY", "secretkey")
271266
.withEnv("AWS_REGION", "eu-west-1");
272267

273268
@Test
274269
public void s3TestOverDockerNetwork() throws Exception {
275-
runAwsCliAgainstDockerNetworkContainer("s3api create-bucket --bucket foo");
270+
runAwsCliAgainstDockerNetworkContainer(
271+
"s3api create-bucket --bucket foo --create-bucket-configuration LocationConstraint=eu-west-1"
272+
);
276273
runAwsCliAgainstDockerNetworkContainer("s3api list-buckets");
277274
runAwsCliAgainstDockerNetworkContainer("s3 ls s3://foo");
278275
}
@@ -313,7 +310,7 @@ public void cloudWatchLogsTestOverDockerNetwork() throws Exception {
313310
private String runAwsCliAgainstDockerNetworkContainer(String command) throws Exception {
314311
final String[] commandParts = String
315312
.format(
316-
"/usr/bin/aws --region eu-west-1 %s --endpoint-url http://localstack:%d --no-verify-ssl",
313+
"/usr/local/bin/aws --region eu-west-1 %s --endpoint-url http://localstack:%d --no-verify-ssl",
317314
command,
318315
LocalStackContainer.PORT
319316
)

modules/localstack/src/test/java/org/testcontainers/containers/localstack/LocalstackTestImages.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ public interface LocalstackTestImages {
88
DockerImageName LOCALSTACK_0_10_IMAGE = LOCALSTACK_IMAGE.withTag("0.10.7");
99
DockerImageName LOCALSTACK_0_11_IMAGE = LOCALSTACK_IMAGE.withTag("0.11.3");
1010
DockerImageName LOCALSTACK_0_12_IMAGE = LOCALSTACK_IMAGE.withTag("0.12.8");
11-
DockerImageName AWS_CLI_IMAGE = DockerImageName.parse("atlassian/pipelines-awscli:1.16.302");
11+
DockerImageName AWS_CLI_IMAGE = DockerImageName.parse("amazon/aws-cli:2.7.27");
1212
}

0 commit comments

Comments
 (0)