Closed barbulescu closed 5 months ago
Describe the bug
Delete index failures are ignored as response from HTTP delete status is not checked.
To Reproduce
class DeleteIndexTest : SearchTestBase() { @Test fun deleteFailsWhenIndexIsNotAvailable() = coRun { val indexName = randomIndexName() val exception = shouldThrow<RestException> { client.deleteIndex(indexName) } exception.status shouldBe 404 exception.message shouldContain "index_not_found_exception" } }
Expected behavior
HTTP status should be checked and exception thrown if it is not success.
On the ES docs the default behaviour is to fail, but this can be changed by setting ignore_unavailable to true.
ignore_unavailable
true
Your context
Will you be able to help with a pull request?
Yes. Should we check status on RestClient.doRequest and throw RestException on failure?
RestClient.doRequest
Nice catch. There may be more places in the code where things could fail. Might be something that we can generalize with an interface and extension function perhaps?
Describe the bug
Delete index failures are ignored as response from HTTP delete status is not checked.
To Reproduce
Expected behavior
HTTP status should be checked and exception thrown if it is not success.
On the ES docs the default behaviour is to fail, but this can be changed by setting
ignore_unavailable
totrue
.Your context
Will you be able to help with a pull request?
Yes. Should we check status on
RestClient.doRequest
and throw RestException on failure?