Skip to content

Commit 4270665

Browse files
committed
Tests: test GET/DELETE on non existing repo
`GET` and `DELETE` should return `404` error. Closes #28.
1 parent 8ea9951 commit 4270665

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/test/java/org/elasticsearch/repositories/azure/AzureSnapshotRestoreITest.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,34 @@ public void testListBlobs_26() throws StorageException, ServiceException, URISyn
296296

297297
}
298298

299+
/**
300+
* For issue #28: https://github.com/elasticsearch/elasticsearch-cloud-azure/issues/28
301+
*/
302+
@Test
303+
public void testGetDeleteNonExistingSnapshot_28() throws StorageException, ServiceException, URISyntaxException {
304+
ClusterAdminClient client = client().admin().cluster();
305+
logger.info("--> creating azure repository without any path");
306+
PutRepositoryResponse putRepositoryResponse = client.preparePutRepository("test-repo").setType("azure")
307+
.setSettings(ImmutableSettings.settingsBuilder()
308+
.put(AzureStorageService.Fields.CONTAINER, getContainerName())
309+
).get();
310+
assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true));
311+
312+
try {
313+
client.prepareGetSnapshots("test-repo").addSnapshots("nonexistingsnapshotname").get();
314+
fail("Shouldn't be here");
315+
} catch (SnapshotMissingException ex) {
316+
// Expected
317+
}
318+
319+
try {
320+
client.prepareDeleteSnapshot("test-repo", "nonexistingsnapshotname").get();
321+
fail("Shouldn't be here");
322+
} catch (SnapshotMissingException ex) {
323+
// Expected
324+
}
325+
}
326+
299327
/**
300328
* For issue #21: https://github.com/elasticsearch/elasticsearch-cloud-azure/issues/21
301329
*/

0 commit comments

Comments
 (0)