From ee9f45f8a201f5aa8cb8c01b8eeaf5eb3761778d Mon Sep 17 00:00:00 2001 From: Darin Kelkhoff Date: Tue, 21 Jun 2022 18:43:35 -0500 Subject: [PATCH] QQQ-14 switch from org.testcontainers/localstack to cloud.localstack (to fix circleci?) --- pom.xml | 18 ++---------- .../module/filesystem/s3/BaseS3Test.java | 28 ++++++------------- 2 files changed, 11 insertions(+), 35 deletions(-) diff --git a/pom.xml b/pom.xml index 6f7e9a7c..db7018f2 100644 --- a/pom.xml +++ b/pom.xml @@ -61,21 +61,9 @@ 1.12.243 - org.testcontainers - testcontainers - 1.17.2 - test - - - org.testcontainers - localstack - 1.17.2 - test - - - org.testcontainers - junit-jupiter - 1.17.2 + cloud.localstack + localstack-utils + 0.2.20 test diff --git a/src/test/java/com/kingsrook/qqq/backend/module/filesystem/s3/BaseS3Test.java b/src/test/java/com/kingsrook/qqq/backend/module/filesystem/s3/BaseS3Test.java index 3fb38d3a..8c60963b 100644 --- a/src/test/java/com/kingsrook/qqq/backend/module/filesystem/s3/BaseS3Test.java +++ b/src/test/java/com/kingsrook/qqq/backend/module/filesystem/s3/BaseS3Test.java @@ -22,36 +22,29 @@ package com.kingsrook.qqq.backend.module.filesystem.s3; -import com.amazonaws.auth.AWSStaticCredentialsProvider; -import com.amazonaws.auth.BasicAWSCredentials; +import cloud.localstack.ServiceName; +import cloud.localstack.awssdkv1.TestUtils; +import cloud.localstack.docker.LocalstackDockerExtension; +import cloud.localstack.docker.annotation.LocalstackDockerProperties; import com.amazonaws.services.s3.AmazonS3; -import com.amazonaws.services.s3.AmazonS3ClientBuilder; import com.amazonaws.services.s3.model.S3ObjectSummary; import com.kingsrook.qqq.backend.module.filesystem.s3.utils.S3Utils; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; -import org.testcontainers.containers.localstack.LocalStackContainer; -import org.testcontainers.junit.jupiter.Container; -import org.testcontainers.junit.jupiter.Testcontainers; -import org.testcontainers.utility.DockerImageName; +import org.junit.jupiter.api.extension.ExtendWith; /******************************************************************************* ** *******************************************************************************/ -@Testcontainers +@ExtendWith(LocalstackDockerExtension.class) +@LocalstackDockerProperties(services = { ServiceName.S3 }) public class BaseS3Test { - private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse("localstack/localstack"); - public static final String BUCKET_NAME = "localstack-test-bucket"; public static final String TEST_FOLDER = "test-files"; public static final String SUB_FOLDER = "sub-folder"; - @Container - private static LocalStackContainer localStack = new LocalStackContainer(DEFAULT_IMAGE_NAME) - .withServices(LocalStackContainer.Service.S3); - /******************************************************************************* @@ -99,12 +92,7 @@ public class BaseS3Test *******************************************************************************/ protected AmazonS3 getAmazonS3() { - BasicAWSCredentials basicAWSCredentials = new BasicAWSCredentials(localStack.getAccessKey(), localStack.getSecretKey()); - AmazonS3 amazonS3 = AmazonS3ClientBuilder.standard() - .withEndpointConfiguration(localStack.getEndpointConfiguration(LocalStackContainer.Service.S3)) - .withCredentials(new AWSStaticCredentialsProvider(basicAWSCredentials)) - .build(); - return (amazonS3); + return (TestUtils.getClientS3()); }