Skip to content

Commit

Permalink
tests: add more checks in list buckets functional test (#622)
Browse files Browse the repository at this point in the history
  • Loading branch information
balamurugana authored Oct 4, 2017
1 parent c971daf commit c86c645
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion functional/FunctionalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,29 @@ public static void listBuckets_test() throws Exception {

long startTime = System.currentTimeMillis();
try {
Date expectedTime = new Date();
String bucketName = getRandomName();
boolean found = false;
client.makeBucket(bucketName);
for (Bucket bucket : client.listBuckets()) {
ignore(bucket);
if (bucket.name().equals(bucketName)) {
if (found) {
throw new Exception("[FAILED] duplicate entry " + bucketName + " found in list buckets");
}

found = true;
Date time = bucket.creationDate();
long diff = time.getTime() - expectedTime.getTime();
// excuse 15 minutes
if (diff > (15 * 60 * 1000)) {
throw new Exception("[FAILED] bucket creation time too apart. expected: " + expectedTime
+ ", got: " + time);
}
}
}
client.removeBucket(bucketName);
if (!found) {
throw new Exception("[FAILED] created bucket not found in list buckets");
}
mintSuccessLog("listBuckets()", null, startTime);
} catch (Exception e) {
Expand Down

0 comments on commit c86c645

Please sign in to comment.