You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2018/02/26 19:43:37 UTC
[1/4] flink git commit: [FLINK-8593][metrics] Update latency metric
docs
Repository: flink
Updated Branches:
refs/heads/master 0ae7364bd -> a2d1d084b
[FLINK-8593][metrics] Update latency metric docs
This closes #5484.
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/a2d1d084
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/a2d1d084
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/a2d1d084
Branch: refs/heads/master
Commit: a2d1d084b90f0f47b91aa372525f01a382c892e7
Parents: 50aea88
Author: zentol <ch...@apache.org>
Authored: Wed Feb 14 12:45:17 2018 +0100
Committer: zentol <ch...@apache.org>
Committed: Mon Feb 26 20:42:00 2018 +0100
----------------------------------------------------------------------
docs/monitoring/metrics.md | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/a2d1d084/docs/monitoring/metrics.md
----------------------------------------------------------------------
diff --git a/docs/monitoring/metrics.md b/docs/monitoring/metrics.md
index 62adeb1..1e70dd7 100644
--- a/docs/monitoring/metrics.md
+++ b/docs/monitoring/metrics.md
@@ -1190,6 +1190,12 @@ Thus, in order to infer the metric identifier:
</thead>
<tbody>
<tr>
+ <th rowspan="1"><strong>Job (only available on TaskManager)</strong></th>
+ <td><source_id>.<source_subtask_index>.<operator_id>.<operator_subtask_index>.latency</td>
+ <td>The latency distributions from a given source subtask to an operator subtask (in milliseconds).</td>
+ <td>Histogram</td>
+ </tr>
+ <tr>
<th rowspan="6"><strong>Task</strong></th>
<td>numBytesInLocal</td>
<td>The total number of bytes this task has read from a local source.</td>
@@ -1247,7 +1253,7 @@ Thus, in order to infer the metric identifier:
<td>Counter</td>
</tr>
<tr>
- <th rowspan="6"><strong>Operator</strong></th>
+ <th rowspan="5"><strong>Operator</strong></th>
<td>currentInputWatermark</td>
<td>
The last watermark this operator has received (in milliseconds).
@@ -1279,11 +1285,6 @@ Thus, in order to infer the metric identifier:
<td>Gauge</td>
</tr>
<tr>
- <td>latency</td>
- <td>The latency distributions from all incoming sources (in milliseconds).</td>
- <td>Histogram</td>
- </tr>
- <tr>
<td>numSplitsProcessed</td>
<td>The total number of InputSplits this data source has processed (if the operator is a data source).</td>
<td>Gauge</td>
[2/4] flink git commit: [FLINK-8596][CLI] Also catch
NoClassDefFoundErrors
Posted by ch...@apache.org.
[FLINK-8596][CLI] Also catch NoClassDefFoundErrors
This closes #5543.
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/f3bfd22b
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/f3bfd22b
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/f3bfd22b
Branch: refs/heads/master
Commit: f3bfd22b41acd4c16f71d6d69f7983abc63a1e71
Parents: 3e056b3
Author: zentol <ch...@apache.org>
Authored: Tue Feb 20 13:40:43 2018 +0100
Committer: zentol <ch...@apache.org>
Committed: Mon Feb 26 20:42:00 2018 +0100
----------------------------------------------------------------------
.../apache/flink/client/cli/CliFrontend.java | 2 +-
test-infra/end-to-end-test/common.sh | 3 ++
test-infra/end-to-end-test/test_hadoop_free.sh | 46 ++++++++++++++++++++
tools/travis_mvn_watchdog.sh | 10 ++++-
4 files changed, 59 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/f3bfd22b/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java
----------------------------------------------------------------------
diff --git a/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java b/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java
index 92d2ccb..06131dc 100644
--- a/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java
+++ b/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java
@@ -1158,7 +1158,7 @@ public class CliFrontend {
configurationDirectory,
"y",
"yarn"));
- } catch (Exception e) {
+ } catch (NoClassDefFoundError | Exception e) {
LOG.warn("Could not load CLI class {}.", flinkYarnSessionCLI, e);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/f3bfd22b/test-infra/end-to-end-test/common.sh
----------------------------------------------------------------------
diff --git a/test-infra/end-to-end-test/common.sh b/test-infra/end-to-end-test/common.sh
index 67b7529..7492f36 100644
--- a/test-infra/end-to-end-test/common.sh
+++ b/test-infra/end-to-end-test/common.sh
@@ -74,6 +74,7 @@ function stop_cluster {
| grep -v '^INFO:.*AWSErrorCode=\[400 Bad Request\].*ServiceEndpoint=\[https://.*\.s3\.amazonaws\.com\].*RequestType=\[HeadBucketRequest\]' \
| grep -v "RejectedExecutionException" \
| grep -v "An exception was thrown by an exception handler" \
+ | grep -v "java.lang.NoClassDefFoundError: org/apache/hadoop/yarn/exceptions/YarnException" \
| grep -iq "error"; then
echo "Found error in log files:"
cat $FLINK_DIR/log/*
@@ -90,6 +91,8 @@ function stop_cluster {
| grep -v '^INFO:.*AWSErrorCode=\[400 Bad Request\].*ServiceEndpoint=\[https://.*\.s3\.amazonaws\.com\].*RequestType=\[HeadBucketRequest\]' \
| grep -v "RejectedExecutionException" \
| grep -v "An exception was thrown by an exception handler" \
+ | grep -v "Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.yarn.exceptions.YarnException" \
+ | grep -v "java.lang.NoClassDefFoundError: org/apache/hadoop/yarn/exceptions/YarnException" \
| grep -iq "exception"; then
echo "Found exception in log files:"
cat $FLINK_DIR/log/*
http://git-wip-us.apache.org/repos/asf/flink/blob/f3bfd22b/test-infra/end-to-end-test/test_hadoop_free.sh
----------------------------------------------------------------------
diff --git a/test-infra/end-to-end-test/test_hadoop_free.sh b/test-infra/end-to-end-test/test_hadoop_free.sh
new file mode 100755
index 0000000..311357e
--- /dev/null
+++ b/test-infra/end-to-end-test/test_hadoop_free.sh
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+################################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+
+source "$(dirname "$0")"/common.sh
+
+# move hadoop jar to /opt so it's not on the classpath
+mv $FLINK_DIR/lib/flink-shaded-hadoop* $FLINK_DIR/opt
+EXIT_CODE=$?
+if [ $EXIT_CODE != 0 ]; then
+ echo "=============================================================================="
+ echo "Could not move hadoop jar out of /lib, aborting test."
+ echo "=============================================================================="
+else
+ start_cluster
+
+ $FLINK_DIR/bin/flink run -p 1 $FLINK_DIR/examples/batch/WordCount.jar --input $TEST_INFRA_DIR/test-data/words --output $TEST_DATA_DIR/out/wc_out
+ check_result_hash "WordCount" $TEST_DATA_DIR/out/wc_out "72a690412be8928ba239c2da967328a5"
+ EXIT_CODE=$?
+
+ # move hadoop jar to /lib again to not have side-effects on subsequent tests
+ mv $FLINK_DIR/opt/flink-shaded-hadoop* $FLINK_DIR/lib
+ if [ $? != 0 ]; then
+ echo "=============================================================================="
+ echo "Could not move hadoop jar back to /lib, aborting tests."
+ echo "=============================================================================="
+ EXIT_CODE=1
+ fi
+fi
+
+exit $EXIT_CODE
http://git-wip-us.apache.org/repos/asf/flink/blob/f3bfd22b/tools/travis_mvn_watchdog.sh
----------------------------------------------------------------------
diff --git a/tools/travis_mvn_watchdog.sh b/tools/travis_mvn_watchdog.sh
index 0ef74db..4b1c2e3 100755
--- a/tools/travis_mvn_watchdog.sh
+++ b/tools/travis_mvn_watchdog.sh
@@ -616,7 +616,15 @@ case $TEST in
EXIT_CODE=$?
fi
- if [ $EXIT_CODE == 0]; then
+ if [ $EXIT_CODE == 0 ]; then
+ printf "\n==============================================================================\n"
+ printf "Running Hadoop-free Wordcount end-to-end test\n"
+ printf "==============================================================================\n"
+ FLINK_DIR=build-target CLUSTER_MODE=cluster test-infra/end-to-end-test/test_hadoop_free.sh
+ EXIT_CODE=$?
+ fi
+
+ if [ $EXIT_CODE == 0 ]; then
printf "\n==============================================================================\n"
printf "Running Streaming Python Wordcount end-to-end test\n"
printf "==============================================================================\n"
[3/4] flink git commit: [FLINK-8645][configuration] Split
classloader.parent-first-patterns into "base" and "append
Posted by ch...@apache.org.
[FLINK-8645][configuration] Split classloader.parent-first-patterns into "base" and "append
This closes #5544.
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/50aea889
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/50aea889
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/50aea889
Branch: refs/heads/master
Commit: 50aea889bd88d5ce4a1569569176705f9973a08c
Parents: f3bfd22
Author: zentol <ch...@apache.org>
Authored: Wed Feb 21 14:55:22 2018 +0100
Committer: zentol <ch...@apache.org>
Committed: Mon Feb 26 20:42:00 2018 +0100
----------------------------------------------------------------------
docs/ops/config.md | 12 +++--
.../apache/flink/configuration/CoreOptions.java | 37 ++++++++++++--
.../flink/configuration/CoreOptionsTest.java | 54 ++++++++++++++++++++
.../configuration/ParentFirstPatternsTest.java | 2 +-
.../formats/avro/AvroKryoClassloadingTest.java | 2 +-
.../jobmaster/JobManagerSharedServices.java | 4 +-
.../taskexecutor/TaskManagerConfiguration.java | 4 +-
.../flink/runtime/jobmanager/JobManager.scala | 5 +-
8 files changed, 101 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/50aea889/docs/ops/config.md
----------------------------------------------------------------------
diff --git a/docs/ops/config.md b/docs/ops/config.md
index efd3ee3..ce5bc9b 100644
--- a/docs/ops/config.md
+++ b/docs/ops/config.md
@@ -75,12 +75,16 @@ without explicit scheme definition, such as `/user/USERNAME/in.txt`, is going to
- `classloader.resolve-order`: Whether Flink should use a child-first `ClassLoader` when loading
user-code classes or a parent-first `ClassLoader`. Can be one of `parent-first` or `child-first`. (default: `child-first`)
-- `classloader.parent-first-patterns`: A (semicolon-separated) list of patterns that specifies which
+- `classloader.parent-first-patterns.default`: A (semicolon-separated) list of patterns that specifies which
classes should always be resolved through the parent `ClassLoader` first. A pattern is a simple
prefix that is checked against the fully qualified class name. By default, this is set to
-`java.;org.apache.flink.;javax.annotation;org.slf4j;org.apache.log4j;org.apache.logging.log4j;ch.qos.logback`.
-If you want to change this setting you have to make sure to also include the default patterns in
-your list of patterns if you want to keep that default behaviour.
+`"java.;scala.;org.apache.flink.;com.esotericsoftware.kryo;org.apache.hadoop.;javax.annotation.;org.slf4j;org.apache.log4j;org.apache.logging.log4j;ch.qos.logback"`.
+To extend this list beyond the default it is recommended to configure `classloader.parent-first-patterns.additional` instead of modifying this setting directly.
+
+- `classloader.parent-first-patterns.additional`: A (semicolon-separated) list of patterns that specifies which
+classes should always be resolved through the parent `ClassLoader` first. A pattern is a simple
+prefix that is checked against the fully qualified class name.
+This list is appended to `classloader.parent-first-patterns.default`.
## Advanced Options
http://git-wip-us.apache.org/repos/asf/flink/blob/50aea889/flink-core/src/main/java/org/apache/flink/configuration/CoreOptions.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/configuration/CoreOptions.java b/flink-core/src/main/java/org/apache/flink/configuration/CoreOptions.java
index 30c0cd6..ccce0ab 100644
--- a/flink-core/src/main/java/org/apache/flink/configuration/CoreOptions.java
+++ b/flink-core/src/main/java/org/apache/flink/configuration/CoreOptions.java
@@ -45,7 +45,7 @@ public class CoreOptions {
* which means that user code jars can include and load different dependencies than
* Flink uses (transitively).
*
- * <p>Exceptions to the rules are defined via {@link #ALWAYS_PARENT_FIRST_LOADER}.
+ * <p>Exceptions to the rules are defined via {@link #ALWAYS_PARENT_FIRST_LOADER_PATTERNS}.
*/
public static final ConfigOption<String> CLASSLOADER_RESOLVE_ORDER = ConfigOptions
.key("classloader.resolve-order")
@@ -85,12 +85,41 @@ public class CoreOptions {
* log bindings.</li>
* </ul>
*/
- public static final ConfigOption<String> ALWAYS_PARENT_FIRST_LOADER = ConfigOptions
- .key("classloader.parent-first-patterns")
+ public static final ConfigOption<String> ALWAYS_PARENT_FIRST_LOADER_PATTERNS = ConfigOptions
+ .key("classloader.parent-first-patterns.default")
.defaultValue("java.;scala.;org.apache.flink.;com.esotericsoftware.kryo;org.apache.hadoop.;javax.annotation.;org.slf4j;org.apache.log4j;org.apache.logging.log4j;ch.qos.logback")
+ .withDeprecatedKeys("classloader.parent-first-patterns")
.withDescription("A (semicolon-separated) list of patterns that specifies which classes should always be" +
" resolved through the parent ClassLoader first. A pattern is a simple prefix that is checked against" +
- " the fully qualified class name.");
+ " the fully qualified class name. This setting should generally not be modified. To add another pattern we" +
+ " recommend to use \"classloader.parent-first-patterns.additional\" instead.");
+
+ public static final ConfigOption<String> ALWAYS_PARENT_FIRST_LOADER_PATTERNS_ADDITIONAL = ConfigOptions
+ .key("classloader.parent-first-patterns.additional")
+ .defaultValue("")
+ .withDescription("A (semicolon-separated) list of patterns that specifies which classes should always be" +
+ " resolved through the parent ClassLoader first. A pattern is a simple prefix that is checked against" +
+ " the fully qualified class name. These patterns are appended to \"" + ALWAYS_PARENT_FIRST_LOADER_PATTERNS.key() + "\".");
+
+ public static String[] getParentFirstLoaderPatterns(Configuration config) {
+ String base = config.getString(ALWAYS_PARENT_FIRST_LOADER_PATTERNS);
+ String append = config.getString(ALWAYS_PARENT_FIRST_LOADER_PATTERNS_ADDITIONAL);
+
+ String[] basePatterns = base.isEmpty()
+ ? new String[0]
+ : base.split(";");
+
+ if (append.isEmpty()) {
+ return basePatterns;
+ } else {
+ String[] appendPatterns = append.split(";");
+
+ String[] joinedPatterns = new String[basePatterns.length + appendPatterns.length];
+ System.arraycopy(basePatterns, 0, joinedPatterns, 0, basePatterns.length);
+ System.arraycopy(appendPatterns, 0, joinedPatterns, basePatterns.length, appendPatterns.length);
+ return joinedPatterns;
+ }
+ }
// ------------------------------------------------------------------------
// process parameters
http://git-wip-us.apache.org/repos/asf/flink/blob/50aea889/flink-core/src/test/java/org/apache/flink/configuration/CoreOptionsTest.java
----------------------------------------------------------------------
diff --git a/flink-core/src/test/java/org/apache/flink/configuration/CoreOptionsTest.java b/flink-core/src/test/java/org/apache/flink/configuration/CoreOptionsTest.java
new file mode 100644
index 0000000..0bc5910
--- /dev/null
+++ b/flink-core/src/test/java/org/apache/flink/configuration/CoreOptionsTest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.configuration;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Tests for {@link CoreOptions}.
+ */
+public class CoreOptionsTest {
+ @Test
+ public void testGetParentFirstLoaderPatterns() {
+ Configuration config = new Configuration();
+
+ Assert.assertArrayEquals(
+ CoreOptions.ALWAYS_PARENT_FIRST_LOADER_PATTERNS.defaultValue().split(";"),
+ CoreOptions.getParentFirstLoaderPatterns(config));
+
+ config.setString(CoreOptions.ALWAYS_PARENT_FIRST_LOADER_PATTERNS, "hello;world");
+
+ Assert.assertArrayEquals(
+ "hello;world".split(";"),
+ CoreOptions.getParentFirstLoaderPatterns(config));
+
+ config.setString(CoreOptions.ALWAYS_PARENT_FIRST_LOADER_PATTERNS_ADDITIONAL, "how;are;you");
+
+ Assert.assertArrayEquals(
+ "hello;world;how;are;you".split(";"),
+ CoreOptions.getParentFirstLoaderPatterns(config));
+
+ config.setString(CoreOptions.ALWAYS_PARENT_FIRST_LOADER_PATTERNS, "");
+
+ Assert.assertArrayEquals(
+ "how;are;you".split(";"),
+ CoreOptions.getParentFirstLoaderPatterns(config));
+ }
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/50aea889/flink-core/src/test/java/org/apache/flink/configuration/ParentFirstPatternsTest.java
----------------------------------------------------------------------
diff --git a/flink-core/src/test/java/org/apache/flink/configuration/ParentFirstPatternsTest.java b/flink-core/src/test/java/org/apache/flink/configuration/ParentFirstPatternsTest.java
index 784d099..ca4b511 100644
--- a/flink-core/src/test/java/org/apache/flink/configuration/ParentFirstPatternsTest.java
+++ b/flink-core/src/test/java/org/apache/flink/configuration/ParentFirstPatternsTest.java
@@ -34,7 +34,7 @@ import static org.junit.Assert.assertTrue;
public class ParentFirstPatternsTest extends TestLogger {
private static final HashSet<String> PARENT_FIRST_PACKAGES = new HashSet<>(
- Arrays.asList(CoreOptions.ALWAYS_PARENT_FIRST_LOADER.defaultValue().split(";")));
+ Arrays.asList(CoreOptions.ALWAYS_PARENT_FIRST_LOADER_PATTERNS.defaultValue().split(";")));
/**
* All java and Flink classes must be loaded parent first.
http://git-wip-us.apache.org/repos/asf/flink/blob/50aea889/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroKryoClassloadingTest.java
----------------------------------------------------------------------
diff --git a/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroKryoClassloadingTest.java b/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroKryoClassloadingTest.java
index 6eaca15..8f0916c 100644
--- a/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroKryoClassloadingTest.java
+++ b/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroKryoClassloadingTest.java
@@ -73,7 +73,7 @@ public class AvroKryoClassloadingTest {
final ClassLoader userAppClassLoader = FlinkUserCodeClassLoaders.childFirst(
new URL[] { avroLocation, kryoLocation },
parentClassLoader,
- CoreOptions.ALWAYS_PARENT_FIRST_LOADER.defaultValue().split(";"));
+ CoreOptions.ALWAYS_PARENT_FIRST_LOADER_PATTERNS.defaultValue().split(";"));
final Class<?> userLoadedAvroClass = Class.forName(avroClass.getName(), false, userAppClassLoader);
assertNotEquals(avroClass, userLoadedAvroClass);
http://git-wip-us.apache.org/repos/asf/flink/blob/50aea889/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobManagerSharedServices.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobManagerSharedServices.java b/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobManagerSharedServices.java
index 34b338e..c1e910c 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobManagerSharedServices.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobManagerSharedServices.java
@@ -131,9 +131,7 @@ public class JobManagerSharedServices {
final String classLoaderResolveOrder =
config.getString(CoreOptions.CLASSLOADER_RESOLVE_ORDER);
- final String alwaysParentFirstLoaderString =
- config.getString(CoreOptions.ALWAYS_PARENT_FIRST_LOADER);
- final String[] alwaysParentFirstLoaderPatterns = alwaysParentFirstLoaderString.split(";");
+ final String[] alwaysParentFirstLoaderPatterns = CoreOptions.getParentFirstLoaderPatterns(config);
final BlobLibraryCacheManager libraryCacheManager =
new BlobLibraryCacheManager(
http://git-wip-us.apache.org/repos/asf/flink/blob/50aea889/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerConfiguration.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerConfiguration.java b/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerConfiguration.java
index aebefd6..cb6fe51 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerConfiguration.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerConfiguration.java
@@ -241,9 +241,7 @@ public class TaskManagerConfiguration implements TaskManagerRuntimeInfo {
final String classLoaderResolveOrder =
configuration.getString(CoreOptions.CLASSLOADER_RESOLVE_ORDER);
- final String alwaysParentFirstLoaderString =
- configuration.getString(CoreOptions.ALWAYS_PARENT_FIRST_LOADER);
- final String[] alwaysParentFirstLoaderPatterns = alwaysParentFirstLoaderString.split(";");
+ final String[] alwaysParentFirstLoaderPatterns = CoreOptions.getParentFirstLoaderPatterns(configuration);
final String taskManagerLogPath = configuration.getString(ConfigConstants.TASK_MANAGER_LOG_PATH_KEY, System.getProperty("log.file"));
final String taskManagerStdoutPath;
http://git-wip-us.apache.org/repos/asf/flink/blob/50aea889/flink-runtime/src/main/scala/org/apache/flink/runtime/jobmanager/JobManager.scala
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/scala/org/apache/flink/runtime/jobmanager/JobManager.scala b/flink-runtime/src/main/scala/org/apache/flink/runtime/jobmanager/JobManager.scala
index 1dfaa5d..b9529de 100644
--- a/flink-runtime/src/main/scala/org/apache/flink/runtime/jobmanager/JobManager.scala
+++ b/flink-runtime/src/main/scala/org/apache/flink/runtime/jobmanager/JobManager.scala
@@ -2430,9 +2430,8 @@ object JobManager {
val timeout: FiniteDuration = AkkaUtils.getTimeout(configuration)
val classLoaderResolveOrder = configuration.getString(CoreOptions.CLASSLOADER_RESOLVE_ORDER)
- val alwaysParentFirstLoaderString =
- configuration.getString(CoreOptions.ALWAYS_PARENT_FIRST_LOADER)
- val alwaysParentFirstLoaderPatterns = alwaysParentFirstLoaderString.split(';')
+
+ val alwaysParentFirstLoaderPatterns = CoreOptions.getParentFirstLoaderPatterns(configuration)
val restartStrategy = RestartStrategyFactory.createRestartStrategyFactory(configuration)
[4/4] flink git commit: [FLINK-8703][tests] Migrate tests to
MiniClusterResource (batch #2)
Posted by ch...@apache.org.
[FLINK-8703][tests] Migrate tests to MiniClusterResource (batch #2)
This closes #5542.
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/3e056b34
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/3e056b34
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/3e056b34
Branch: refs/heads/master
Commit: 3e056b34f7be817e0d0eee612b6ae44891e33501
Parents: 0ae7364
Author: zentol <ch...@apache.org>
Authored: Tue Feb 20 18:02:32 2018 +0100
Committer: zentol <ch...@apache.org>
Committed: Mon Feb 26 20:42:00 2018 +0100
----------------------------------------------------------------------
.../apache/flink/ml/util/FlinkTestBase.scala | 25 ++--
...ScalaStreamingMultipleProgramsTestBase.scala | 29 ++---
...tractEventTimeWindowCheckpointingITCase.java | 86 ++++++-------
.../AbstractLocalRecoveryITCase.java | 100 ++++++++++++++++
...ckendEventTimeWindowCheckpointingITCase.java | 5 +-
...ckendEventTimeWindowCheckpointingITCase.java | 6 +-
...ckendEventTimeWindowCheckpointingITCase.java | 6 +-
...ckendEventTimeWindowCheckpointingITCase.java | 5 +-
...ckendEventTimeWindowCheckpointingITCase.java | 5 +-
.../checkpointing/LocalRecoveryHeapITCase.java | 33 +++++
.../test/checkpointing/LocalRecoveryITCase.java | 120 -------------------
.../LocalRecoveryRocksDBFullITCase.java | 33 +++++
.../LocalRecoveryRocksDBIncrementalITCase.java | 33 +++++
...ckendEventTimeWindowCheckpointingITCase.java | 5 +-
...ckendEventTimeWindowCheckpointingITCase.java | 5 +-
.../operators/CustomDistributionITCase.java | 42 ++-----
.../flink/test/runtime/IPv6HostnamesITCase.java | 47 ++++----
17 files changed, 311 insertions(+), 274 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/3e056b34/flink-libraries/flink-ml/src/test/scala/org/apache/flink/ml/util/FlinkTestBase.scala
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-ml/src/test/scala/org/apache/flink/ml/util/FlinkTestBase.scala b/flink-libraries/flink-ml/src/test/scala/org/apache/flink/ml/util/FlinkTestBase.scala
index c27a2b5..2165152 100644
--- a/flink-libraries/flink-ml/src/test/scala/org/apache/flink/ml/util/FlinkTestBase.scala
+++ b/flink-libraries/flink-ml/src/test/scala/org/apache/flink/ml/util/FlinkTestBase.scala
@@ -18,8 +18,9 @@
package org.apache.flink.ml.util
-import org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster
-import org.apache.flink.test.util.{TestBaseUtils, TestEnvironment}
+import org.apache.flink.configuration.Configuration
+import org.apache.flink.test.util.MiniClusterResource
+import org.apache.flink.test.util.MiniClusterResource.MiniClusterResourceConfiguration
import org.scalatest.{BeforeAndAfter, Suite}
/** Mixin to start and stop a LocalFlinkMiniCluster automatically for Scala based tests.
@@ -51,27 +52,21 @@ import org.scalatest.{BeforeAndAfter, Suite}
trait FlinkTestBase extends BeforeAndAfter {
that: Suite =>
- var cluster: Option[LocalFlinkMiniCluster] = None
+ var cluster: Option[MiniClusterResource] = None
val parallelism = 4
before {
- val cl = TestBaseUtils.startCluster(
- 1,
- parallelism,
- false,
- false,
- true)
-
- val clusterEnvironment = new TestEnvironment(cl, parallelism, false)
- clusterEnvironment.setAsContext()
+ val cl = new MiniClusterResource(
+ new MiniClusterResourceConfiguration(new Configuration(), 1, parallelism)
+ )
+
+ cl.before()
cluster = Some(cl)
}
after {
- cluster.foreach(c => TestBaseUtils.stopCluster(c, TestBaseUtils.DEFAULT_TIMEOUT))
-
- TestEnvironment.unsetAsContext()
+ cluster.foreach(c => c.after())
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/3e056b34/flink-streaming-scala/src/test/scala/org/apache/flink/streaming/api/scala/ScalaStreamingMultipleProgramsTestBase.scala
----------------------------------------------------------------------
diff --git a/flink-streaming-scala/src/test/scala/org/apache/flink/streaming/api/scala/ScalaStreamingMultipleProgramsTestBase.scala b/flink-streaming-scala/src/test/scala/org/apache/flink/streaming/api/scala/ScalaStreamingMultipleProgramsTestBase.scala
index d9f727c..e0c5b45 100644
--- a/flink-streaming-scala/src/test/scala/org/apache/flink/streaming/api/scala/ScalaStreamingMultipleProgramsTestBase.scala
+++ b/flink-streaming-scala/src/test/scala/org/apache/flink/streaming/api/scala/ScalaStreamingMultipleProgramsTestBase.scala
@@ -18,12 +18,10 @@
package org.apache.flink.streaming.api.scala
-import org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster
-import org.apache.flink.streaming.util.TestStreamEnvironment
-import org.apache.flink.test.util.TestBaseUtils
-
+import org.apache.flink.configuration.Configuration
+import org.apache.flink.test.util.MiniClusterResource.MiniClusterResourceConfiguration
+import org.apache.flink.test.util.{MiniClusterResource, TestBaseUtils}
import org.junit.{After, Before}
-
import org.scalatest.junit.JUnitSuiteLike
trait ScalaStreamingMultipleProgramsTestBase
@@ -31,28 +29,21 @@ trait ScalaStreamingMultipleProgramsTestBase
with JUnitSuiteLike {
val parallelism = 4
- var cluster: Option[LocalFlinkMiniCluster] = None
+ var cluster: Option[MiniClusterResource] = None
@Before
def beforeAll(): Unit = {
- val cluster = Some(
- TestBaseUtils.startCluster(
- 1,
- parallelism,
- false,
- false,
- true
- )
+ val cl = new MiniClusterResource(
+ new MiniClusterResourceConfiguration(new Configuration(), 1, parallelism)
)
- TestStreamEnvironment.setAsContext(cluster.get, parallelism)
+ cl.before()
+
+ cluster = Some(cl)
}
@After
def afterAll(): Unit = {
- TestStreamEnvironment.unsetAsContext()
- cluster.foreach {
- TestBaseUtils.stopCluster(_, TestBaseUtils.DEFAULT_TIMEOUT)
- }
+ cluster.foreach { c => c.after() }
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/3e056b34/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AbstractEventTimeWindowCheckpointingITCase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AbstractEventTimeWindowCheckpointingITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AbstractEventTimeWindowCheckpointingITCase.java
index 557c097..f37ba0d 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AbstractEventTimeWindowCheckpointingITCase.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AbstractEventTimeWindowCheckpointingITCase.java
@@ -26,35 +26,32 @@ import org.apache.flink.api.java.tuple.Tuple;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.api.java.tuple.Tuple4;
import org.apache.flink.configuration.AkkaOptions;
-import org.apache.flink.configuration.ConfigConstants;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.configuration.HighAvailabilityOptions;
import org.apache.flink.configuration.TaskManagerOptions;
import org.apache.flink.contrib.streaming.state.RocksDBStateBackend;
import org.apache.flink.core.fs.Path;
-import org.apache.flink.runtime.highavailability.HighAvailabilityServices;
-import org.apache.flink.runtime.highavailability.HighAvailabilityServicesUtils;
-import org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster;
import org.apache.flink.runtime.state.AbstractStateBackend;
import org.apache.flink.runtime.state.CheckpointListener;
import org.apache.flink.runtime.state.filesystem.FsStateBackend;
import org.apache.flink.runtime.state.memory.MemoryStateBackend;
import org.apache.flink.streaming.api.TimeCharacteristic;
import org.apache.flink.streaming.api.checkpoint.ListCheckpointed;
+import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.sink.RichSinkFunction;
import org.apache.flink.streaming.api.functions.source.RichSourceFunction;
import org.apache.flink.streaming.api.functions.windowing.RichWindowFunction;
import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.api.windowing.time.Time;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
-import org.apache.flink.streaming.util.TestStreamEnvironment;
+import org.apache.flink.test.util.MiniClusterResource;
import org.apache.flink.test.util.SuccessException;
import org.apache.flink.util.Collector;
import org.apache.flink.util.TestLogger;
import org.apache.curator.test.TestingServer;
import org.junit.After;
-import org.junit.Before;
+import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
@@ -65,9 +62,6 @@ import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.apache.flink.test.checkpointing.AbstractEventTimeWindowCheckpointingITCase.StateBackendEnum.ROCKSDB_INCREMENTAL_ZK;
@@ -91,31 +85,42 @@ public abstract class AbstractEventTimeWindowCheckpointingITCase extends TestLog
private static final int MAX_MEM_STATE_SIZE = 20 * 1024 * 1024;
private static final int PARALLELISM = 4;
- private static LocalFlinkMiniCluster cluster;
+ private TestingServer zkServer;
- private static TestStreamEnvironment env;
-
- private static TestingServer zkServer;
-
- @Rule
- public TemporaryFolder tempFolder = new TemporaryFolder();
+ @ClassRule
+ public static TemporaryFolder tempFolder = new TemporaryFolder();
@Rule
public TestName name = new TestName();
- private StateBackendEnum stateBackendEnum;
- protected AbstractStateBackend stateBackend;
+ private AbstractStateBackend stateBackend;
- AbstractEventTimeWindowCheckpointingITCase(StateBackendEnum stateBackendEnum) {
- this.stateBackendEnum = stateBackendEnum;
- }
+ @Rule
+ public final MiniClusterResource miniClusterResource = getMiniClusterResource();
enum StateBackendEnum {
MEM, FILE, ROCKSDB_FULLY_ASYNC, ROCKSDB_INCREMENTAL, ROCKSDB_INCREMENTAL_ZK, MEM_ASYNC, FILE_ASYNC
}
- @Before
- public void startTestCluster() throws Exception {
+ protected abstract StateBackendEnum getStateBackend();
+
+ protected final MiniClusterResource getMiniClusterResource() {
+ return new MiniClusterResource(
+ new MiniClusterResource.MiniClusterResourceConfiguration(
+ getConfigurationSafe(),
+ 2,
+ PARALLELISM / 2));
+ }
+
+ private Configuration getConfigurationSafe() {
+ try {
+ return getConfiguration();
+ } catch (Exception e) {
+ throw new AssertionError("Could not initialize test.", e);
+ }
+ }
+
+ private Configuration getConfiguration() throws Exception {
// print a message when starting a test method to avoid Travis' <tt>"Maven produced no
// output for xxx seconds."</tt> messages
@@ -123,6 +128,7 @@ public abstract class AbstractEventTimeWindowCheckpointingITCase extends TestLog
"Starting " + getClass().getCanonicalName() + "#" + name.getMethodName() + ".");
// Testing HA Scenario / ZKCompletedCheckpointStore with incremental checkpoints
+ StateBackendEnum stateBackendEnum = getStateBackend();
if (ROCKSDB_INCREMENTAL_ZK.equals(stateBackendEnum)) {
zkServer = new TestingServer();
zkServer.start();
@@ -130,23 +136,6 @@ public abstract class AbstractEventTimeWindowCheckpointingITCase extends TestLog
Configuration config = createClusterConfig();
- // purposefully delay in the executor to tease out races
- final ScheduledExecutorService executor = Executors.newScheduledThreadPool(10);
- HighAvailabilityServices haServices = HighAvailabilityServicesUtils.createAvailableOrEmbeddedServices(
- config,
- new Executor() {
- @Override
- public void execute(Runnable command) {
- executor.schedule(command, 500, MILLISECONDS);
- }
- });
-
- cluster = new LocalFlinkMiniCluster(config, haServices, false);
- cluster.start();
-
- env = new TestStreamEnvironment(cluster, PARALLELISM);
- env.getConfig().setUseSnapshotCompression(true);
-
switch (stateBackendEnum) {
case MEM:
this.stateBackend = new MemoryStateBackend(MAX_MEM_STATE_SIZE, false);
@@ -190,6 +179,7 @@ public abstract class AbstractEventTimeWindowCheckpointingITCase extends TestLog
default:
throw new IllegalStateException("No backend selected.");
}
+ return config;
}
protected Configuration createClusterConfig() throws IOException {
@@ -198,8 +188,6 @@ public abstract class AbstractEventTimeWindowCheckpointingITCase extends TestLog
final File haDir = temporaryFolder.newFolder();
Configuration config = new Configuration();
- config.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, 2);
- config.setInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, PARALLELISM / 2);
config.setLong(TaskManagerOptions.MANAGED_MEMORY_SIZE, 48L);
// the default network buffers size (10% of heap max =~ 150MB) seems to much for this test case
config.setLong(TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MAX, 80L << 20); // 80 MB
@@ -215,11 +203,6 @@ public abstract class AbstractEventTimeWindowCheckpointingITCase extends TestLog
@After
public void stopTestCluster() throws IOException {
- if (cluster != null) {
- cluster.stop();
- cluster = null;
- }
-
if (zkServer != null) {
zkServer.stop();
zkServer = null;
@@ -241,12 +224,14 @@ public abstract class AbstractEventTimeWindowCheckpointingITCase extends TestLog
FailingSource.reset();
try {
+ StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setParallelism(PARALLELISM);
env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);
env.enableCheckpointing(100);
env.setRestartStrategy(RestartStrategies.fixedDelayRestart(3, 0));
env.getConfig().disableSysoutLogging();
env.setStateBackend(this.stateBackend);
+ env.getConfig().setUseSnapshotCompression(true);
env
.addSource(new FailingSource(numKeys, numElementsPerKey, numElementsPerKey / 3))
@@ -310,6 +295,7 @@ public abstract class AbstractEventTimeWindowCheckpointingITCase extends TestLog
FailingSource.reset();
try {
+ StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setParallelism(PARALLELISM);
env.setMaxParallelism(maxParallelism);
env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);
@@ -317,6 +303,7 @@ public abstract class AbstractEventTimeWindowCheckpointingITCase extends TestLog
env.setRestartStrategy(RestartStrategies.fixedDelayRestart(3, 0));
env.getConfig().disableSysoutLogging();
env.setStateBackend(this.stateBackend);
+ env.getConfig().setUseSnapshotCompression(true);
env
.addSource(new FailingSource(numKeys, numElementsPerKey, numElementsPerKey / 3))
@@ -376,6 +363,7 @@ public abstract class AbstractEventTimeWindowCheckpointingITCase extends TestLog
FailingSource.reset();
try {
+ StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setMaxParallelism(2 * PARALLELISM);
env.setParallelism(PARALLELISM);
env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);
@@ -438,12 +426,14 @@ public abstract class AbstractEventTimeWindowCheckpointingITCase extends TestLog
FailingSource.reset();
try {
+ StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setParallelism(PARALLELISM);
env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);
env.enableCheckpointing(100);
env.setRestartStrategy(RestartStrategies.fixedDelayRestart(3, 0));
env.getConfig().disableSysoutLogging();
env.setStateBackend(this.stateBackend);
+ env.getConfig().setUseSnapshotCompression(true);
env
.addSource(new FailingSource(numKeys, numElementsPerKey, numElementsPerKey / 3))
@@ -507,12 +497,14 @@ public abstract class AbstractEventTimeWindowCheckpointingITCase extends TestLog
FailingSource.reset();
try {
+ StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setParallelism(PARALLELISM);
env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);
env.enableCheckpointing(100);
env.setRestartStrategy(RestartStrategies.fixedDelayRestart(3, 0));
env.getConfig().disableSysoutLogging();
env.setStateBackend(this.stateBackend);
+ env.getConfig().setUseSnapshotCompression(true);
env
.addSource(new FailingSource(numKeys, numElementsPerKey, numElementsPerKey / 3))
http://git-wip-us.apache.org/repos/asf/flink/blob/3e056b34/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AbstractLocalRecoveryITCase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AbstractLocalRecoveryITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AbstractLocalRecoveryITCase.java
new file mode 100644
index 0000000..a02e902
--- /dev/null
+++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AbstractLocalRecoveryITCase.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.test.checkpointing;
+
+import org.apache.flink.configuration.CheckpointingOptions;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.util.TestLogger;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+
+import java.io.IOException;
+
+import static org.apache.flink.runtime.state.LocalRecoveryConfig.LocalRecoveryMode;
+import static org.apache.flink.test.checkpointing.AbstractEventTimeWindowCheckpointingITCase.StateBackendEnum;
+
+/**
+ * This test delegates to instances of {@link AbstractEventTimeWindowCheckpointingITCase} that have been reconfigured
+ * to use local recovery.
+ *
+ * <p>TODO: This class must be refactored to properly extend {@link AbstractEventTimeWindowCheckpointingITCase}.
+ */
+public abstract class AbstractLocalRecoveryITCase extends TestLogger {
+
+ private final StateBackendEnum backendEnum;
+ private final LocalRecoveryMode recoveryMode;
+
+ @Rule
+ public TestName testName = new TestName();
+
+ AbstractLocalRecoveryITCase(StateBackendEnum backendEnum, LocalRecoveryMode recoveryMode) {
+ this.backendEnum = backendEnum;
+ this.recoveryMode = recoveryMode;
+ }
+
+ @Test
+ public final void executeTest() throws Exception {
+ AbstractEventTimeWindowCheckpointingITCase.tempFolder.create();
+ AbstractEventTimeWindowCheckpointingITCase windowChkITCase =
+ new AbstractEventTimeWindowCheckpointingITCase() {
+ @Override
+ protected StateBackendEnum getStateBackend() {
+ return backendEnum;
+ }
+
+ @Override
+ protected Configuration createClusterConfig() throws IOException {
+ Configuration config = super.createClusterConfig();
+
+ config.setString(
+ CheckpointingOptions.LOCAL_RECOVERY,
+ recoveryMode.toString());
+
+ return config;
+ }
+ };
+
+ executeTest(windowChkITCase);
+ }
+
+ private void executeTest(AbstractEventTimeWindowCheckpointingITCase delegate) throws Exception {
+ delegate.name = testName;
+ try {
+ delegate.miniClusterResource.before();
+ try {
+ delegate.testTumblingTimeWindow();
+ delegate.miniClusterResource.after();
+ } catch (Exception e) {
+ delegate.miniClusterResource.after();
+ }
+
+ delegate.miniClusterResource.before();
+ try {
+ delegate.testSlidingTimeWindow();
+ delegate.miniClusterResource.after();
+ } catch (Exception e) {
+ delegate.miniClusterResource.after();
+ }
+ } finally {
+ delegate.tempFolder.delete();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/3e056b34/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AsyncFileBackendEventTimeWindowCheckpointingITCase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AsyncFileBackendEventTimeWindowCheckpointingITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AsyncFileBackendEventTimeWindowCheckpointingITCase.java
index f0db4d5..c4b06d4 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AsyncFileBackendEventTimeWindowCheckpointingITCase.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AsyncFileBackendEventTimeWindowCheckpointingITCase.java
@@ -23,7 +23,8 @@ package org.apache.flink.test.checkpointing;
*/
public class AsyncFileBackendEventTimeWindowCheckpointingITCase extends AbstractEventTimeWindowCheckpointingITCase {
- public AsyncFileBackendEventTimeWindowCheckpointingITCase() {
- super(StateBackendEnum.FILE_ASYNC);
+ @Override
+ protected StateBackendEnum getStateBackend() {
+ return StateBackendEnum.FILE_ASYNC;
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/3e056b34/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AsyncMemBackendEventTimeWindowCheckpointingITCase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AsyncMemBackendEventTimeWindowCheckpointingITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AsyncMemBackendEventTimeWindowCheckpointingITCase.java
index 70ec757..2cc5b01 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AsyncMemBackendEventTimeWindowCheckpointingITCase.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AsyncMemBackendEventTimeWindowCheckpointingITCase.java
@@ -22,8 +22,8 @@ package org.apache.flink.test.checkpointing;
* Integration tests for asynchronous memory backend.
*/
public class AsyncMemBackendEventTimeWindowCheckpointingITCase extends AbstractEventTimeWindowCheckpointingITCase {
-
- public AsyncMemBackendEventTimeWindowCheckpointingITCase() {
- super(StateBackendEnum.MEM_ASYNC);
+ @Override
+ protected StateBackendEnum getStateBackend() {
+ return StateBackendEnum.MEM_ASYNC;
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/3e056b34/flink-tests/src/test/java/org/apache/flink/test/checkpointing/FileBackendEventTimeWindowCheckpointingITCase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/FileBackendEventTimeWindowCheckpointingITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/FileBackendEventTimeWindowCheckpointingITCase.java
index 030c1a3..eab6153 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/FileBackendEventTimeWindowCheckpointingITCase.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/FileBackendEventTimeWindowCheckpointingITCase.java
@@ -22,8 +22,8 @@ package org.apache.flink.test.checkpointing;
* Integration tests for file backend.
*/
public class FileBackendEventTimeWindowCheckpointingITCase extends AbstractEventTimeWindowCheckpointingITCase {
-
- public FileBackendEventTimeWindowCheckpointingITCase() {
- super(StateBackendEnum.FILE);
+ @Override
+ protected StateBackendEnum getStateBackend() {
+ return StateBackendEnum.FILE;
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/3e056b34/flink-tests/src/test/java/org/apache/flink/test/checkpointing/HAIncrementalRocksDbBackendEventTimeWindowCheckpointingITCase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/HAIncrementalRocksDbBackendEventTimeWindowCheckpointingITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/HAIncrementalRocksDbBackendEventTimeWindowCheckpointingITCase.java
index 394815f..ed43ad6 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/HAIncrementalRocksDbBackendEventTimeWindowCheckpointingITCase.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/HAIncrementalRocksDbBackendEventTimeWindowCheckpointingITCase.java
@@ -23,8 +23,9 @@ package org.apache.flink.test.checkpointing;
*/
public class HAIncrementalRocksDbBackendEventTimeWindowCheckpointingITCase extends AbstractEventTimeWindowCheckpointingITCase {
- public HAIncrementalRocksDbBackendEventTimeWindowCheckpointingITCase() {
- super(StateBackendEnum.ROCKSDB_INCREMENTAL_ZK);
+ @Override
+ protected StateBackendEnum getStateBackend() {
+ return StateBackendEnum.ROCKSDB_INCREMENTAL_ZK;
}
@Override
http://git-wip-us.apache.org/repos/asf/flink/blob/3e056b34/flink-tests/src/test/java/org/apache/flink/test/checkpointing/IncrementalRocksDbBackendEventTimeWindowCheckpointingITCase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/IncrementalRocksDbBackendEventTimeWindowCheckpointingITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/IncrementalRocksDbBackendEventTimeWindowCheckpointingITCase.java
index dfb66cc..1276a00 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/IncrementalRocksDbBackendEventTimeWindowCheckpointingITCase.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/IncrementalRocksDbBackendEventTimeWindowCheckpointingITCase.java
@@ -23,8 +23,9 @@ package org.apache.flink.test.checkpointing;
*/
public class IncrementalRocksDbBackendEventTimeWindowCheckpointingITCase extends AbstractEventTimeWindowCheckpointingITCase {
- public IncrementalRocksDbBackendEventTimeWindowCheckpointingITCase() {
- super(StateBackendEnum.ROCKSDB_INCREMENTAL);
+ @Override
+ protected StateBackendEnum getStateBackend() {
+ return StateBackendEnum.ROCKSDB_INCREMENTAL;
}
@Override
http://git-wip-us.apache.org/repos/asf/flink/blob/3e056b34/flink-tests/src/test/java/org/apache/flink/test/checkpointing/LocalRecoveryHeapITCase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/LocalRecoveryHeapITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/LocalRecoveryHeapITCase.java
new file mode 100644
index 0000000..2c0c294
--- /dev/null
+++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/LocalRecoveryHeapITCase.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.test.checkpointing;
+
+import static org.apache.flink.runtime.state.LocalRecoveryConfig.LocalRecoveryMode.ENABLE_FILE_BASED;
+import static org.apache.flink.test.checkpointing.AbstractEventTimeWindowCheckpointingITCase.StateBackendEnum.FILE_ASYNC;
+
+/**
+ * Tests file-based local recovery with the HeapBackend.
+ */
+public class LocalRecoveryHeapITCase extends AbstractLocalRecoveryITCase {
+ public LocalRecoveryHeapITCase() {
+ super(
+ FILE_ASYNC,
+ ENABLE_FILE_BASED);
+ }
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/3e056b34/flink-tests/src/test/java/org/apache/flink/test/checkpointing/LocalRecoveryITCase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/LocalRecoveryITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/LocalRecoveryITCase.java
deleted file mode 100644
index 51b3b84..0000000
--- a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/LocalRecoveryITCase.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.test.checkpointing;
-
-import org.apache.flink.configuration.CheckpointingOptions;
-import org.apache.flink.configuration.Configuration;
-import org.apache.flink.util.TestLogger;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
-
-import java.io.IOException;
-
-import static org.apache.flink.runtime.state.LocalRecoveryConfig.LocalRecoveryMode;
-import static org.apache.flink.runtime.state.LocalRecoveryConfig.LocalRecoveryMode.ENABLE_FILE_BASED;
-import static org.apache.flink.test.checkpointing.AbstractEventTimeWindowCheckpointingITCase.StateBackendEnum;
-import static org.apache.flink.test.checkpointing.AbstractEventTimeWindowCheckpointingITCase.StateBackendEnum.FILE_ASYNC;
-import static org.apache.flink.test.checkpointing.AbstractEventTimeWindowCheckpointingITCase.StateBackendEnum.ROCKSDB_FULLY_ASYNC;
-import static org.apache.flink.test.checkpointing.AbstractEventTimeWindowCheckpointingITCase.StateBackendEnum.ROCKSDB_INCREMENTAL_ZK;
-
-/**
- * This test delegates to instances of {@link AbstractEventTimeWindowCheckpointingITCase} that have been reconfigured
- * to use local recovery.
- */
-public class LocalRecoveryITCase extends TestLogger {
-
- @Rule
- public TestName testName = new TestName();
-
- @Test
- public void testLocalRecoveryHeapBackendFileBased() throws Exception {
- executeTest(
- FILE_ASYNC,
- ENABLE_FILE_BASED);
- }
-
- @Test
- public void testLocalRecoveryRocksIncrementalFileBased() throws Exception {
- executeTest(
- ROCKSDB_INCREMENTAL_ZK,
- ENABLE_FILE_BASED);
- }
-
- @Test
- public void testLocalRecoveryRocksFullFileBased() throws Exception {
- executeTest(
- ROCKSDB_FULLY_ASYNC,
- ENABLE_FILE_BASED);
- }
-
- private void executeTest(
- StateBackendEnum backendEnum,
- LocalRecoveryMode recoveryMode) throws Exception {
-
- AbstractEventTimeWindowCheckpointingITCase windowChkITCase =
- new AbstractEventTimeWindowCheckpointingITCaseWithLocalRecovery(
- backendEnum,
- recoveryMode);
-
- executeTest(windowChkITCase);
- }
-
- private void executeTest(AbstractEventTimeWindowCheckpointingITCase delegate) throws Exception {
- delegate.name = testName;
- delegate.tempFolder.create();
- try {
- delegate.startTestCluster();
- delegate.testTumblingTimeWindow();
- delegate.stopTestCluster();
-
- delegate.startTestCluster();
- delegate.testSlidingTimeWindow();
- delegate.stopTestCluster();
- } finally {
- delegate.tempFolder.delete();
- }
- }
-
- private static class AbstractEventTimeWindowCheckpointingITCaseWithLocalRecovery
- extends AbstractEventTimeWindowCheckpointingITCase {
-
- private final LocalRecoveryMode recoveryMode;
-
- AbstractEventTimeWindowCheckpointingITCaseWithLocalRecovery(
- StateBackendEnum stateBackendEnum,
- LocalRecoveryMode recoveryMode) {
-
- super(stateBackendEnum);
- this.recoveryMode = recoveryMode;
- }
-
- @Override
- protected Configuration createClusterConfig() throws IOException {
- Configuration config = super.createClusterConfig();
-
- config.setString(
- CheckpointingOptions.LOCAL_RECOVERY,
- recoveryMode.toString());
-
- return config;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flink/blob/3e056b34/flink-tests/src/test/java/org/apache/flink/test/checkpointing/LocalRecoveryRocksDBFullITCase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/LocalRecoveryRocksDBFullITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/LocalRecoveryRocksDBFullITCase.java
new file mode 100644
index 0000000..16bbbfc
--- /dev/null
+++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/LocalRecoveryRocksDBFullITCase.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.test.checkpointing;
+
+import static org.apache.flink.runtime.state.LocalRecoveryConfig.LocalRecoveryMode.ENABLE_FILE_BASED;
+import static org.apache.flink.test.checkpointing.AbstractEventTimeWindowCheckpointingITCase.StateBackendEnum.ROCKSDB_FULLY_ASYNC;
+
+/**
+ * Tests file-based local recovery with the RocksDB state-backend.
+ */
+public class LocalRecoveryRocksDBFullITCase extends AbstractLocalRecoveryITCase {
+ public LocalRecoveryRocksDBFullITCase() {
+ super(
+ ROCKSDB_FULLY_ASYNC,
+ ENABLE_FILE_BASED);
+ }
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/3e056b34/flink-tests/src/test/java/org/apache/flink/test/checkpointing/LocalRecoveryRocksDBIncrementalITCase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/LocalRecoveryRocksDBIncrementalITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/LocalRecoveryRocksDBIncrementalITCase.java
new file mode 100644
index 0000000..fa8e139
--- /dev/null
+++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/LocalRecoveryRocksDBIncrementalITCase.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.test.checkpointing;
+
+import static org.apache.flink.runtime.state.LocalRecoveryConfig.LocalRecoveryMode.ENABLE_FILE_BASED;
+import static org.apache.flink.test.checkpointing.AbstractEventTimeWindowCheckpointingITCase.StateBackendEnum.ROCKSDB_INCREMENTAL_ZK;
+
+/**
+ * Tests file-based local recovery with the RocksDB state-backend and incremental checkpointing enabled.
+ */
+public class LocalRecoveryRocksDBIncrementalITCase extends AbstractLocalRecoveryITCase {
+ public LocalRecoveryRocksDBIncrementalITCase() {
+ super(
+ ROCKSDB_INCREMENTAL_ZK,
+ ENABLE_FILE_BASED);
+ }
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/3e056b34/flink-tests/src/test/java/org/apache/flink/test/checkpointing/MemBackendEventTimeWindowCheckpointingITCase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/MemBackendEventTimeWindowCheckpointingITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/MemBackendEventTimeWindowCheckpointingITCase.java
index 54a29ed..e153b4b 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/MemBackendEventTimeWindowCheckpointingITCase.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/MemBackendEventTimeWindowCheckpointingITCase.java
@@ -23,7 +23,8 @@ package org.apache.flink.test.checkpointing;
*/
public class MemBackendEventTimeWindowCheckpointingITCase extends AbstractEventTimeWindowCheckpointingITCase {
- public MemBackendEventTimeWindowCheckpointingITCase() {
- super(StateBackendEnum.MEM);
+ @Override
+ protected StateBackendEnum getStateBackend() {
+ return StateBackendEnum.MEM;
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/3e056b34/flink-tests/src/test/java/org/apache/flink/test/checkpointing/RocksDbBackendEventTimeWindowCheckpointingITCase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/RocksDbBackendEventTimeWindowCheckpointingITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/RocksDbBackendEventTimeWindowCheckpointingITCase.java
index 3873aff..e6d5b9e 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/RocksDbBackendEventTimeWindowCheckpointingITCase.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/RocksDbBackendEventTimeWindowCheckpointingITCase.java
@@ -23,8 +23,9 @@ package org.apache.flink.test.checkpointing;
*/
public class RocksDbBackendEventTimeWindowCheckpointingITCase extends AbstractEventTimeWindowCheckpointingITCase {
- public RocksDbBackendEventTimeWindowCheckpointingITCase() {
- super(StateBackendEnum.ROCKSDB_FULLY_ASYNC);
+ @Override
+ protected StateBackendEnum getStateBackend() {
+ return StateBackendEnum.ROCKSDB_FULLY_ASYNC;
}
@Override
http://git-wip-us.apache.org/repos/asf/flink/blob/3e056b34/flink-tests/src/test/java/org/apache/flink/test/operators/CustomDistributionITCase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/operators/CustomDistributionITCase.java b/flink-tests/src/test/java/org/apache/flink/test/operators/CustomDistributionITCase.java
index 2452475..74b8cf7 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/operators/CustomDistributionITCase.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/operators/CustomDistributionITCase.java
@@ -27,19 +27,15 @@ import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.io.DiscardingOutputFormat;
import org.apache.flink.api.java.tuple.Tuple3;
import org.apache.flink.api.java.utils.DataSetUtils;
+import org.apache.flink.configuration.Configuration;
import org.apache.flink.core.memory.DataInputView;
import org.apache.flink.core.memory.DataOutputView;
-import org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster;
import org.apache.flink.test.operators.util.CollectionDataSets;
-import org.apache.flink.test.util.TestBaseUtils;
-import org.apache.flink.test.util.TestEnvironment;
+import org.apache.flink.test.util.MiniClusterResource;
import org.apache.flink.util.Collector;
import org.apache.flink.util.TestLogger;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
+import org.junit.ClassRule;
import org.junit.Test;
import java.io.IOException;
@@ -52,32 +48,12 @@ import static org.junit.Assert.fail;
@SuppressWarnings("serial")
public class CustomDistributionITCase extends TestLogger {
- // ------------------------------------------------------------------------
- // The mini cluster that is shared across tests
- // ------------------------------------------------------------------------
-
- private static LocalFlinkMiniCluster cluster;
-
- @BeforeClass
- public static void setup() throws Exception {
- cluster = TestBaseUtils.startCluster(1, 8, false, false, true);
- }
-
- @AfterClass
- public static void teardown() throws Exception {
- TestBaseUtils.stopCluster(cluster, TestBaseUtils.DEFAULT_TIMEOUT);
- }
-
- @Before
- public void prepare() {
- TestEnvironment clusterEnv = new TestEnvironment(cluster, 1, false);
- clusterEnv.setAsContext();
- }
-
- @After
- public void cleanup() {
- TestEnvironment.unsetAsContext();
- }
+ @ClassRule
+ public static final MiniClusterResource MINI_CLUSTER_RESOURCE = new MiniClusterResource(
+ new MiniClusterResource.MiniClusterResourceConfiguration(
+ new Configuration(),
+ 1,
+ 8));
// ------------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/3e056b34/flink-tests/src/test/java/org/apache/flink/test/runtime/IPv6HostnamesITCase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/runtime/IPv6HostnamesITCase.java b/flink-tests/src/test/java/org/apache/flink/test/runtime/IPv6HostnamesITCase.java
index f24d21e..4a7b345 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/runtime/IPv6HostnamesITCase.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/runtime/IPv6HostnamesITCase.java
@@ -27,14 +27,16 @@ import org.apache.flink.configuration.Configuration;
import org.apache.flink.configuration.JobManagerOptions;
import org.apache.flink.configuration.TaskManagerOptions;
import org.apache.flink.runtime.akka.AkkaUtils;
-import org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster;
import org.apache.flink.test.testdata.WordCountData;
+import org.apache.flink.test.util.MiniClusterResource;
import org.apache.flink.test.util.TestBaseUtils;
import org.apache.flink.util.Collector;
import org.apache.flink.util.NetUtils;
import org.apache.flink.util.TestLogger;
import akka.actor.ActorSystem;
+import org.junit.AssumptionViolatedException;
+import org.junit.Rule;
import org.junit.Test;
import java.io.IOException;
@@ -56,31 +58,33 @@ import static org.junit.Assert.fail;
@SuppressWarnings("serial")
public class IPv6HostnamesITCase extends TestLogger {
- @Test
- public void testClusterWithIPv6host() {
+ @Rule
+ public final MiniClusterResource miniClusterResource = new MiniClusterResource(
+ new MiniClusterResource.MiniClusterResourceConfiguration(
+ getConfiguration(),
+ 2,
+ 2));
+ private Configuration getConfiguration() {
final Inet6Address ipv6address = getLocalIPv6Address();
if (ipv6address == null) {
- System.err.println("--- Cannot find a non-loopback local IPv6 address that Akka/Netty can bind to; skipping IPv6HostnamesITCase");
- return;
+ throw new AssumptionViolatedException("--- Cannot find a non-loopback local IPv6 address that Akka/Netty can bind to; skipping IPv6HostnamesITCase");
}
+ final String addressString = ipv6address.getHostAddress();
+ log.info("Test will use IPv6 address " + addressString + " for connection tests");
+
+ Configuration config = new Configuration();
+ config.setString(JobManagerOptions.ADDRESS, addressString);
+ config.setString(ConfigConstants.TASK_MANAGER_HOSTNAME_KEY, addressString);
+ config.setLong(TaskManagerOptions.MANAGED_MEMORY_SIZE, 16L);
+ return config;
+ }
- LocalFlinkMiniCluster flink = null;
+ @Test
+ public void testClusterWithIPv6host() {
try {
- final String addressString = ipv6address.getHostAddress();
- log.info("Test will use IPv6 address " + addressString + " for connection tests");
- Configuration conf = new Configuration();
- conf.setString(JobManagerOptions.ADDRESS, addressString);
- conf.setString(ConfigConstants.TASK_MANAGER_HOSTNAME_KEY, addressString);
- conf.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, 2);
- conf.setInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, 2);
- conf.setLong(TaskManagerOptions.MANAGED_MEMORY_SIZE, 16L);
-
- flink = new LocalFlinkMiniCluster(conf, false);
- flink.start();
-
- ExecutionEnvironment env = ExecutionEnvironment.createRemoteEnvironment(addressString, flink.getLeaderRPCPort());
+ ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
env.setParallelism(4);
env.getConfig().disableSysoutLogging();
@@ -108,11 +112,6 @@ public class IPv6HostnamesITCase extends TestLogger {
e.printStackTrace();
fail(e.getMessage());
}
- finally {
- if (flink != null) {
- flink.stop();
- }
- }
}
private Inet6Address getLocalIPv6Address() {