You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by gy...@apache.org on 2015/11/25 12:57:36 UTC
flink git commit: [FLINK-3072] [streaming] Ensure Derby server starts
before running any tests
Repository: flink
Updated Branches:
refs/heads/master 25ef3240c -> 90c76ad1c
[FLINK-3072] [streaming] Ensure Derby server starts before running any tests
Closes #1401
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/90c76ad1
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/90c76ad1
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/90c76ad1
Branch: refs/heads/master
Commit: 90c76ad1c3019e354724503a69c21a157161cf0b
Parents: 25ef324
Author: Gyula Fora <gy...@apache.org>
Authored: Tue Nov 24 17:30:12 2015 +0100
Committer: Gyula Fora <gy...@apache.org>
Committed: Wed Nov 25 12:55:21 2015 +0100
----------------------------------------------------------------------
.../state/DBStateCheckpointingTest.java | 3 +++
.../streaming/state/DbStateBackendTest.java | 27 ++++++++++++++++++++
2 files changed, 30 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/90c76ad1/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DBStateCheckpointingTest.java
----------------------------------------------------------------------
diff --git a/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DBStateCheckpointingTest.java b/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DBStateCheckpointingTest.java
index 337960f..87dabf8 100644
--- a/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DBStateCheckpointingTest.java
+++ b/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DBStateCheckpointingTest.java
@@ -62,6 +62,9 @@ public class DBStateCheckpointingTest extends StreamFaultToleranceTestBase {
server = new NetworkServerControl(InetAddress.getByName("localhost"), 1526, "flink", "flink");
server.start(null);
tempDir = new File(ConfigConstants.DEFAULT_TASK_MANAGER_TMP_PATH, UUID.randomUUID().toString());
+ // We need to ensure that the Derby server starts properly before
+ // beginning the tests
+ DbStateBackendTest.ensureServerStarted(server);
}
@After
http://git-wip-us.apache.org/repos/asf/flink/blob/90c76ad1/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DbStateBackendTest.java
----------------------------------------------------------------------
diff --git a/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DbStateBackendTest.java b/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DbStateBackendTest.java
index 241501d..6664b6d 100644
--- a/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DbStateBackendTest.java
+++ b/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DbStateBackendTest.java
@@ -69,7 +69,11 @@ public class DbStateBackendTest {
@BeforeClass
public static void startDerbyServer() throws UnknownHostException, Exception {
server = new NetworkServerControl(InetAddress.getByName("localhost"), 1527, "flink", "flink");
+
+ // Async call, we need to ensure that the server starts before leaving
+ // the method
server.start(null);
+
tempDir = new File(ConfigConstants.DEFAULT_TASK_MANAGER_TMP_PATH, UUID.randomUUID().toString());
conf = new DbBackendConfig("flink", "flink",
"jdbc:derby://localhost:1527/" + tempDir.getAbsolutePath() + "/flinkDB1;create=true");
@@ -78,6 +82,29 @@ public class DbStateBackendTest {
url1 = "jdbc:derby://localhost:1527/" + tempDir.getAbsolutePath() + "/flinkDB1;create=true";
url2 = "jdbc:derby://localhost:1527/" + tempDir.getAbsolutePath() + "/flinkDB2;create=true";
+
+ // We need to ensure that the Derby server starts properly before
+ // beginning the tests
+ ensureServerStarted(server);
+ }
+
+ public static void ensureServerStarted(NetworkServerControl server) throws InterruptedException {
+ // We try to ping the server 10 times with 1s sleep in between
+ // If the ping succeeds without exception the server started
+ int retry = 0;
+ while (true) {
+ if (retry < 10) {
+ try {
+ server.ping();
+ break;
+ } catch (Exception e) {
+ retry++;
+ Thread.sleep(1000);
+ }
+ } else {
+ throw new RuntimeException("Could not start the Derby server in 10 seconds.");
+ }
+ }
}
@AfterClass