This is an automated email from the ASF dual-hosted git repository.
leonard pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push:
new 3886f1f3963 [FLINK-32625][tests] MiniClusterTestEnvironment supports
customized MiniClusterResourceConfiguration
3886f1f3963 is described below
commit 3886f1f39635fb94b488ec556f1143327b1a1ead
Author: tison <[email protected]>
AuthorDate: Wed Jul 19 15:55:06 2023 +0800
[FLINK-32625][tests] MiniClusterTestEnvironment supports customized
MiniClusterResourceConfiguration
This closes #23015.
---
.../environment/MiniClusterTestEnvironment.java | 28 +++++++++++++---------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git
a/flink-test-utils-parent/flink-connector-test-utils/src/main/java/org/apache/flink/connector/testframe/environment/MiniClusterTestEnvironment.java
b/flink-test-utils-parent/flink-connector-test-utils/src/main/java/org/apache/flink/connector/testframe/environment/MiniClusterTestEnvironment.java
index e68560ada54..c62fac21650 100644
---
a/flink-test-utils-parent/flink-connector-test-utils/src/main/java/org/apache/flink/connector/testframe/environment/MiniClusterTestEnvironment.java
+++
b/flink-test-utils-parent/flink-connector-test-utils/src/main/java/org/apache/flink/connector/testframe/environment/MiniClusterTestEnvironment.java
@@ -60,17 +60,11 @@ public class MiniClusterTestEnvironment implements
TestEnvironment, ClusterContr
private boolean isStarted = false;
public MiniClusterTestEnvironment() {
- Configuration conf = new Configuration();
- conf.set(METRIC_FETCHER_UPDATE_INTERVAL,
METRIC_FETCHER_UPDATE_INTERVAL_MS);
- this.miniCluster =
- new MiniClusterWithClientResource(
- new MiniClusterResourceConfiguration.Builder()
- .setConfiguration(conf)
- .setNumberTaskManagers(1)
- .setNumberSlotsPerTaskManager(6)
-
.setRpcServiceSharing(RpcServiceSharing.DEDICATED)
- .withHaLeadershipControl()
- .build());
+ this(defaultMiniClusterResourceConfiguration());
+ }
+
+ public MiniClusterTestEnvironment(MiniClusterResourceConfiguration conf) {
+ this.miniCluster = new MiniClusterWithClientResource(conf);
try {
this.checkpointPath =
Files.createTempDirectory("minicluster-environment-checkpoint-");
} catch (IOException e) {
@@ -78,6 +72,18 @@ public class MiniClusterTestEnvironment implements
TestEnvironment, ClusterContr
}
}
+ private static MiniClusterResourceConfiguration
defaultMiniClusterResourceConfiguration() {
+ Configuration conf = new Configuration();
+ conf.set(METRIC_FETCHER_UPDATE_INTERVAL,
METRIC_FETCHER_UPDATE_INTERVAL_MS);
+ return new MiniClusterResourceConfiguration.Builder()
+ .setConfiguration(conf)
+ .setNumberTaskManagers(1)
+ .setNumberSlotsPerTaskManager(6)
+ .setRpcServiceSharing(RpcServiceSharing.DEDICATED)
+ .withHaLeadershipControl()
+ .build();
+ }
+
@Override
public StreamExecutionEnvironment createExecutionEnvironment(
TestEnvironmentSettings envOptions) {