[TEST] Correctly verify that aliases were deleted in MlJobIT
This fixes `testDeleteJobAfterMissingAliases` to not fail randomly. The reason the test was failing is that at some point some aliases are deleted and the cat-aliases API is called to verify they were indeed deleted. This was checked by asserting an index_not_found_exception was thrown by the cat-aliases request. This was some times working as there were no other aliases. However, that depends on whether other x-pack features had time to create their infrastructure. For example, security creates an alias. When other aliases had the time to be created, the cat-aliases request does not fail and the test fails. This commit simply changes the verification that the read/write aliases were deleted by replacing the cat-aliases request with two single get-alias requests. Original commit: elastic/x-pack-elasticsearch@fe2c7b0cb4
This commit is contained in:
parent
fff72256a5
commit
05a73a32bd
|
@ -444,8 +444,9 @@ public class MlJobIT extends ESRestTestCase {
|
|||
response = client().performRequest("delete", indexName + "/_alias/" + writeAliasName);
|
||||
assertEquals(200, response.getStatusLine().getStatusCode());
|
||||
|
||||
// check alias was deleted
|
||||
expectThrows(ResponseException.class, () -> client().performRequest("get", "_cat/aliases"));
|
||||
// check aliases were deleted
|
||||
expectThrows(ResponseException.class, () -> client().performRequest("get", indexName + "/_alias/" + readAliasName));
|
||||
expectThrows(ResponseException.class, () -> client().performRequest("get", indexName + "/_alias/" + writeAliasName));
|
||||
|
||||
response = client().performRequest("delete", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId);
|
||||
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
|
||||
|
|
Loading…
Reference in New Issue