[test] generate unique user names (#36179)

This commit is contained in:
Andy Bristol 2018-12-03 15:08:00 -08:00 committed by GitHub
parent 05d52b222f
commit a6ff9f7f66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 5 deletions

View File

@ -59,11 +59,9 @@ public class UserFunctionIT extends ESRestTestCase {
private void setUpUsers() throws IOException { private void setUpUsers() throws IOException {
int usersCount = name.getMethodName().startsWith("testSingle") ? 1 : randomIntBetween(5, 15); int usersCount = name.getMethodName().startsWith("testSingle") ? 1 : randomIntBetween(5, 15);
users = new ArrayList<String>(usersCount); users = new ArrayList<String>(usersCount);
users.addAll(randomUnique(() -> randomAlphaOfLengthBetween(1, 15), usersCount));
for(int i = 0; i < usersCount; i++) { for (String user : users) {
String randomUserName = randomAlphaOfLengthBetween(1, 15); createUser(user, MINIMAL_ACCESS_ROLE);
users.add(randomUserName);
createUser(randomUserName, MINIMAL_ACCESS_ROLE);
} }
} }