Arsnael commented on code in PR #2931:
URL: https://github.com/apache/james-project/pull/2931#discussion_r2762677525
##########
server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3MinioTest.java:
##########
@@ -75,56 +70,22 @@ static void tearDownClass() {
s3ClientFactory.close();
}
- @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);
- }
+ @AfterEach
+ void tearDown() {
+ testee.deleteAllBuckets().block();
}
@Override
public BlobStoreDAO testee() {
return testee;
}
- @Test
- void saveWillThrowWhenBlobIdHasSlashCharacters() {
- BlobId invalidBlobId = new TestBlobId("test-blob//id");
- assertThatThrownBy(() -> Mono.from(testee.save(TEST_BUCKET_NAME,
invalidBlobId, SHORT_BYTEARRAY)).block())
- .isInstanceOf(S3Exception.class)
- .hasMessageContaining("Object name contains unsupported
characters");
- }
-
@Test
void saveShouldWorkWhenValidBlobId() {
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() {
Review Comment:
I believe it's covered in the BucketBlobStoreDAOContract.
Not too sure why it's been added here, I think because for minio past issue
with big blobs tung did from what I understand create before each test the test
bucket, so I guess this is just an extra test. We dont create a bucket here
beforehand. It does the same IMO as `listBucketsShouldNotReturnDeletedBuckets`
test
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]