mirror of https://github.com/apache/jclouds.git
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:
parent
c444b5bf72
commit
db5209c043
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue