From 2255ecc980f1a15221db9d27ccedd5e969c34ebb Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Fri, 25 Oct 2013 22:04:44 +0200 Subject: [PATCH] Don't use TransportClient on FullClusterRestartTests There seems to be an issue with this test since it shuts down random nodes and TransportClients seem to be confused due to that. For now we disable them to figure out if this is the cause of the sporadic timeouts. --- .../recovery/FullRollingRestartTests.java | 2 +- .../test/AbstractIntegrationTest.java | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/elasticsearch/recovery/FullRollingRestartTests.java b/src/test/java/org/elasticsearch/recovery/FullRollingRestartTests.java index 558815e5352..86ee4732e93 100644 --- a/src/test/java/org/elasticsearch/recovery/FullRollingRestartTests.java +++ b/src/test/java/org/elasticsearch/recovery/FullRollingRestartTests.java @@ -33,7 +33,7 @@ import static org.hamcrest.Matchers.equalTo; /** * */ -@ClusterScope(scope=Scope.TEST, numNodes = 0) +@ClusterScope(scope=Scope.TEST, numNodes = 0, transportClientRatio = 0.0) public class FullRollingRestartTests extends AbstractIntegrationTest { @Test diff --git a/src/test/java/org/elasticsearch/test/AbstractIntegrationTest.java b/src/test/java/org/elasticsearch/test/AbstractIntegrationTest.java index 3072ae02c66..6fd84e66ae9 100644 --- a/src/test/java/org/elasticsearch/test/AbstractIntegrationTest.java +++ b/src/test/java/org/elasticsearch/test/AbstractIntegrationTest.java @@ -136,7 +136,7 @@ public abstract class AbstractIntegrationTest extends ElasticsearchTestCase { default: assert false : "Unknonw Scope: [" + currentClusterScope + "]"; } - currentCluster.beforeTest(getRandom(), Double.isNaN(TRANSPORT_CLIENT_RATIO) ? randomDouble() : TRANSPORT_CLIENT_RATIO); + currentCluster.beforeTest(getRandom(), getPerTestTransportClientRatio()); wipeIndices(); wipeTemplates(); randomIndexTemplate(); @@ -683,6 +683,7 @@ public abstract class AbstractIntegrationTest extends ElasticsearchTestCase { public @interface ClusterScope { Scope scope() default Scope.GLOBAL; int numNodes() default -1; + double transportClientRatio() default -1; } private static long clusterSeed() { @@ -701,4 +702,17 @@ public abstract class AbstractIntegrationTest extends ElasticsearchTestCase { return Double.parseDouble(property); } + private double getPerTestTransportClientRatio() { + final ClusterScope annotation = getAnnotation(this.getClass()); + double perTestRatio = -1; + if (annotation != null) { + perTestRatio = annotation.transportClientRatio(); + } + if (perTestRatio == -1) { + return Double.isNaN(TRANSPORT_CLIENT_RATIO) ? randomDouble() : TRANSPORT_CLIENT_RATIO; + } + assert perTestRatio >= 0.0 && perTestRatio <= 1.0; + return perTestRatio; + } + }