Add indices options tests to search api REST tests (#21701)

This is a followup to #21689 where we removed a misplaced try catch for IndexMissingException and IndexClosedException which was related to #9047 (at least for the index closed case). The code block within the change was moved as part of #20890, which made the catch redundant. It was somehow used before (e.g. in 5.0) but it doesn't seem that this catch had any effect. Added tests to verify that. In fact a specific catch added to the search api only would defeat the purpose of having common indices options that work throughout all our APIs.

Relates to #21689
This commit is contained in:
Luca Cavanna 2016-11-21 14:52:43 +01:00 committed by GitHub
parent 3ef7f0dec6
commit c174e364a4
2 changed files with 63 additions and 7 deletions

View File

@ -1,7 +0,0 @@
---
"Missing index with catch":
- do:
catch: /logstash-\d{4}\.\d{2}\.\d{2}/
search:
index: <logstash-{now/M}>

View File

@ -0,0 +1,63 @@
---
"Missing index date math with catch":
- do:
catch: /logstash-\d{4}\.\d{2}\.\d{2}/
search:
index: <logstash-{now/M}>
---
"Missing index":
- do:
catch: missing
search:
index: missing_index
- do:
search:
index: missing_index
ignore_unavailable: true
- match: {hits.total: 0}
---
"Closed index":
- do:
indices.create:
index: index_closed
- do:
indices.close:
index: index_closed
- do:
catch: /index_closed_exception/
search:
index: index_closed
- do:
search:
index: index_closed
ignore_unavailable: true
- match: {hits.total: 0}
- do:
search:
index: index*
- match: {hits.total: 0}
- do:
catch: missing
search:
index: index*
allow_no_indices: false
- do:
catch: /index_closed_exception/
search:
index: index*
expand_wildcards: ["open","closed"]