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 c444b5bf72
commit db5209c043
2 changed files with 25 additions and 4 deletions

View File

@ -237,8 +237,7 @@ public class SwiftAsyncBlobStore extends BaseAsyncBlobStore {
@Override @Override
protected boolean deleteAndVerifyContainerGone(String container) { protected boolean deleteAndVerifyContainerGone(String container) {
sync.deleteContainerIfEmpty(container); return sync.deleteContainerIfEmpty(container);
return !sync.containerExists(container);
} }
@Override @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 * this method overrides containerName to ensure it isn't found
*/ */
@Test(groups = { "integration", "live" }) @Test(groups = { "integration", "live" })
public void deleteContainerIfEmptyNotFound() throws Exception { public void testDeleteContainerIfEmptyContainerNotFound() throws Exception {
assert getApi().deleteContainerIfEmpty("dbienf"); 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 @Test