Skip to content

Commit c8205fb

Browse files
committed
Fix
1 parent 0c4ec24 commit c8205fb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/action/profile/ProfileHasPrivilegesRequestTests.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import java.util.List;
2020
import java.util.Locale;
21+
import java.util.Set;
22+
import java.util.stream.Collectors;
2123

2224
import static org.hamcrest.Matchers.contains;
2325
import static org.hamcrest.Matchers.hasItem;
@@ -134,13 +136,20 @@ private static RoleDescriptor.IndicesPrivileges[] randomIndicesPrivileges(boolea
134136
)];
135137
for (int i = 0; i < indicesPrivileges.length; i++) {
136138
indicesPrivileges[i] = RoleDescriptor.IndicesPrivileges.builder()
137-
.privileges(randomSubsetOf(randomIntBetween(1, 5), IndexPrivilege.names()))
139+
.privileges(randomSubsetOf(randomIntBetween(1, 5), validPrivilegeNames()))
138140
.indices(randomList(1, 3, () -> randomAlphaOfLengthBetween(2, 8) + (randomBoolean() ? "*" : "")))
139141
.build();
140142
}
141143
return indicesPrivileges;
142144
}
143145

146+
private static Set<String> validPrivilegeNames() {
147+
return IndexPrivilege.names()
148+
.stream()
149+
.filter(name -> false == name.equals("read_failure_store") && false == name.equals("manage_failure_store"))
150+
.collect(Collectors.toSet());
151+
}
152+
144153
private static RoleDescriptor.ApplicationResourcePrivileges[] randomApplicationResourcePrivileges(boolean allowEmpty) {
145154
RoleDescriptor.ApplicationResourcePrivileges[] appPrivileges = new RoleDescriptor.ApplicationResourcePrivileges[randomIntBetween(
146155
allowEmpty ? 0 : 1,

0 commit comments

Comments
 (0)