eventual consistency madness

git-svn-id: http://jclouds.googlecode.com/svn/trunk@1861 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2009-09-01 23:00:54 +00:00
parent 9ee13291bb
commit 8a4e5d4839
2 changed files with 25 additions and 6 deletions

View File

@ -24,6 +24,7 @@
package org.jclouds.aws.s3.commands;
import org.jclouds.aws.s3.S3IntegrationTest;
import org.jclouds.util.Utils;
import org.testng.annotations.Test;
/**
@ -57,10 +58,20 @@ public class DeleteBucketIntegrationTest extends S3IntegrationTest {
@Test
void deleteBucketIfEmpty() throws Exception {
String bucketName = getScratchBucketName();
final String bucketName = getScratchBucketName();
try {
assert client.deleteBucketIfEmpty(bucketName);
assert !client.bucketExists(bucketName);
assertEventually(new Runnable() {
public void run() {
try {
assert !client.bucketExists(bucketName) : "bucket " + bucketName
+ " still exists";
} catch (Exception e) {
Utils.<RuntimeException> rethrowIfRuntimeOrSameType(e);
}
}
});
} finally {
returnScratchBucket(bucketName);
}

View File

@ -95,14 +95,22 @@ public class PutBucketLiveTest extends S3IntegrationTest {
*/
@Test(groups = "live")
void testEu() throws Exception {
String bucketName = getScratchBucketName();
final String bucketName = getScratchBucketName();
try {
deleteBucket(bucketName);
client.putBucketIfNotExists(bucketName,
createIn(LocationConstraint.EU).withBucketAcl(CannedAccessPolicy.PUBLIC_READ))
.get(10, TimeUnit.SECONDS);
.get(30, TimeUnit.SECONDS);
assertEventually(new Runnable() {
public void run() {
try {
AccessControlList acl = client.getBucketACL(bucketName).get(10, TimeUnit.SECONDS);
assertTrue(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ), acl.toString());
} catch (Exception e) {
Utils.<RuntimeException> rethrowIfRuntimeOrSameType(e);
}
}
});
// TODO: I believe that the following should work based on the above acl assertion passing.
// However, it fails on 403
// URL url = new URL(String.format("https://%s.s3.amazonaws.com", bucketName));