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
|
@Override
|
||||||
protected boolean deleteAndVerifyContainerGone(String container) {
|
protected boolean deleteAndVerifyContainerGone(String container) {
|
||||||
sync.deleteContainerIfEmpty(container);
|
return sync.deleteContainerIfEmpty(container);
|
||||||
return !sync.containerExists(container);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue