Elffuss BraidHub

kikocis/java-driver public

Add new SystemProperty TEST_BASE_NODE_WAIT for tests.

TEST_BASE_NODE_WAIT is an overridable base value for how long the tests
should wait for particular events.  This allows configurability that is
needed for constrained environments such as jenkins.

This value is used in the following ways:

  - waitFor: default wait TEST_BASE_NODE_WAIT (default 60)
  - waitForDown: default wait TEST_BASE_NODE_WAIT * 3 (default 180)
  - waitDecommission: default wait TEST_BASE_NODE_WAIT / 2 (default 30)
Changesetd68e339cb5b7e7e015bdd83f40dbed2d86a35cd493fd8605bc4653285ed3a65f
AuthorAndrew Tolbert <andrew.tolbert@datastax.com> · 2015-01-30 18:21 -06:00
CommitterAndrew Tolbert <andrew.tolbert@datastax.com> · 2015-02-13 07:23 -06:00
Parentsd8c184a6e782

Browse the files at this changeset

1 file changed

modified driver-core/src/test/java/com/datastax/driver/core/TestUtils.java +6 −4
@@ -49,6 +49,8 @@
4949 public static final String INSERT_FORMAT = "INSERT INTO %s (k, t, i, f) VALUES ('%s', '%s', %d, %f)";
5050 public static final String SELECT_ALL_FORMAT = "SELECT * FROM %s";
5151
52+ public static final int TEST_BASE_NODE_WAIT = SystemProperties.getInt("com.datastax.driver.TEST_BASE_NODE_WAIT", 60);
53+
5254 @SuppressWarnings({ "unchecked", "rawtypes" })
5355 public static BoundStatement setBoundValue(BoundStatement bs, String name, DataType type, Object value) {
5456 switch (type.getName()) {
@@ -267,7 +269,7 @@
267269 // This is used because there is some delay between when a node has been
268270 // added through ccm and when it's actually available for querying
269271 public static void waitFor(String node, Cluster cluster) {
270- waitFor(node, cluster, 60, false, false);
272+ waitFor(node, cluster, TEST_BASE_NODE_WAIT, false, false);
271273 }
272274
273275 public static void waitFor(String node, Cluster cluster, int maxTry) {
@@ -275,11 +277,11 @@
275277 }
276278
277279 public static void waitForDown(String node, Cluster cluster) {
278- waitFor(node, cluster, 180, true, false);
280+ waitFor(node, cluster, TEST_BASE_NODE_WAIT * 3, true, false);
279281 }
280282
281283 public static void waitForDownWithWait(String node, Cluster cluster, int waitTime) {
282- waitFor(node, cluster, 180, true, false);
284+ waitForDown(node, cluster);
283285
284286 // FIXME: Once stop() works, remove this line
285287 try {
@@ -299,7 +301,7 @@
299301 }
300302
301303 public static void waitForDecommission(String node, Cluster cluster) {
302- waitFor(node, cluster, 30, true, true);
304+ waitFor(node, cluster, TEST_BASE_NODE_WAIT / 2, true, true);
303305 }
304306
305307 public static void waitForDecommission(String node, Cluster cluster, int maxTry) {