mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 01:22:26 -04:00
Skip SM policy tests for JDK 24 when Security Manager is not available anymore (#122828)
This commit is contained in:
parent
e16664573e
commit
d78bfe8f6e
3 changed files with 11 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
|||
package org.elasticsearch.bootstrap;
|
||||
|
||||
import org.elasticsearch.core.SuppressForbidden;
|
||||
import org.elasticsearch.jdk.RuntimeVersionFeature;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
|
@ -42,6 +43,7 @@ public class ESPolicyUnitTests extends ESTestCase {
|
|||
|
||||
@BeforeClass
|
||||
public static void setupPolicy() {
|
||||
assumeTrue("test requires security manager to be supported", RuntimeVersionFeature.isSecurityManagerAvailable());
|
||||
assumeTrue("test cannot run with security manager", System.getSecurityManager() == null);
|
||||
DEFAULT_POLICY = PolicyUtil.readPolicy(ESPolicy.class.getResource(POLICY_RESOURCE), TEST_CODEBASES);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
package org.elasticsearch.bootstrap;
|
||||
|
||||
import org.elasticsearch.core.SuppressForbidden;
|
||||
import org.elasticsearch.jdk.RuntimeVersionFeature;
|
||||
import org.elasticsearch.plugins.PluginDescriptor;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.junit.Before;
|
||||
|
@ -40,6 +41,7 @@ public class PolicyUtilTests extends ESTestCase {
|
|||
|
||||
@Before
|
||||
public void assumeSecurityManagerDisabled() {
|
||||
assumeTrue("test requires security manager to be supported", RuntimeVersionFeature.isSecurityManagerAvailable());
|
||||
assumeTrue("test cannot run with security manager enabled", System.getSecurityManager() == null);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,10 @@ package org.elasticsearch.plugins.cli;
|
|||
|
||||
import org.elasticsearch.bootstrap.PluginPolicyInfo;
|
||||
import org.elasticsearch.bootstrap.PolicyUtil;
|
||||
import org.elasticsearch.jdk.RuntimeVersionFeature;
|
||||
import org.elasticsearch.plugins.PluginDescriptor;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
|
@ -26,6 +28,11 @@ import static org.hamcrest.Matchers.containsInAnyOrder;
|
|||
/** Tests plugin manager security check */
|
||||
public class PluginSecurityTests extends ESTestCase {
|
||||
|
||||
@Before
|
||||
public void assumeSecurityManagerSupported() {
|
||||
assumeTrue("test requires security manager to be supported", RuntimeVersionFeature.isSecurityManagerAvailable());
|
||||
}
|
||||
|
||||
PluginPolicyInfo makeDummyPlugin(String policy, String... files) throws IOException {
|
||||
Path plugin = createTempDir();
|
||||
Files.copy(this.getDataPath(policy), plugin.resolve(PluginDescriptor.ES_PLUGIN_POLICY));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue