This is an automated email from the ASF dual-hosted git repository. rcordier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
The following commit(s) were added to refs/heads/master by this push: new b0af243ab0 JAMES-3982 Upgrade MinIO image tag for tests (#2461) b0af243ab0 is described below commit b0af243ab0e11a3e666ca5f444ae779d22aba35c Author: vttran <vtt...@linagora.com> AuthorDate: Tue Oct 22 09:22:08 2024 +0700 JAMES-3982 Upgrade MinIO image tag for tests (#2461) --- .../james/blob/objectstorage/aws/S3MinioTest.java | 48 ++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3MinioTest.java b/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3MinioTest.java index 44eafb61cb..6f372240f3 100644 --- a/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3MinioTest.java +++ b/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3MinioTest.java @@ -30,6 +30,8 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.net.URI; import java.util.Optional; +import java.util.UUID; +import java.util.concurrent.ExecutionException; import org.apache.james.blob.api.BlobId; import org.apache.james.blob.api.BlobStoreDAO; @@ -40,11 +42,14 @@ import org.apache.james.metrics.tests.RecordingMetricFactory; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.testcontainers.containers.GenericContainer; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.util.retry.Retry; import software.amazon.awssdk.services.s3.model.S3Exception; @@ -52,8 +57,8 @@ import software.amazon.awssdk.services.s3.model.S3Exception; @Testcontainers public class S3MinioTest implements BlobStoreDAOContract { - private static final String MINIO_IMAGE = "quay.io/minio/minio"; - private static final String MINIO_TAG = "RELEASE.2024-01-29T03-56-32Z"; + private static final String MINIO_IMAGE = "minio/minio"; + private static final String MINIO_TAG = "RELEASE.2024-10-13T13-34-11Z"; private static final String MINIO_IMAGE_FULL = MINIO_IMAGE + ":" + MINIO_TAG; private static final int MINIO_PORT = 9000; private static S3BlobStoreDAO testee; @@ -66,7 +71,7 @@ public class S3MinioTest implements BlobStoreDAOContract { .withEnv("MINIO_ROOT_USER", ACCESS_KEY_ID) .withEnv("MINIO_ROOT_PASSWORD", SECRET_ACCESS_KEY) .withCommand("server", "/data", "--console-address", ":9090") - .withCreateContainerCmdModifier(createContainerCmd -> createContainerCmd.withName("james-minio-s3-test")); + .withCreateContainerCmdModifier(createContainerCmd -> createContainerCmd.withName("james-minio-s3-test-" + UUID.randomUUID())); @BeforeAll @@ -98,6 +103,26 @@ public class S3MinioTest implements BlobStoreDAOContract { testee.deleteAllBuckets().block(); } + @BeforeEach + void beforeEach() throws Exception { + // Why? https://github.com/apache/james-project/pull/1981#issuecomment-2380396460 + createBucket(TEST_BUCKET_NAME.asString()); + } + + private void createBucket(String bucketName) throws Exception { + s3ClientFactory.get().createBucket(builder -> builder.bucket(bucketName)) + .get(); + } + + private void deleteBucket(String bucketName) { + try { + s3ClientFactory.get().deleteBucket(builder -> builder.bucket(bucketName)) + .get(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException("Error while deleting bucket", e); + } + } + @Override public BlobStoreDAO testee() { return testee; @@ -116,4 +141,21 @@ public class S3MinioTest implements BlobStoreDAOContract { Mono.from(testee.save(TEST_BUCKET_NAME, TEST_BLOB_ID, SHORT_BYTEARRAY)).block(); assertThat(Mono.from(testee.readBytes(TEST_BUCKET_NAME, TEST_BLOB_ID)).block()).isEqualTo(SHORT_BYTEARRAY); } + + @Test + @Override + public void listBucketsShouldReturnEmptyWhenNone() { + deleteBucket(TEST_BUCKET_NAME.asString()); + + BlobStoreDAO store = testee(); + + assertThat(Flux.from(store.listBuckets()).collectList().block()) + .isEmpty(); + } + + @Test + @Override + @Disabled("S3minio return `Connection: close` in header response, https://github.com/apache/james-project/pull/1981#issuecomment-2380396460") + public void deleteBucketConcurrentlyShouldNotFail() { + } } --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org