Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.RunWith;
import org.testcontainers.DockerClientFactory;
import org.testcontainers.containers.Container;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
Expand Down Expand Up @@ -153,12 +152,7 @@ public void sqsTestOverBridgeNetwork() {
String fooQueueUrl = queueResult.getQueueUrl();
assertThat(fooQueueUrl)
.as("Created queue has external hostname URL")
.contains(
"http://" +
DockerClientFactory.instance().dockerHostIpAddress() +
":" +
localstack.getMappedPort(LocalStackContainer.PORT)
);
.contains("http://" + localstack.getHost() + ":" + localstack.getMappedPort(LocalStackContainer.PORT));

sqs.sendMessage(fooQueueUrl, "test");
final long messageCount = sqs
Expand Down Expand Up @@ -265,14 +259,17 @@ public static class WithNetwork {
LocalstackTestImages.AWS_CLI_IMAGE
)
.withNetwork(network)
.withCreateContainerCmdModifier(cmd -> cmd.withEntrypoint("top"))
.withCreateContainerCmdModifier(cmd -> cmd.withEntrypoint("tail"))
.withCommand(" -f /dev/null")
.withEnv("AWS_ACCESS_KEY_ID", "accesskey")
.withEnv("AWS_SECRET_ACCESS_KEY", "secretkey")
.withEnv("AWS_REGION", "eu-west-1");

@Test
public void s3TestOverDockerNetwork() throws Exception {
runAwsCliAgainstDockerNetworkContainer("s3api create-bucket --bucket foo");
runAwsCliAgainstDockerNetworkContainer(
"s3api create-bucket --bucket foo --create-bucket-configuration LocationConstraint=eu-west-1"
);
runAwsCliAgainstDockerNetworkContainer("s3api list-buckets");
runAwsCliAgainstDockerNetworkContainer("s3 ls s3://foo");
}
Expand Down Expand Up @@ -313,7 +310,7 @@ public void cloudWatchLogsTestOverDockerNetwork() throws Exception {
private String runAwsCliAgainstDockerNetworkContainer(String command) throws Exception {
final String[] commandParts = String
.format(
"/usr/bin/aws --region eu-west-1 %s --endpoint-url http://localstack:%d --no-verify-ssl",
"/usr/local/bin/aws --region eu-west-1 %s --endpoint-url http://localstack:%d --no-verify-ssl",
command,
LocalStackContainer.PORT
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ public interface LocalstackTestImages {
DockerImageName LOCALSTACK_0_10_IMAGE = LOCALSTACK_IMAGE.withTag("0.10.7");
DockerImageName LOCALSTACK_0_11_IMAGE = LOCALSTACK_IMAGE.withTag("0.11.3");
DockerImageName LOCALSTACK_0_12_IMAGE = LOCALSTACK_IMAGE.withTag("0.12.8");
DockerImageName AWS_CLI_IMAGE = DockerImageName.parse("atlassian/pipelines-awscli:1.16.302");
DockerImageName AWS_CLI_IMAGE = DockerImageName.parse("amazon/aws-cli:2.7.27");
}