From 88839ec5465b30baba34bd8cd1b7c9407aa97345 Mon Sep 17 00:00:00 2001 From: javanna Date: Thu, 28 Aug 2014 15:10:24 +0200 Subject: [PATCH] [TEST] apply default settings by calling super.nodeSettings method when providing test specific methods --- .../org/elasticsearch/action/RejectionActionTests.java | 1 + .../action/bench/BenchmarkIntegrationTest.java | 10 ++++++---- .../action/bench/BenchmarkNegativeTest.java | 3 ++- .../cluster/ack/AckClusterUpdateSettingsTests.java | 1 + .../java/org/elasticsearch/cluster/ack/AckTests.java | 3 ++- .../cluster/shards/ClusterSearchShardsTests.java | 4 ++-- .../elasticsearch/index/query/TemplateQueryTest.java | 5 ++--- .../percolator/RecoveryPercolatorTests.java | 2 +- .../org/elasticsearch/script/OnDiskScriptTests.java | 3 ++- .../search/StressSearchServiceReaperTest.java | 3 ++- .../aggregations/bucket/DateHistogramOffsetTests.java | 1 + .../search/aggregations/bucket/ShardSizeTests.java | 1 + 12 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/test/java/org/elasticsearch/action/RejectionActionTests.java b/src/test/java/org/elasticsearch/action/RejectionActionTests.java index 313339b1515..1f17f326240 100644 --- a/src/test/java/org/elasticsearch/action/RejectionActionTests.java +++ b/src/test/java/org/elasticsearch/action/RejectionActionTests.java @@ -46,6 +46,7 @@ public class RejectionActionTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { return ImmutableSettings.builder() + .put(super.nodeSettings(nodeOrdinal)) .put("threadpool.search.size", 1) .put("threadpool.search.queue_size", 1) .put("threadpool.index.size", 1) diff --git a/src/test/java/org/elasticsearch/action/bench/BenchmarkIntegrationTest.java b/src/test/java/org/elasticsearch/action/bench/BenchmarkIntegrationTest.java index 97f7a9b303e..cd3a35e4963 100644 --- a/src/test/java/org/elasticsearch/action/bench/BenchmarkIntegrationTest.java +++ b/src/test/java/org/elasticsearch/action/bench/BenchmarkIntegrationTest.java @@ -67,16 +67,18 @@ public class BenchmarkIntegrationTest extends ElasticsearchIntegrationTest { protected synchronized Settings nodeSettings(int nodeOrdinal) { if (nodeOrdinal == 0) { // at least one - return ImmutableSettings.builder().put("node.bench", true).put(GroovyScriptEngineService.GROOVY_SCRIPT_SANDBOX_ENABLED, false).build(); + return ImmutableSettings.builder().put(super.nodeSettings(nodeOrdinal)) + .put("node.bench", true).put(GroovyScriptEngineService.GROOVY_SCRIPT_SANDBOX_ENABLED, false).build(); } else { if (benchNodes.containsKey(nodeOrdinal)) { - return ImmutableSettings.builder().put("node.bench", benchNodes.get(nodeOrdinal)).put(GroovyScriptEngineService.GROOVY_SCRIPT_SANDBOX_ENABLED, false).build(); + return ImmutableSettings.builder().put(super.nodeSettings(nodeOrdinal)) + .put("node.bench", benchNodes.get(nodeOrdinal)).put(GroovyScriptEngineService.GROOVY_SCRIPT_SANDBOX_ENABLED, false).build(); } else { boolean b = randomBoolean(); benchNodes.put(nodeOrdinal, b); - return ImmutableSettings.builder().put("node.bench", b).put(GroovyScriptEngineService.GROOVY_SCRIPT_SANDBOX_ENABLED, false).build(); + return ImmutableSettings.builder().put(super.nodeSettings(nodeOrdinal)) + .put("node.bench", b).put(GroovyScriptEngineService.GROOVY_SCRIPT_SANDBOX_ENABLED, false).build(); } - } } diff --git a/src/test/java/org/elasticsearch/action/bench/BenchmarkNegativeTest.java b/src/test/java/org/elasticsearch/action/bench/BenchmarkNegativeTest.java index 25f1edd6642..c42b7d13ca0 100644 --- a/src/test/java/org/elasticsearch/action/bench/BenchmarkNegativeTest.java +++ b/src/test/java/org/elasticsearch/action/bench/BenchmarkNegativeTest.java @@ -38,7 +38,8 @@ public class BenchmarkNegativeTest extends ElasticsearchIntegrationTest { private static final String INDEX_NAME = "test_index"; protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder().put("node.bench", false).build(); + return ImmutableSettings.builder().put(super.nodeSettings(nodeOrdinal)) + .put("node.bench", false).build(); } @Test(expected = BenchmarkNodeMissingException.class) diff --git a/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsTests.java b/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsTests.java index 30ee5aec78b..d7b98a73cb2 100644 --- a/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsTests.java +++ b/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsTests.java @@ -48,6 +48,7 @@ public class AckClusterUpdateSettingsTests extends ElasticsearchIntegrationTest //to test that the acknowledgement mechanism is working we better disable the wait for publish //otherwise the operation is most likely acknowledged even if it doesn't support ack return ImmutableSettings.builder() + .put(super.nodeSettings(nodeOrdinal)) .put(DiscoverySettings.PUBLISH_TIMEOUT, 0) //make sure that enough concurrent reroutes can happen at the same time //we have a minimum of 2 nodes, and a maximum of 10 shards, thus 5 should be enough diff --git a/src/test/java/org/elasticsearch/cluster/ack/AckTests.java b/src/test/java/org/elasticsearch/cluster/ack/AckTests.java index e18a85bc934..ec47821787e 100644 --- a/src/test/java/org/elasticsearch/cluster/ack/AckTests.java +++ b/src/test/java/org/elasticsearch/cluster/ack/AckTests.java @@ -63,7 +63,8 @@ public class AckTests extends ElasticsearchIntegrationTest { protected Settings nodeSettings(int nodeOrdinal) { //to test that the acknowledgement mechanism is working we better disable the wait for publish //otherwise the operation is most likely acknowledged even if it doesn't support ack - return ImmutableSettings.builder().put(DiscoverySettings.PUBLISH_TIMEOUT, 0).build(); + return ImmutableSettings.builder().put(super.nodeSettings(nodeOrdinal)) + .put(DiscoverySettings.PUBLISH_TIMEOUT, 0).build(); } @Test diff --git a/src/test/java/org/elasticsearch/cluster/shards/ClusterSearchShardsTests.java b/src/test/java/org/elasticsearch/cluster/shards/ClusterSearchShardsTests.java index 9d7756955e9..596d8289d17 100644 --- a/src/test/java/org/elasticsearch/cluster/shards/ClusterSearchShardsTests.java +++ b/src/test/java/org/elasticsearch/cluster/shards/ClusterSearchShardsTests.java @@ -40,9 +40,9 @@ public class ClusterSearchShardsTests extends ElasticsearchIntegrationTest { protected Settings nodeSettings(int nodeOrdinal) { switch(nodeOrdinal) { case 1: - return settingsBuilder().put("node.tag", "B").build(); + return settingsBuilder().put(super.nodeSettings(nodeOrdinal)).put("node.tag", "B").build(); case 0: - return settingsBuilder().put("node.tag", "A").build(); + return settingsBuilder().put(super.nodeSettings(nodeOrdinal)).put("node.tag", "A").build(); } return super.nodeSettings(nodeOrdinal); } diff --git a/src/test/java/org/elasticsearch/index/query/TemplateQueryTest.java b/src/test/java/org/elasticsearch/index/query/TemplateQueryTest.java index f1d63fef544..a40345e4b34 100644 --- a/src/test/java/org/elasticsearch/index/query/TemplateQueryTest.java +++ b/src/test/java/org/elasticsearch/index/query/TemplateQueryTest.java @@ -19,9 +19,7 @@ package org.elasticsearch.index.query; import com.google.common.collect.Maps; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.indexedscripts.delete.DeleteIndexedScriptResponse; import org.elasticsearch.action.indexedscripts.get.GetIndexedScriptResponse; import org.elasticsearch.action.indexedscripts.put.PutIndexedScriptResponse; @@ -66,7 +64,8 @@ public class TemplateQueryTest extends ElasticsearchIntegrationTest { @Override public Settings nodeSettings(int nodeOrdinal) { - return settingsBuilder().put("path.conf", this.getResource("config").getPath()).build(); + return settingsBuilder().put(super.nodeSettings(nodeOrdinal)) + .put("path.conf", this.getResource("config").getPath()).build(); } @Test diff --git a/src/test/java/org/elasticsearch/percolator/RecoveryPercolatorTests.java b/src/test/java/org/elasticsearch/percolator/RecoveryPercolatorTests.java index cf022b775e0..fb7fe623008 100644 --- a/src/test/java/org/elasticsearch/percolator/RecoveryPercolatorTests.java +++ b/src/test/java/org/elasticsearch/percolator/RecoveryPercolatorTests.java @@ -65,7 +65,7 @@ public class RecoveryPercolatorTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return builder().put("gateway.type", "local").build(); + return builder().put(super.nodeSettings(nodeOrdinal)).put("gateway.type", "local").build(); } @Test diff --git a/src/test/java/org/elasticsearch/script/OnDiskScriptTests.java b/src/test/java/org/elasticsearch/script/OnDiskScriptTests.java index 936136b42bb..86aedc37b6b 100644 --- a/src/test/java/org/elasticsearch/script/OnDiskScriptTests.java +++ b/src/test/java/org/elasticsearch/script/OnDiskScriptTests.java @@ -40,7 +40,8 @@ public class OnDiskScriptTests extends ElasticsearchIntegrationTest { @Override public Settings nodeSettings(int nodeOrdinal) { //Set path so ScriptService will pick up the test scripts - return settingsBuilder().put("path.conf", this.getResource("config").getPath()).build(); + return settingsBuilder().put(super.nodeSettings(nodeOrdinal)) + .put("path.conf", this.getResource("config").getPath()).build(); } diff --git a/src/test/java/org/elasticsearch/search/StressSearchServiceReaperTest.java b/src/test/java/org/elasticsearch/search/StressSearchServiceReaperTest.java index 52d29ff99ea..4f2fbcb51de 100644 --- a/src/test/java/org/elasticsearch/search/StressSearchServiceReaperTest.java +++ b/src/test/java/org/elasticsearch/search/StressSearchServiceReaperTest.java @@ -42,7 +42,8 @@ public class StressSearchServiceReaperTest extends ElasticsearchIntegrationTest @Override protected Settings nodeSettings(int nodeOrdinal) { // very frequent checks - return ImmutableSettings.builder().put(SearchService.KEEPALIVE_INTERVAL_KEY, TimeValue.timeValueMillis(1)).build(); + return ImmutableSettings.builder().put(super.nodeSettings(nodeOrdinal)) + .put(SearchService.KEEPALIVE_INTERVAL_KEY, TimeValue.timeValueMillis(1)).build(); } @Slow diff --git a/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramOffsetTests.java b/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramOffsetTests.java index 7281ad827ff..f191e2fa502 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramOffsetTests.java +++ b/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramOffsetTests.java @@ -56,6 +56,7 @@ public class DateHistogramOffsetTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { return ImmutableSettings.builder() + .put(super.nodeSettings(nodeOrdinal)) .put(AssertingLocalTransport.ASSERTING_TRANSPORT_MIN_VERSION_KEY, Version.V_1_4_0).build(); } diff --git a/src/test/java/org/elasticsearch/search/aggregations/bucket/ShardSizeTests.java b/src/test/java/org/elasticsearch/search/aggregations/bucket/ShardSizeTests.java index 4fcf942db8f..a565a55e281 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/bucket/ShardSizeTests.java +++ b/src/test/java/org/elasticsearch/search/aggregations/bucket/ShardSizeTests.java @@ -51,6 +51,7 @@ public abstract class ShardSizeTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { return ImmutableSettings.builder() + .put(super.nodeSettings(nodeOrdinal)) .put("cluster.routing.operation.hash.type", "djb") .put("cluster.routing.operation.use_type", "false") .build();