Ignore non-existent container in deleteContainer

All other blobstore providers allow this operation.  Further this
matches the behavior of TransientStorageStrategy.deleteContainer.
This commit prevents a spurious error message from
deleteContainerOrWarnIfUnable after test suite completion.
This commit is contained in:
Andrew Gaul 2014-09-08 18:27:08 -07:00
parent ac22383648
commit fc4b072a26
3 changed files with 6 additions and 11 deletions

View File

@ -131,6 +131,9 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
@Override @Override
public void deleteContainer(String container) { public void deleteContainer(String container) {
filesystemContainerNameValidator.validate(container); filesystemContainerNameValidator.validate(container);
if (!containerExists(container)) {
return;
}
deleteDirectory(container, null); deleteDirectory(container, null);
} }

View File

@ -620,11 +620,7 @@ public class FilesystemAsyncBlobStoreTest {
} }
public void testDeleteContainer_NotExistingContainer() { public void testDeleteContainer_NotExistingContainer() {
try { blobStore.deleteContainer(CONTAINER_NAME);
blobStore.deleteContainer(CONTAINER_NAME);
fail("No error when container doesn't exist");
} catch (Exception e) {
}
} }
public void testDeleteContainer_EmptyContanier() { public void testDeleteContainer_EmptyContanier() {

View File

@ -282,12 +282,8 @@ public class FilesystemStorageStrategyImplTest {
TestUtils.directoryExists(CONTAINER_NAME, false); TestUtils.directoryExists(CONTAINER_NAME, false);
} }
public void testDeleteContainer_ErrorWhenNotExists() { public void testDeleteContainerNoErrorWhenNotExists() {
try { storageStrategy.deleteContainer(CONTAINER_NAME);
storageStrategy.deleteContainer(CONTAINER_NAME);
fail("Exception not throwed");
} catch (Exception e) {
}
} }
public void testGetAllContainerNames() { public void testGetAllContainerNames() {