Skip to content

New tests for protected indices feature#5865

Merged
shikharj05 merged 2 commits intoopensearch-project:mainfrom
nibix:protected-index-tests
Jan 7, 2026
Merged

New tests for protected indices feature#5865
shikharj05 merged 2 commits intoopensearch-project:mainfrom
nibix:protected-index-tests

Conversation

@nibix
Copy link
Collaborator

@nibix nibix commented Dec 18, 2025

Description

Another PR for preparing the improved index resolution feature #5827 ; this adds new tests for the protected index feature. This allows us to easily test the new implementation in the future.

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@nibix
Copy link
Collaborator Author

nibix commented Dec 18, 2025

Suddenly these tests started failing, without having touched them. So far I am clueless why this is happening.

2025-12-18T12:52:05.8205950Z SnapshotAuthorizationIntTests > restore_singleIndex_rename1 {legacy_system_index_perm, no index privileges} FAILED
2025-12-18T12:52:05.8207205Z     java.lang.IllegalStateException: running tests but failed to invoke RandomizedContext#getRandom
2025-12-18T12:52:05.8208387Z         at __randomizedtesting.SeedInfo.seed([3256F169ACE73036:8577C397962802CF]:0)
2025-12-18T12:52:05.8209138Z         at org.opensearch.common.Randomness.get(Randomness.java:123)
2025-12-18T12:52:05.8210081Z         at org.opensearch.cluster.routing.IndexShardRoutingTable.<init>(IndexShardRoutingTable.java:114)
2025-12-18T12:52:05.8211324Z         at org.opensearch.cluster.routing.IndexShardRoutingTable$Builder.build(IndexShardRoutingTable.java:1148)
2025-12-18T12:52:05.8214123Z         at org.opensearch.cluster.routing.IndexRoutingTable$Builder.initializeEmpty(IndexRoutingTable.java:681)
2025-12-18T12:52:05.8215561Z         at org.opensearch.cluster.routing.IndexRoutingTable$Builder.initializeAsNew(IndexRoutingTable.java:428)
2025-12-18T12:52:05.8216577Z         at org.opensearch.cluster.routing.RoutingTable$Builder.addAsNew(RoutingTable.java:607)
2025-12-18T12:52:05.8217806Z         at org.opensearch.cluster.metadata.MetadataCreateIndexService.clusterStateCreateIndex(MetadataCreateIndexService.java:1361)
2025-12-18T12:52:05.8219584Z         at org.opensearch.cluster.metadata.MetadataCreateIndexService.lambda$applyCreateIndexWithTemporaryService$3(MetadataCreateIndexService.java:575)
2025-12-18T12:52:05.8221077Z         at org.opensearch.indices.IndicesService.withTempIndexService(IndicesService.java:1055)
2025-12-18T12:52:05.8222719Z         at org.opensearch.cluster.metadata.MetadataCreateIndexService.applyCreateIndexWithTemporaryService(MetadataCreateIndexService.java:526)
2025-12-18T12:52:05.8224647Z         at org.opensearch.cluster.metadata.MetadataCreateIndexService.applyCreateIndexRequestWithV1Templates(MetadataCreateIndexService.java:757)
2025-12-18T12:52:05.8226468Z         at org.opensearch.cluster.metadata.MetadataCreateIndexService.applyCreateIndexRequest(MetadataCreateIndexService.java:488)
2025-12-18T12:52:05.8228140Z         at org.opensearch.cluster.metadata.MetadataCreateIndexService.applyCreateIndexRequest(MetadataCreateIndexService.java:495)
2025-12-18T12:52:05.8229670Z         at org.opensearch.cluster.metadata.MetadataCreateIndexService$1.execute(MetadataCreateIndexService.java:395)
2025-12-18T12:52:05.8230929Z         at org.opensearch.cluster.ClusterStateUpdateTask.execute(ClusterStateUpdateTask.java:67)
2025-12-18T12:52:05.8232325Z         at org.opensearch.cluster.service.ClusterManagerService.executeTasks(ClusterManagerService.java:890)
2025-12-18T12:52:05.8233692Z         at org.opensearch.cluster.service.ClusterManagerService.calculateTaskOutputs(ClusterManagerService.java:441)
2025-12-18T12:52:05.8234993Z         at org.opensearch.cluster.service.ClusterManagerService.runTasks(ClusterManagerService.java:301)
2025-12-18T12:52:05.8236318Z         at org.opensearch.cluster.service.ClusterManagerService$Batcher.run(ClusterManagerService.java:214)
2025-12-18T12:52:05.8237371Z         at org.opensearch.cluster.service.TaskBatcher.runIfNotProcessed(TaskBatcher.java:206)
2025-12-18T12:52:05.8238295Z         at org.opensearch.cluster.service.TaskBatcher$BatchedTask.run(TaskBatcher.java:264)
2025-12-18T12:52:05.8239357Z         at org.opensearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:916)
2025-12-18T12:52:05.8241268Z         at org.opensearch.common.util.concurrent.PrioritizedOpenSearchThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedOpenSearchThreadPoolExecutor.java:299)
2025-12-18T12:52:05.8243836Z         at org.opensearch.common.util.concurrent.PrioritizedOpenSearchThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedOpenSearchThreadPoolExecutor.java:262)
2025-12-18T12:52:05.8245531Z         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
2025-12-18T12:52:05.8246513Z         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
2025-12-18T12:52:05.8247291Z         at java.base/java.lang.Thread.run(Thread.java:1583)
2025-12-18T12:52:05.8247788Z 
2025-12-18T12:52:05.8247902Z         Caused by:
2025-12-18T12:52:05.8248262Z         java.lang.reflect.InvocationTargetException
2025-12-18T12:52:05.8249161Z             at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
2025-12-18T12:52:05.8250122Z             at java.base/java.lang.reflect.Method.invoke(Method.java:580)
2025-12-18T12:52:05.8250782Z             at org.opensearch.common.Randomness.get(Randomness.java:119)
2025-12-18T12:52:05.8251288Z             ... 26 more
2025-12-18T12:52:05.8251472Z 
2025-12-18T12:52:05.8251577Z             Caused by:
2025-12-18T12:52:05.8255525Z             java.lang.IllegalStateException: No context information for thread: Thread[id=5929, name=opensearch[cluster_manager_0][clusterManagerService#updateTask][T#1], state=RUNNABLE, group=TGRP-IndexAuthorizationWithClosedIndicesIntTests]. Is this thread running under a class com.carrotsearch.randomizedtesting.RandomizedRunner runner context? Add @RunWith(class com.carrotsearch.randomizedtesting.RandomizedRunner.class) to your test class. Make sure your code accesses random contexts within @BeforeClass and @AfterClass boundary (for example, static test class initializers are not permitted to access random contexts).
2025-12-18T12:52:05.8259631Z                 at com.carrotsearch.randomizedtesting.RandomizedContext.context(RandomizedContext.java:249)
2025-12-18T12:52:05.8260754Z                 at com.carrotsearch.randomizedtesting.RandomizedContext.current(RandomizedContext.java:134)
2025-12-18T12:52:05.8261946Z                 at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
2025-12-18T12:52:05.8263390Z                 ... 28 more
2025-12-18T12:52:05.8263616Z 

@cwperks
Copy link
Member

cwperks commented Dec 18, 2025

Taking a look at the tests

@cwperks
Copy link
Member

cwperks commented Dec 18, 2025

@nibix are the test failures only showing on Github? I was not able to reproduce on my mac, but will also try on linux to see if its reproducible there

@nibix
Copy link
Collaborator Author

nibix commented Dec 18, 2025

I could not reproduce it locally, so far. This is mysterious indeed.

@nibix
Copy link
Collaborator Author

nibix commented Dec 23, 2025

Merging #5869 first would fix the tests. I am still clueless regarding any other ways to fix the tests.

@nibix nibix force-pushed the protected-index-tests branch from 7c01bad to 93ea822 Compare December 27, 2025 15:14
Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
@nibix nibix force-pushed the protected-index-tests branch from 93ea822 to 962af3a Compare December 27, 2025 15:24
@codecov
Copy link

codecov bot commented Dec 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.72%. Comparing base (7f168b1) to head (76ea28b).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5865      +/-   ##
==========================================
+ Coverage   73.68%   73.72%   +0.04%     
==========================================
  Files         438      438              
  Lines       26649    26649              
  Branches     3939     3939              
==========================================
+ Hits        19635    19646      +11     
+ Misses       5141     5128      -13     
- Partials     1873     1875       +2     

see 12 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…currency issue

Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
@nibix nibix force-pushed the protected-index-tests branch from 895748b to 76ea28b Compare December 29, 2025 07:13
@nibix
Copy link
Collaborator Author

nibix commented Dec 29, 2025

@cwperks @DarshitChanpura @shikharj05 I could now resolve the issues with this test PR. It contains now an additional commit to fix issues with concurrent test execution. Would you be available to review this? Thank you :)

@nibix
Copy link
Collaborator Author

nibix commented Jan 6, 2026

@DarshitChanpura @shikharj05 @derek-ho @willyborankin

would you be able to review this? merging this is needed to both unblock #5895 and #5827

@shikharj05 shikharj05 merged commit f05045f into opensearch-project:main Jan 7, 2026
114 of 117 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants