diff --git a/server/src/test/java/org/elasticsearch/index/codec/tsdb/TsdbDocValueBwcTests.java b/server/src/test/java/org/elasticsearch/index/codec/tsdb/TsdbDocValueBwcTests.java index 28282b4c4e038..32b2a90322911 100644 --- a/server/src/test/java/org/elasticsearch/index/codec/tsdb/TsdbDocValueBwcTests.java +++ b/server/src/test/java/org/elasticsearch/index/codec/tsdb/TsdbDocValueBwcTests.java @@ -235,8 +235,15 @@ private IndexWriterConfig getTimeSeriesIndexWriterConfig(String hostnameField, S // A hacky way to figure out whether doc values format is written in what version. Need to use reflection, because // PerFieldDocValuesFormat hides the doc values formats it wraps. - private static void assertOldDocValuesFormatVersion(DirectoryReader reader) throws NoSuchFieldException, IllegalAccessException, - IOException { + private void assertOldDocValuesFormatVersion(DirectoryReader reader) throws NoSuchFieldException, IllegalAccessException, IOException { + if (System.getSecurityManager() != null) { + // With jvm version 24 entitlements are used and security manager is nog longer used. + // Making this assertion work with security manager requires granting the entire test codebase privileges to use + // suppressAccessChecks and accessDeclaredMembers. This is undesired from a security manager perspective. + logger.info("not asserting doc values format version, because security manager is used"); + return; + } + for (var leafReaderContext : reader.leaves()) { var leaf = (SegmentReader) leafReaderContext.reader(); var dvReader = leaf.getDocValuesReader(); @@ -248,8 +255,16 @@ private static void assertOldDocValuesFormatVersion(DirectoryReader reader) thro } } - private static void assertNewDocValuesFormatVersion(DirectoryReader reader) throws NoSuchFieldException, IllegalAccessException, - IOException, ClassNotFoundException { + private void assertNewDocValuesFormatVersion(DirectoryReader reader) throws NoSuchFieldException, IllegalAccessException, IOException, + ClassNotFoundException { + if (System.getSecurityManager() != null) { + // With jvm version 24 entitlements are used and security manager is nog longer used. + // Making this assertion work with security manager requires granting the entire test codebase privileges to use + // suppressAccessChecks and suppressAccessChecks. This is undesired from a security manager perspective. + logger.info("not asserting doc values format version, because security manager is used"); + return; + } + for (var leafReaderContext : reader.leaves()) { var leaf = (SegmentReader) leafReaderContext.reader(); var dvReader = leaf.getDocValuesReader();