Skip to content

Commit 45de638

Browse files
committed
Fix test
1 parent 6ac6a49 commit 45de638

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/IndicesAndAliasesResolverTests.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public void setup() {
282282
new RoleDescriptor(
283283
"role",
284284
null,
285-
new IndicesPrivileges[] { IndicesPrivileges.builder().indices(authorizedIndices).privileges("all").build() },
285+
new IndicesPrivileges[] { IndicesPrivileges.builder().indices(authorizedIndices).privileges("all").build(), },
286286
null
287287
)
288288
);
@@ -333,7 +333,9 @@ public void setup() {
333333
new RoleDescriptor(
334334
"data_stream_test2",
335335
null,
336-
new IndicesPrivileges[] { IndicesPrivileges.builder().indices(otherDataStreamName + "*").privileges("all").build() },
336+
new IndicesPrivileges[] {
337+
IndicesPrivileges.builder().indices(otherDataStreamName + "*").privileges("all").build(),
338+
IndicesPrivileges.builder().indices(otherDataStreamName + "*::failures").privileges("all").build() },
337339
null
338340
)
339341
);
@@ -342,7 +344,9 @@ public void setup() {
342344
new RoleDescriptor(
343345
"data_stream_test3",
344346
null,
345-
new IndicesPrivileges[] { IndicesPrivileges.builder().indices("logs*").privileges("all").build() },
347+
new IndicesPrivileges[] {
348+
IndicesPrivileges.builder().indices("logs*").privileges("all").build(),
349+
IndicesPrivileges.builder().indices("logs*::failures").privileges("all").build() },
346350
null
347351
)
348352
);
@@ -2381,14 +2385,15 @@ public void testBackingIndicesAreVisibleWhenIncludedByRequestWithWildcard() {
23812385
final AuthorizedIndices authorizedIndices = buildAuthorizedIndices(user, TransportSearchAction.TYPE.name(), request);
23822386
for (String dsName : expectedDataStreams) {
23832387
DataStream dataStream = metadata.dataStreams().get(dsName);
2384-
assertThat(authorizedIndices.allLegacy().get(), hasItem(dsName));
2388+
Map<String, String> all = authorizedIndices.all().get();
2389+
assertThat(all.keySet(), hasItem(dsName));
23852390
assertThat(authorizedIndices.check(dsName), is(true));
23862391
for (Index i : dataStream.getIndices()) {
2387-
assertThat(authorizedIndices.allLegacy().get(), hasItem(i.getName()));
2392+
assertThat(all.keySet(), hasItem(i.getName()));
23882393
assertThat(authorizedIndices.check(i.getName()), is(true));
23892394
}
23902395
for (Index i : dataStream.getFailureIndices()) {
2391-
assertThat(authorizedIndices.allLegacy().get(), hasItem(i.getName()));
2396+
assertThat(all.keySet(), hasItem(i.getName()));
23922397
assertThat(authorizedIndices.check(i.getName()), is(true));
23932398
}
23942399
}
@@ -2420,15 +2425,17 @@ public void testBackingIndicesAreNotVisibleWhenNotIncludedByRequestWithoutWildca
24202425
// data streams and their backing indices should _not_ be in the authorized list since the backing indices
24212426
// did not match the requested pattern and the request does not support data streams
24222427
final AuthorizedIndices authorizedIndices = buildAuthorizedIndices(user, GetAliasesAction.NAME, request);
2423-
assertThat(authorizedIndices.allLegacy().get(), hasItem(dataStreamName));
2428+
final Map<String, String> all = authorizedIndices.all().get();
2429+
System.out.println("all: " + all);
2430+
assertThat(all.keySet(), hasItem(dataStreamName));
24242431
assertThat(authorizedIndices.check(dataStreamName), is(true));
24252432
DataStream dataStream = metadata.dataStreams().get(dataStreamName);
24262433
for (Index i : dataStream.getIndices()) {
2427-
assertThat(authorizedIndices.allLegacy().get(), hasItem(i.getName()));
2434+
assertThat(all.keySet(), hasItem(i.getName()));
24282435
assertThat(authorizedIndices.check(i.getName()), is(true));
24292436
}
24302437
for (Index i : dataStream.getFailureIndices()) {
2431-
assertThat(authorizedIndices.allLegacy().get(), hasItem(i.getName()));
2438+
assertThat(all.keySet(), hasItem(i.getName()));
24322439
assertThat(authorizedIndices.check(i.getName()), is(true));
24332440
}
24342441

0 commit comments

Comments
 (0)