You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2018/03/23 15:10:04 UTC
[2/4] asterixdb git commit: [NO ISSUE][TEST] Add timeout multiplier
for test executor timeouts
[NO ISSUE][TEST] Add timeout multiplier for test executor timeouts
Change-Id: I340098ce840f31f2afcef5dd66e43a21ed7ceb9d
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2513
Reviewed-by: Murtadha Hubail <mh...@apache.org>
Tested-by: Michael Blow <mb...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/2587f1db
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/2587f1db
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/2587f1db
Branch: refs/heads/master
Commit: 2587f1dbe58f7fa65163d141eed1c40aee3fdb1a
Parents: a77ec69
Author: Michael Blow <mb...@apache.org>
Authored: Thu Mar 22 17:09:16 2018 -0400
Committer: Michael Blow <mb...@apache.org>
Committed: Thu Mar 22 17:22:58 2018 -0700
----------------------------------------------------------------------
.../org/apache/asterix/test/common/TestExecutor.java | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2587f1db/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
index 8c0a3d4..80048bd 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
@@ -154,6 +154,7 @@ public class TestExecutor {
protected int endpointSelector;
protected IExternalUDFLibrarian librarian;
private Map<File, TestLoop> testLoops = new HashMap<>();
+ private double timeoutMultiplier = 1;
public TestExecutor() {
this(Inet4Address.getLoopbackAddress().getHostAddress(), 19002);
@@ -183,6 +184,10 @@ public class TestExecutor {
this.replicationAddress = replicationAddress;
}
+ public void setTimeoutMultiplier(double timeoutMultiplier) {
+ this.timeoutMultiplier = timeoutMultiplier;
+ }
+
/**
* Probably does not work well with symlinks.
*/
@@ -1449,10 +1454,10 @@ public class TestExecutor {
return false;
}
- public static int getTimeoutSecs(String statement) {
+ public int getTimeoutSecs(String statement) {
final Matcher timeoutMatcher = POLL_TIMEOUT_PATTERN.matcher(statement);
if (timeoutMatcher.find()) {
- return Integer.parseInt(timeoutMatcher.group(1));
+ return (int) (Integer.parseInt(timeoutMatcher.group(1)) * timeoutMultiplier);
} else {
throw new IllegalArgumentException("ERROR: polltimeoutsecs=nnn must be present in poll file");
}
@@ -1796,7 +1801,8 @@ public class TestExecutor {
waitForClusterState("ACTIVE", timeoutSecs, timeUnit);
}
- public void waitForClusterState(String desiredState, int timeout, TimeUnit timeUnit) throws Exception {
+ public void waitForClusterState(String desiredState, int baseTimeout, TimeUnit timeUnit) throws Exception {
+ int timeout = (int) (baseTimeout * timeoutMultiplier);
LOGGER.info("Waiting for cluster state " + desiredState + "...");
Thread t = new Thread(() -> {
while (true) {
@@ -1874,7 +1880,7 @@ public class TestExecutor {
}
String host = command[0];
int port = Integer.parseInt(command[1]);
- int timeoutSec = Integer.parseInt(command[2]);
+ int timeoutSec = (int) (Integer.parseInt(command[2]) * timeoutMultiplier);
while (isPortActive(host, port)) {
TimeUnit.SECONDS.sleep(1);
timeoutSec--;