Replies: 2 comments 1 reply
-
Hi, fixed ports are totally unrelated to the issue and is not recommended by Testcontainers. You should configure S3 client properly. AWS SDK V1 AmazonS3 s3 = AmazonS3ClientBuilder
.standard()
.withEndpointConfiguration(
new AwsClientBuilder.EndpointConfiguration(
localstack.getEndpoint().toString(),
localstack.getRegion()
)
)
.withCredentials(
new AWSStaticCredentialsProvider(
new BasicAWSCredentials(localstack.getAccessKey(), localstack.getSecretKey())
)
)
.build(); AWS SDK V2 S3Client s3 = S3Client
.builder()
.endpointOverride(localstack.getEndpoint())
.credentialsProvider(
StaticCredentialsProvider.create(
AwsBasicCredentials.create(localstack.getAccessKey(), localstack.getSecretKey())
)
)
.region(Region.of(localstack.getRegion()))
.build(); Instead of sharing snippets would be great if you can share a minimal project that reproduces the issue attaching the archive in the discussion or a github repository. Due to the lack of information, I am guessing that Also, Can you share the Testcontainers version are you using? |
Beta Was this translation helpful? Give feedback.
-
Hello @eddumelendez
public static final String VALID_DATA_FILE = "channels.csv";
public static final String INVALID_DATA_FILE = "channels_bad.csv";
private static final String DOCKER_FILE_PATH_TO_VALID_FILE = "/tmp/" + VALID_DATA_FILE;
private static final String DOCKER_FILE_PATH_TO_INVALID_FILE = "/tmp/" + INVALID_DATA_FILE;
Probably there is one important thing. This is how I attach Docker to my tests. This is the Docker socket mounting setup:
BTW, @eddumelendez I have a question about your gist. I see there is an @Container
private final LocalStackContainer localstack =
new LocalStackContainer(DockerImageName.parse("localstack/localstack").withTag("0.14.2"))
.withCopyFileToContainer(MountableFile.forClasspathResource("/localstack/aws-script.sh"), "/docker-entrypoint-initaws.d")
.withServices(Service.S3)
.waitingFor(Wait.forLogMessage(".*s3 bucket created\\.\n", 1)); Could you please take a look at it? I guess it can be something that I need to try instead of my way: Container.ExecResult createBucketExecResult1 = S3_CONTAINER.execInContainer("awslocal", "s3", "mb", inputBucketAddress); |
Beta Was this translation helpful? Give feedback.
-
Hello guys
I use MySQL and Localstack Testcontainers modules in tests and tests work well locally. But in Jenkins, I see that Localstack container can't create buckets at the same time everything is ok with MySQL DB
From the log belove you can see that container was started but no buckets were created:
And this is how the same logs look like locally:
As a result, I have:
Also, I see a reason for that but don't quite a root issue. I printed the bucket creation operation result in logs (
S3_CONTAINER.execInContainer("awslocal", "s3", "mb", inputBucketAddress);
) and got this:Container.ExecResult(exitCode=1, stdout=, stderr=make_bucket failed: s3://channel-list-testcontainers Could not connect to the endpoint URL: "http://172.17.0.1:4566/channel-list-testcontainers" )
I don't know what does it led to this issue on Jenkins. The container set up doesn't have any special things except one. I use TCP proxy to get static container port:
I've tried commenting out the proxy creation methods but it doesn't help.
Can you please give me any hints? I'm stuck with this problem and don't understand where to dig.
Beta Was this translation helpful? Give feedback.
All reactions