Skip to content

Commit

Permalink
Make java test independent from js tests
Browse files Browse the repository at this point in the history
- The bucket cleaning might not work during js tests, and can
  be expected
- In such case, the java test should not enforce strict number
  of bucket, but use the existing number when starting...

Issue: CLDSRV-591
  • Loading branch information
williamlardier committed Dec 12, 2024
1 parent a21ea94 commit 20412bc
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/functional/jaws/src/test/java/com/scality/JavaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,22 @@ public class JavaTest {
}

@Test public void testCreateBucket() throws Exception {
Object[] initialBuckets=getS3Client().listBuckets().toArray();
getS3Client().createBucket(bucketName);
Object[] buckets=getS3Client().listBuckets().toArray();
Assert.assertEquals(buckets.length,1);
Bucket bucket = (Bucket) buckets[0];
Assert.assertEquals(bucketName, bucket.getName());
Assert.assertEquals(buckets.length, initialBuckets.length + 1);
boolean bucketFound = false;
for (Object bucketObj : buckets) {
Bucket bucket = (Bucket) bucketObj;
if (bucketName.equals(bucket.getName())) {
bucketFound = true;
break;
}
}
Assert.assertTrue("Bucket not found in the list", bucketFound);
getS3Client().deleteBucket(bucketName);
Object[] bucketsAfter=getS3Client().listBuckets().toArray();
Assert.assertEquals(bucketsAfter.length, 0);
Assert.assertEquals(bucketsAfter.length, initialBuckets.length);
}

}

0 comments on commit 20412bc

Please sign in to comment.