Skip to content

Commit b5e92db

Browse files
authored
Remove security manager from tests (#127087)
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 093ebd3 commit b5e92db

File tree

25 files changed

+4
-319
lines changed

25 files changed

+4
-319
lines changed

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

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import static org.mockito.Mockito.doReturn;
3939
import static org.mockito.Mockito.mock;
4040

41-
@ESTestCase.WithoutSecurityManager
4241
public class APMJvmOptionsTests extends ESTestCase {
4342

4443
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
@@ -15,7 +15,6 @@
1515
import org.elasticsearch.core.IOUtils;
1616
import org.elasticsearch.core.Strings;
1717
import org.elasticsearch.test.ESTestCase;
18-
import org.elasticsearch.test.ESTestCase.WithoutSecurityManager;
1918
import org.junit.AfterClass;
2019
import org.junit.BeforeClass;
2120

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

46-
@WithoutSecurityManager
4745
@LuceneTestCase.SuppressFileSystems("*")
4846
public class JvmOptionsParserTests extends ESTestCase {
4947

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
@@ -39,7 +39,6 @@
3939
* This tests {@link InstrumenterImpl} can instrument various method signatures
4040
* (e.g. overloaded methods, overloaded targets, multiple instrumentation, etc.)
4141
*/
42-
@ESTestCase.WithoutSecurityManager
4342
public class InstrumenterTests extends ESTestCase {
4443
private static final Logger logger = LogManager.getLogger(InstrumenterTests.class);
4544

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
@@ -46,7 +46,6 @@
4646
import static org.hamcrest.Matchers.is;
4747
import static org.hamcrest.Matchers.sameInstance;
4848

49-
@ESTestCase.WithoutSecurityManager
5049
public class PolicyManagerTests extends ESTestCase {
5150

5251
/**

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
@@ -12,7 +12,6 @@
1212
import org.apache.lucene.util.Constants;
1313
import org.elasticsearch.core.SuppressForbidden;
1414
import org.elasticsearch.test.ESTestCase;
15-
import org.elasticsearch.test.ESTestCase.WithoutSecurityManager;
1615
import org.elasticsearch.test.compiler.InMemoryJavaCompiler;
1716
import org.elasticsearch.test.jar.JarUtils;
1817
import org.junit.BeforeClass;
@@ -28,7 +27,6 @@
2827
import static org.hamcrest.Matchers.containsString;
2928
import static org.hamcrest.Matchers.equalTo;
3029

31-
@WithoutSecurityManager
3230
public class VectorSystemPropertyTests extends ESTestCase {
3331

3432
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/ScopeResolverTests.java

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import static org.mockito.Mockito.mock;
3535
import static org.mockito.Mockito.when;
3636

37-
@ESTestCase.WithoutSecurityManager
3837
public class ScopeResolverTests extends ESTestCase {
3938
/**
4039
* A test agent package name for use in tests.

server/src/test/java/org/elasticsearch/common/file/MasterNodeFileWatchingServiceTests.java

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import static org.mockito.Mockito.mock;
4040
import static org.mockito.Mockito.when;
4141

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

4544
static final DiscoveryNode localNode = DiscoveryNodeUtils.create("local-node");

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)