@@ -84,6 +84,16 @@ public class DataStreamAuthorizationReadOnlyIntTests {
8484 openSearchSecurityConfigIndex ()
8585 );
8686
87+ static final List <TestIndexOrAliasOrDatastream > ALL_INDICES_EXCEPT_SYSTEM_INDICES = List .of (
88+ ds_a1 ,
89+ ds_a2 ,
90+ ds_a3 ,
91+ ds_b1 ,
92+ ds_b2 ,
93+ ds_b3 ,
94+ index_c1
95+ );
96+
8797 static final List <TestIndexOrAliasOrDatastream > ALL_DATA_STREAMS = List .of (ds_a1 , ds_a2 , ds_a3 , ds_b1 , ds_b2 , ds_b3 );
8898
8999 /**
@@ -236,7 +246,7 @@ public void search_noPattern() throws Exception {
236246 TestRestClient .HttpResponse httpResponse = restClient .get ("_search?size=1000" );
237247 assertThat (
238248 httpResponse ,
239- containsExactly (ds_a1 , ds_a2 , ds_a3 , ds_b1 , ds_b2 , ds_b3 , index_c1 ).at ("hits.hits[*]._index" )
249+ containsExactly (ALL_INDICES_EXCEPT_SYSTEM_INDICES ).at ("hits.hits[*]._index" )
240250 .reducedBy (user .reference (READ ))
241251 .whenEmpty (clusterConfig .allowsEmptyResultSets ? isOk () : isForbidden ())
242252 );
@@ -270,7 +280,7 @@ public void search_noPattern_allowNoIndicesFalse() throws Exception {
270280
271281 assertThat (
272282 httpResponse ,
273- containsExactly (ALL_INDICES ).at ("hits.hits[*]._index" )
283+ containsExactly (ALL_INDICES_EXCEPT_SYSTEM_INDICES ).at ("hits.hits[*]._index" )
274284 .reducedBy (user .reference (READ ))
275285 .whenEmpty (clusterConfig .allowsEmptyResultSets ? isNotFound () : isForbidden ())
276286 );
@@ -283,7 +293,7 @@ public void search_all() throws Exception {
283293 TestRestClient .HttpResponse httpResponse = restClient .get ("_all/_search?size=1000" );
284294 assertThat (
285295 httpResponse ,
286- containsExactly (ALL_INDICES ).at ("hits.hits[*]._index" )
296+ containsExactly (ALL_INDICES_EXCEPT_SYSTEM_INDICES ).at ("hits.hits[*]._index" )
287297 .reducedBy (user .reference (READ ))
288298 .whenEmpty (clusterConfig .allowsEmptyResultSets ? isOk () : isForbidden ())
289299 );
@@ -314,9 +324,10 @@ public void search_all_noWildcards() throws Exception {
314324 public void search_wildcard () throws Exception {
315325 try (TestRestClient restClient = cluster .getRestClient (user )) {
316326 TestRestClient .HttpResponse httpResponse = restClient .get ("*/_search?size=1000" );
327+
317328 assertThat (
318329 httpResponse ,
319- containsExactly (ALL_INDICES ).at ("hits.hits[*]._index" )
330+ containsExactly (ALL_INDICES_EXCEPT_SYSTEM_INDICES ).at ("hits.hits[*]._index" )
320331 .reducedBy (user .reference (READ ))
321332 .whenEmpty (clusterConfig .allowsEmptyResultSets ? isOk () : isForbidden ())
322333 );
@@ -523,7 +534,9 @@ public void search_termsAggregation_index() throws Exception {
523534 if (user == SUPER_UNLIMITED_USER || user == UNLIMITED_USER ) {
524535 assertThat (
525536 httpResponse ,
526- containsExactly (ALL_INDICES ).at ("aggregations.indices.buckets[*].key" ).reducedBy (user .reference (READ )).whenEmpty (isOk ())
537+ containsExactly (ALL_INDICES_EXCEPT_SYSTEM_INDICES ).at ("aggregations.indices.buckets[*].key" )
538+ .reducedBy (user .reference (READ ))
539+ .whenEmpty (isOk ())
527540 );
528541 } else {
529542 // Users without full privileges will not see hidden indices here; thus on a cluster with only data streams, the result is
@@ -558,7 +571,7 @@ public void index_stats_all() throws Exception {
558571 TestRestClient .HttpResponse httpResponse = restClient .get ("_stats" );
559572 assertThat (
560573 httpResponse ,
561- containsExactly (ALL_INDICES ).at ("indices.keys()" )
574+ containsExactly (ALL_INDICES_EXCEPT_SYSTEM_INDICES ).at ("indices.keys()" )
562575 .reducedBy (user .reference (READ ))
563576 .whenEmpty (clusterConfig .allowsEmptyResultSets ? isOk () : isForbidden ())
564577 );
@@ -690,7 +703,7 @@ public void resolve_wildcard() throws Exception {
690703 TestRestClient .HttpResponse httpResponse = restClient .get ("_resolve/index/*" );
691704 assertThat (
692705 httpResponse ,
693- containsExactly (ALL_INDICES ).at ("$.*[*].name" )
706+ containsExactly (ALL_INDICES_EXCEPT_SYSTEM_INDICES ).at ("$.*[*].name" )
694707 .reducedBy (user .reference (READ ))
695708 .whenEmpty (clusterConfig .allowsEmptyResultSets ? isOk () : isForbidden ())
696709 );
@@ -716,7 +729,7 @@ public void field_caps_all() throws Exception {
716729 TestRestClient .HttpResponse httpResponse = restClient .get ("_field_caps?fields=*" );
717730 assertThat (
718731 httpResponse ,
719- containsExactly (ALL_INDICES ).at ("indices" )
732+ containsExactly (ALL_INDICES_EXCEPT_SYSTEM_INDICES ).at ("indices" )
720733 .reducedBy (user .reference (READ ))
721734 .whenEmpty (clusterConfig .allowsEmptyResultSets ? isOk () : isForbidden ())
722735 );
0 commit comments