Skip to content

Commit 9a73179

Browse files
fix failing test
1 parent 601d8f7 commit 9a73179

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

x-pack/plugin/security/qa/security-trial/src/javaRestTest/java/org/elasticsearch/xpack/security/failurestore/FailureStoreSecurityRestIT.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1891,7 +1891,10 @@ public void testWriteAndManageOperations() throws IOException {
18911891

18921892
expectThrows(() -> deleteDataStream(MANAGE_FAILURE_STORE_ACCESS, "test1"), 403);
18931893
// selectors aren't supported for deletes so we get a 403
1894-
expectThrows(() -> deleteDataStream(MANAGE_FAILURE_STORE_ACCESS, "test1::failures"), 403);
1894+
expectThrowsBadRequest(
1895+
() -> deleteDataStream(MANAGE_FAILURE_STORE_ACCESS, "test1::failures"),
1896+
containsString("Index component selectors are not supported in this context but found selector in expression [test1::failures]")
1897+
);
18951898

18961899
// manage user can delete data stream
18971900
deleteDataStream(MANAGE_ACCESS, "test1");
@@ -2345,6 +2348,12 @@ private static void expectThrows(ThrowingRunnable runnable, int statusCode) {
23452348
assertThat(ex.getResponse().getStatusLine().getStatusCode(), equalTo(statusCode));
23462349
}
23472350

2351+
private void expectThrowsBadRequest(ThrowingRunnable runnable, Matcher<String> errorMatcher) {
2352+
ResponseException ex = expectThrows(ResponseException.class, runnable);
2353+
assertThat(ex.getResponse().getStatusLine().getStatusCode(), equalTo(400));
2354+
assertThat(ex.getMessage(), errorMatcher);
2355+
}
2356+
23482357
private void expectThrowsUnauthorized(String user, Search search, Matcher<String> errorMatcher) {
23492358
ResponseException ex = expectThrows(ResponseException.class, () -> performRequestMaybeUsingApiKey(user, search.toSearchRequest()));
23502359
assertThat(ex.getResponse().getStatusLine().getStatusCode(), equalTo(403));

0 commit comments

Comments
 (0)