Tests: test GET/DELETE on non existing repo

`GET` and `DELETE` should return `404` error.

Closes #28.
This commit is contained in:
David Pilato 2014-07-31 00:40:47 +02:00
parent 8ea9951e1a
commit 42706653e3

View File

@ -296,6 +296,34 @@ public class AzureSnapshotRestoreITest extends AbstractAzureTest {
}
/**
* For issue #28: https://github.com/elasticsearch/elasticsearch-cloud-azure/issues/28
*/
@Test
public void testGetDeleteNonExistingSnapshot_28() throws StorageException, ServiceException, URISyntaxException {
ClusterAdminClient client = client().admin().cluster();
logger.info("--> creating azure repository without any path");
PutRepositoryResponse putRepositoryResponse = client.preparePutRepository("test-repo").setType("azure")
.setSettings(ImmutableSettings.settingsBuilder()
.put(AzureStorageService.Fields.CONTAINER, getContainerName())
).get();
assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true));
try {
client.prepareGetSnapshots("test-repo").addSnapshots("nonexistingsnapshotname").get();
fail("Shouldn't be here");
} catch (SnapshotMissingException ex) {
// Expected
}
try {
client.prepareDeleteSnapshot("test-repo", "nonexistingsnapshotname").get();
fail("Shouldn't be here");
} catch (SnapshotMissingException ex) {
// Expected
}
}
/**
* For issue #21: https://github.com/elasticsearch/elasticsearch-cloud-azure/issues/21
*/