Skip to content

Commit a6ff9f7

Browse files
[test] generate unique user names (elastic#36179)
1 parent 05d52b2 commit a6ff9f7

File tree

1 file changed

+3
-5
lines changed
  • x-pack/plugin/sql/qa/security/src/test/java/org/elasticsearch/xpack/sql/qa/security

1 file changed

+3
-5
lines changed

x-pack/plugin/sql/qa/security/src/test/java/org/elasticsearch/xpack/sql/qa/security/UserFunctionIT.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,9 @@ protected String getProtocol() {
5959
private void setUpUsers() throws IOException {
6060
int usersCount = name.getMethodName().startsWith("testSingle") ? 1 : randomIntBetween(5, 15);
6161
users = new ArrayList<String>(usersCount);
62-
63-
for(int i = 0; i < usersCount; i++) {
64-
String randomUserName = randomAlphaOfLengthBetween(1, 15);
65-
users.add(randomUserName);
66-
createUser(randomUserName, MINIMAL_ACCESS_ROLE);
62+
users.addAll(randomUnique(() -> randomAlphaOfLengthBetween(1, 15), usersCount));
63+
for (String user : users) {
64+
createUser(user, MINIMAL_ACCESS_ROLE);
6765
}
6866
}
6967

0 commit comments

Comments
 (0)