Home > database >  Creating a bucket, folder structure and uploading a file in S3MockContainer
Creating a bucket, folder structure and uploading a file in S3MockContainer

Time:11-15

hi i have created a testcontainer and want to set up a bucket and folder, and upload a file into the container so i can test my request call.

How do i do this.. i have set up the container

import com.adobe.testing.s3mock.testcontainers.S3MockContainer;

@Testcontainers
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class TestContainerSetUp {

    protected static final String BUCKET_NAME = "testbucket";

    @Container
    public static final S3MockContainer s3MockContainer = new S3MockContainer(DockerImageName.parse("adobe/s3mock:2.4.13"))
            .withInitialBuckets(BUCKET_NAME);

CodePudding user response:

I managed to get this to work, by autowiring a S3 client and using it put the object into the bucket before starting my tests

  • Related