Skip to content

Commit d5e24df

Browse files
authored
Remove security manager from tests (#127087) (#127175)
Now that entitlements are always used, there is no need to run tests with security manager (a future enhancement will run tests with entitlements). This commit removes setting up security manager from tests.
1 parent 9f07014 commit d5e24df

File tree

24 files changed

+4
-318
lines changed

24 files changed

+4
-318
lines changed

distribution/tools/server-cli/src/test/java/org/elasticsearch/server/cli/APMJvmOptionsTests.java

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import static org.mockito.Mockito.doReturn;
4242
import static org.mockito.Mockito.mock;
4343

44-
@ESTestCase.WithoutSecurityManager
4544
public class APMJvmOptionsTests extends ESTestCase {
4645

4746
private Path installDir;

distribution/tools/server-cli/src/test/java/org/elasticsearch/server/cli/JvmErgonomicsTests.java

-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import org.elasticsearch.common.util.concurrent.EsExecutors;
1616
import org.elasticsearch.node.NodeRoleSettings;
1717
import org.elasticsearch.test.ESTestCase;
18-
import org.elasticsearch.test.ESTestCase.WithoutSecurityManager;
1918

2019
import java.io.IOException;
2120
import java.util.ArrayList;
@@ -41,7 +40,6 @@
4140
import static org.junit.Assert.assertTrue;
4241
import static org.junit.Assert.fail;
4342

44-
@WithoutSecurityManager
4543
@SuppressFileSystems("*")
4644
public class JvmErgonomicsTests extends ESTestCase {
4745

distribution/tools/server-cli/src/test/java/org/elasticsearch/server/cli/JvmOptionsParserTests.java

-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import org.elasticsearch.core.IOUtils;
1515
import org.elasticsearch.core.Strings;
1616
import org.elasticsearch.test.ESTestCase;
17-
import org.elasticsearch.test.ESTestCase.WithoutSecurityManager;
1817
import org.junit.AfterClass;
1918
import org.junit.BeforeClass;
2019

@@ -42,7 +41,6 @@
4241
import static org.hamcrest.Matchers.hasSize;
4342
import static org.hamcrest.Matchers.not;
4443

45-
@WithoutSecurityManager
4644
public class JvmOptionsParserTests extends ESTestCase {
4745

4846
private static final Map<String, String> TEST_SYSPROPS = Map.of("os.name", "Linux", "os.arch", "aarch64");

distribution/tools/server-cli/src/test/java/org/elasticsearch/server/cli/MachineDependentHeapTests.java

-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
import org.elasticsearch.common.settings.Settings;
1313
import org.elasticsearch.test.ESTestCase;
14-
import org.elasticsearch.test.ESTestCase.WithoutSecurityManager;
1514
import org.hamcrest.Matcher;
1615

1716
import java.util.Collections;
@@ -21,7 +20,6 @@
2120
import static org.hamcrest.Matchers.empty;
2221

2322
// TODO: rework these tests to mock jvm option finder so they can run with security manager, no forking needed
24-
@WithoutSecurityManager
2523
public class MachineDependentHeapTests extends ESTestCase {
2624

2725
public void testDefaultHeapSize() throws Exception {

libs/cli/src/test/java/org/elasticsearch/cli/TerminalTests.java

-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
package org.elasticsearch.cli;
1111

1212
import org.elasticsearch.test.ESTestCase;
13-
import org.elasticsearch.test.ESTestCase.WithoutSecurityManager;
1413

1514
import java.io.IOException;
1615
import java.io.OutputStream;
@@ -23,7 +22,6 @@
2322
import static org.mockito.Mockito.verify;
2423
import static org.mockito.Mockito.verifyNoMoreInteractions;
2524

26-
@WithoutSecurityManager
2725
public class TerminalTests extends ESTestCase {
2826

2927
public void testSystemTerminalIfRedirected() {

libs/entitlement/asm-provider/src/test/java/org/elasticsearch/entitlement/instrumentation/impl/InstrumentationServiceImplTests.java

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import static org.hamcrest.Matchers.equalTo;
2424
import static org.hamcrest.Matchers.hasEntry;
2525

26-
@ESTestCase.WithoutSecurityManager
2726
public class InstrumentationServiceImplTests extends ESTestCase {
2827

2928
final InstrumentationService instrumentationService = new InstrumentationServiceImpl();

libs/entitlement/asm-provider/src/test/java/org/elasticsearch/entitlement/instrumentation/impl/InstrumenterTests.java

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
* This tests {@link InstrumenterImpl} can instrument various method signatures
3939
* (e.g. overloaded methods, overloaded targets, multiple instrumentation, etc.)
4040
*/
41-
@ESTestCase.WithoutSecurityManager
4241
public class InstrumenterTests extends ESTestCase {
4342
private static final Logger logger = LogManager.getLogger(InstrumenterTests.class);
4443

libs/entitlement/src/test/java/org/elasticsearch/entitlement/bridge/UtilTests.java

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
import static org.elasticsearch.entitlement.bridge.UtilTests.MockSensitiveClass.mockSensitiveMethod;
1515

16-
@ESTestCase.WithoutSecurityManager
1716
public class UtilTests extends ESTestCase {
1817

1918
public void testCallerClass() {

libs/entitlement/src/test/java/org/elasticsearch/entitlement/initialization/EntitlementInitializationTests.java

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import static org.hamcrest.Matchers.endsWith;
2828
import static org.hamcrest.Matchers.startsWith;
2929

30-
@ESTestCase.WithoutSecurityManager
3130
public class EntitlementInitializationTests extends ESTestCase {
3231

3332
private static PathLookup TEST_PATH_LOOKUP;

libs/entitlement/src/test/java/org/elasticsearch/entitlement/runtime/policy/FileAccessTreeTests.java

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import static org.hamcrest.Matchers.equalTo;
4040
import static org.hamcrest.Matchers.is;
4141

42-
@ESTestCase.WithoutSecurityManager
4342
public class FileAccessTreeTests extends ESTestCase {
4443

4544
static Path root;

libs/entitlement/src/test/java/org/elasticsearch/entitlement/runtime/policy/PolicyManagerTests.java

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
import static org.hamcrest.Matchers.is;
4545
import static org.hamcrest.Matchers.sameInstance;
4646

47-
@ESTestCase.WithoutSecurityManager
4847
public class PolicyManagerTests extends ESTestCase {
4948

5049
/**

libs/entitlement/src/test/java/org/elasticsearch/entitlement/runtime/policy/PolicyParserTests.java

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import static org.hamcrest.Matchers.contains;
3434
import static org.hamcrest.Matchers.equalTo;
3535

36-
@ESTestCase.WithoutSecurityManager
3736
public class PolicyParserTests extends ESTestCase {
3837

3938
public static String TEST_ABSOLUTE_PATH_TO_FILE;

libs/entitlement/src/test/java/org/elasticsearch/entitlement/runtime/policy/PolicyUtilsTests.java

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import static org.hamcrest.Matchers.equalTo;
3535
import static org.hamcrest.Matchers.nullValue;
3636

37-
@ESTestCase.WithoutSecurityManager
3837
public class PolicyUtilsTests extends ESTestCase {
3938

4039
public void testCreatePluginPolicyWithPatch() {

libs/native/src/test/java/org/elasticsearch/nativeaccess/ProcessLimitsTests.java

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import static org.hamcrest.Matchers.equalTo;
2121
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
2222

23-
@ESTestCase.WithoutSecurityManager
2423
public class ProcessLimitsTests extends ESTestCase {
2524

2625
private static final NativeAccess nativeAccess = NativeAccess.instance();

libs/native/src/test/java/org/elasticsearch/nativeaccess/SystemCallFilterTests.java

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import static org.junit.Assert.fail;
1717

1818
/** Simple tests system call filter is working. */
19-
@ESTestCase.WithoutSecurityManager
2019
public class SystemCallFilterTests extends ESTestCase {
2120

2221
/** command to try to run in tests */

libs/native/src/test/java/org/elasticsearch/nativeaccess/VectorSystemPropertyTests.java

-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
import org.elasticsearch.core.SuppressForbidden;
1313
import org.elasticsearch.test.ESTestCase;
14-
import org.elasticsearch.test.ESTestCase.WithoutSecurityManager;
1514
import org.elasticsearch.test.compiler.InMemoryJavaCompiler;
1615
import org.elasticsearch.test.jar.JarUtils;
1716
import org.junit.BeforeClass;
@@ -27,7 +26,6 @@
2726
import static org.hamcrest.Matchers.containsString;
2827
import static org.hamcrest.Matchers.equalTo;
2928

30-
@WithoutSecurityManager
3129
public class VectorSystemPropertyTests extends ESTestCase {
3230

3331
static Path jarPath;

qa/evil-tests/src/test/java/org/elasticsearch/bootstrap/EvilBootstrapChecksTests.java

-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import org.elasticsearch.core.SuppressForbidden;
1515
import org.elasticsearch.node.NodeValidationException;
1616
import org.elasticsearch.test.AbstractBootstrapCheckTestCase;
17-
import org.elasticsearch.test.ESTestCase.WithoutSecurityManager;
1817
import org.hamcrest.Matcher;
1918
import org.junit.After;
2019
import org.junit.Before;
@@ -31,7 +30,6 @@
3130
import static org.mockito.Mockito.verify;
3231
import static org.mockito.Mockito.verifyNoMoreInteractions;
3332

34-
@WithoutSecurityManager
3533
public class EvilBootstrapChecksTests extends AbstractBootstrapCheckTestCase {
3634

3735
private String esEnforceBootstrapChecks = System.getProperty(ES_ENFORCE_BOOTSTRAP_CHECKS);

server/src/test/java/org/elasticsearch/bootstrap/PluginsResolverTests.java

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import static org.mockito.Mockito.mock;
3333
import static org.mockito.Mockito.when;
3434

35-
@ESTestCase.WithoutSecurityManager
3635
public class PluginsResolverTests extends ESTestCase {
3736

3837
private record TestPluginLayer(PluginBundle pluginBundle, ClassLoader pluginClassLoader, ModuleLayer pluginModuleLayer)

server/src/test/java/org/elasticsearch/plugins/PluginsLoaderTests.java

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import static org.hamcrest.Matchers.is;
4040
import static org.hamcrest.Matchers.not;
4141

42-
@ESTestCase.WithoutSecurityManager
4342
@LuceneTestCase.SuppressFileSystems(value = "ExtrasFS")
4443
public class PluginsLoaderTests extends ESTestCase {
4544

server/src/test/java/org/elasticsearch/plugins/UberModuleClassLoaderTests.java

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import static org.hamcrest.Matchers.notNullValue;
4141
import static org.hamcrest.Matchers.nullValue;
4242

43-
@ESTestCase.WithoutSecurityManager
4443
public class UberModuleClassLoaderTests extends ESTestCase {
4544

4645
private static final String MODULE_NAME = "synthetic";

server/src/test/java/org/elasticsearch/plugins/internal/ReloadAwarePluginTests.java

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import static org.hamcrest.Matchers.contains;
2323
import static org.hamcrest.Matchers.instanceOf;
2424

25-
@ESTestCase.WithoutSecurityManager
2625
public class ReloadAwarePluginTests extends ESTestCase {
2726

2827
public void testNodeInitializesReloadingPlugin() throws Exception {

0 commit comments

Comments
 (0)