Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ public void testRoleMigration() throws Exception {
assertMigratedDocInSecurityIndex(mixed1TestRole, "meta", "test");
assertMigratedDocInSecurityIndex(mixed2TestRole, "meta", "test");
assertMigratedDocInSecurityIndex(upgradedTestRole, "meta", "test");
// queries all roles by metadata
assertAllRoles(client(), "mixed1-test-role", "mixed2-test-role", "old-test-role", "upgraded-test-role");
// query all roles by metadata - use assertBusy to handle the case where the node handling the query is not yet aware of the
// successful migration
assertBusy(() -> assertAllRoles(client(), "mixed1-test-role", "mixed2-test-role", "old-test-role", "upgraded-test-role"));
}
}

Expand Down Expand Up @@ -175,7 +176,13 @@ private void assertAllRoles(RestClient client, String... roleNames) throws IOExc
{"query":{"bool":{"must":[{"exists":{"field":"metadata.meta"}}]}},"sort":["name"]}""";
Request request = new Request(randomFrom("POST", "GET"), "/_security/_query/role");
request.setJsonEntity(metadataQuery);
Response response = client.performRequest(request);
Response response = null;
try {
response = client.performRequest(request);
} catch (ResponseException e) {
fail(e);
}
assertNotNull(response);
assertOK(response);
Map<String, Object> responseMap = responseAsMap(response);
assertThat(responseMap.get("total"), is(roleNames.length));
Expand Down