Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEST] fix SecurityDocumentationIT#testGetUsers #36622

Merged
merged 1 commit into from
Dec 14, 2018
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 @@ -114,9 +114,9 @@ public class SecurityDocumentationIT extends ESRestHighLevelClientTestCase {
public void testGetUsers() throws Exception {
final RestHighLevelClient client = highLevelClient();
String[] usernames = new String[] {"user1", "user2", "user3"};
addUser(client, usernames[0], randomAlphaOfLength(4));
addUser(client, usernames[1], randomAlphaOfLength(4));
addUser(client, usernames[2], randomAlphaOfLength(4));
addUser(client, usernames[0], randomAlphaOfLengthBetween(6, 10));
addUser(client, usernames[1], randomAlphaOfLengthBetween(6, 10));
addUser(client, usernames[2], randomAlphaOfLengthBetween(6, 10));
{
//tag::get-users-request
GetUsersRequest request = new GetUsersRequest(usernames[0]);
Expand All @@ -131,7 +131,7 @@ public void testGetUsers() throws Exception {

assertNotNull(response);
assertThat(users.size(), equalTo(1));
assertThat(users.get(0), is(usernames[0]));
assertThat(users.get(0).getUsername(), is(usernames[0]));
}

{
Expand Down Expand Up @@ -159,8 +159,10 @@ public void testGetUsers() throws Exception {
List<User> users = new ArrayList<>(3);
users.addAll(response.getUsers());
assertNotNull(response);
// 4 system users plus the three we created
assertThat(users.size(), equalTo(7));
// 9 users are expected to be returned
// test_users (3): user1, user2, user3
// system_users (6): elastic, beats_system, apm_system, logstash_system, kibana, remote_monitoring_user
assertThat(users.size(), equalTo(9));
}

{
Expand Down