test: handle case where security index only exists in one tribe

Original commit: elastic/x-pack-elasticsearch@94f011387f
This commit is contained in:
jaymode 2016-10-03 11:27:15 -04:00
parent 52b7170121
commit abc789c887

View File

@ -235,6 +235,15 @@ public class SecurityTribeIT extends NativeRealmIntegTestCase {
assertNoTimeout(response);
}
if (shouldBeSuccessfulUsers.isEmpty()) {
// there is no security index so these users can authenticate...
for (String username : shouldFailUsers) {
ClusterHealthResponse response = tribeClient.filterWithHeader(Collections.singletonMap("Authorization",
UsernamePasswordToken.basicAuthHeaderValue(username, new SecuredString("password".toCharArray()))))
.admin().cluster().prepareHealth().get();
assertNoTimeout(response);
}
} else {
for (String username : shouldFailUsers) {
ElasticsearchSecurityException e = expectThrows(ElasticsearchSecurityException.class, () ->
tribeClient.filterWithHeader(Collections.singletonMap("Authorization",
@ -243,6 +252,7 @@ public class SecurityTribeIT extends NativeRealmIntegTestCase {
assertThat(e.getMessage(), containsString("authenticate"));
}
}
}
public void testUserModificationUsingTribeNodeAreDisabled() throws Exception {
setupTribeNode(Settings.EMPTY);