Skip to content

Commit f6a68e9

Browse files
committed
Fix SecurityIndexReaderWrapperUnitTests
1 parent f11cc4d commit f6a68e9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/accesscontrol/SecurityIndexReaderWrapperUnitTests.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
import org.elasticsearch.common.settings.Settings;
1515
import org.elasticsearch.common.util.concurrent.ThreadContext;
1616
import org.elasticsearch.index.Index;
17+
import org.elasticsearch.index.IndexVersion;
1718
import org.elasticsearch.index.mapper.FieldNamesFieldMapper;
1819
import org.elasticsearch.index.mapper.SeqNoFieldMapper;
1920
import org.elasticsearch.index.mapper.SourceFieldMapper;
21+
import org.elasticsearch.index.query.SearchExecutionContext;
2022
import org.elasticsearch.index.shard.IndexShard;
2123
import org.elasticsearch.index.shard.ShardId;
2224
import org.elasticsearch.indices.IndicesModule;
@@ -86,7 +88,16 @@ public void tearDown() throws Exception {
8688
}
8789

8890
public void testDefaultMetaFields() {
89-
securityIndexReaderWrapper = new SecurityIndexReaderWrapper(null, null, securityContext, licenseState, scriptService) {
91+
var searchExecutionContext = mock(SearchExecutionContext.class);
92+
when(searchExecutionContext.indexVersionCreated()).thenReturn(IndexVersion.current());
93+
94+
securityIndexReaderWrapper = new SecurityIndexReaderWrapper(
95+
id -> searchExecutionContext,
96+
null,
97+
securityContext,
98+
licenseState,
99+
scriptService
100+
) {
90101
@Override
91102
protected IndicesAccessControl getIndicesAccessControl() {
92103
IndicesAccessControl.IndexAccessControl indexAccessControl = new IndicesAccessControl.IndexAccessControl(

0 commit comments

Comments
 (0)