Propagate status in deleteAndVerifyContainerGone

Consuming the result of deleteContainerIfEmpty avoids an eventual
issue with Swift containers.  Also backfill some tests for
deleteContainerIfEmpty.  Fixes JCLOUDS-420.
This commit is contained in:
Andrew Gaul 2014-01-06 11:24:39 -08:00
parent 9089f68c18
commit b27658eccd
2 changed files with 25 additions and 4 deletions

View File

@ -237,8 +237,7 @@ public class SwiftAsyncBlobStore extends BaseAsyncBlobStore {
@Override
protected boolean deleteAndVerifyContainerGone(String container) {
sync.deleteContainerIfEmpty(container);
return !sync.containerExists(container);
return sync.deleteContainerIfEmpty(container);
}
@Override

View File

@ -65,8 +65,30 @@ public abstract class CommonSwiftClientLiveTest<C extends CommonSwiftClient> ext
* this method overrides containerName to ensure it isn't found
*/
@Test(groups = { "integration", "live" })
public void deleteContainerIfEmptyNotFound() throws Exception {
assert getApi().deleteContainerIfEmpty("dbienf");
public void testDeleteContainerIfEmptyContainerNotFound() throws Exception {
assertTrue(getApi().deleteContainerIfEmpty("dbienf"));
}
@Test
public void testDeleteContainerIfEmptyContainerFoundAndEmpty() throws Exception {
String containerName = getContainerName();
try {
assertTrue(getApi().deleteContainerIfEmpty(containerName));
} finally {
recycleContainer(containerName);
}
}
@Test
public void testDeleteContainerIfEmptyContainerFoundAndNotEmpty() throws Exception {
String containerName = getContainerName();
try {
String data = "foo";
getApi().putObject(containerName, newSwiftObject(data, "foo"));
assertFalse(getApi().deleteContainerIfEmpty(containerName));
} finally {
returnContainer(containerName);
}
}
@Test