Home > Software design >  test containers testing in spring s3 service errors
test containers testing in spring s3 service errors

Time:11-17

I have set up s3 container, and have a basic test working. What i wanted to know was how can i test it throws AwsServiceException. Is there anyway i can get the container to do that.

@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:

Testcontainers ToxiProxy module can be used here. See an example here. Client should point to the proxy created via toxiproxy and then you can simulate timeouts, latency, and soon. Read more about toxiproxy here.

  • Related