浏览代码

Add support for `tests.enable_mock_modules` to ESIntegTestCase (#24309)

`tests.enable_mock_modules` is a documented but unrespected / unused
option to disable all mock modules / pluings during test runs. This
will basically site-step mock assertions like check-index on shard closing.
This can speed up test-execution dramatically on nodes with slow disks etc.

Relates to #24304
Simon Willnauer 8 年之前
父节点
当前提交
e69147a870
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java

+ 2 - 1
test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java

@@ -299,6 +299,7 @@ public abstract class ESIntegTestCase extends ESTestCase {
      */
      */
     public static final String TESTS_ENABLE_MOCK_MODULES = "tests.enable_mock_modules";
     public static final String TESTS_ENABLE_MOCK_MODULES = "tests.enable_mock_modules";
 
 
+    private static final boolean MOCK_MODULES_ENABLED = "true".equals(System.getProperty(TESTS_ENABLE_MOCK_MODULES, "true"));
     /**
     /**
      * Threshold at which indexing switches from frequently async to frequently bulk.
      * Threshold at which indexing switches from frequently async to frequently bulk.
      */
      */
@@ -1882,7 +1883,7 @@ public abstract class ESIntegTestCase extends ESTestCase {
     /** Return the mock plugins the cluster should use */
     /** Return the mock plugins the cluster should use */
     protected Collection<Class<? extends Plugin>> getMockPlugins() {
     protected Collection<Class<? extends Plugin>> getMockPlugins() {
         final ArrayList<Class<? extends Plugin>> mocks = new ArrayList<>();
         final ArrayList<Class<? extends Plugin>> mocks = new ArrayList<>();
-        if (randomBoolean()) { // sometimes run without those completely
+        if (MOCK_MODULES_ENABLED && randomBoolean()) { // sometimes run without those completely
             if (randomBoolean() && addMockTransportService()) {
             if (randomBoolean() && addMockTransportService()) {
                 mocks.add(MockTransportService.TestPlugin.class);
                 mocks.add(MockTransportService.TestPlugin.class);
             }
             }