test: handle case where security index only exists in one tribe
Original commit: elastic/x-pack-elasticsearch@94f011387f
This commit is contained in:
parent
52b7170121
commit
abc789c887
|
@ -235,12 +235,22 @@ public class SecurityTribeIT extends NativeRealmIntegTestCase {
|
||||||
assertNoTimeout(response);
|
assertNoTimeout(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String username : shouldFailUsers) {
|
if (shouldBeSuccessfulUsers.isEmpty()) {
|
||||||
ElasticsearchSecurityException e = expectThrows(ElasticsearchSecurityException.class, () ->
|
// there is no security index so these users can authenticate...
|
||||||
tribeClient.filterWithHeader(Collections.singletonMap("Authorization",
|
for (String username : shouldFailUsers) {
|
||||||
UsernamePasswordToken.basicAuthHeaderValue(username, new SecuredString("password".toCharArray()))))
|
ClusterHealthResponse response = tribeClient.filterWithHeader(Collections.singletonMap("Authorization",
|
||||||
.admin().cluster().prepareHealth().get());
|
UsernamePasswordToken.basicAuthHeaderValue(username, new SecuredString("password".toCharArray()))))
|
||||||
assertThat(e.getMessage(), containsString("authenticate"));
|
.admin().cluster().prepareHealth().get();
|
||||||
|
assertNoTimeout(response);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (String username : shouldFailUsers) {
|
||||||
|
ElasticsearchSecurityException e = expectThrows(ElasticsearchSecurityException.class, () ->
|
||||||
|
tribeClient.filterWithHeader(Collections.singletonMap("Authorization",
|
||||||
|
UsernamePasswordToken.basicAuthHeaderValue(username, new SecuredString("password".toCharArray()))))
|
||||||
|
.admin().cluster().prepareHealth().get());
|
||||||
|
assertThat(e.getMessage(), containsString("authenticate"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue