Skip to content

Commit 9b10e14

Browse files
committed
Fork MiniClusterResource removed in Iceberg 1.7.0
Iceberg 1.7.0 removed the test utility class MiniClusterResource. Fork it into Amoro test sources to maintain compatibility. Signed-off-by: Jiwon Park <jpark92@outlook.kr>
1 parent c880f7e commit 9b10e14

6 files changed

Lines changed: 49 additions & 5 deletions

File tree

amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common/src/test/java/org/apache/amoro/flink/FlinkTestBase.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
import org.apache.iceberg.data.GenericRecord;
6565
import org.apache.iceberg.data.IdentityPartitionConverters;
6666
import org.apache.iceberg.data.Record;
67-
import org.apache.iceberg.flink.MiniClusterResource;
6867
import org.apache.iceberg.io.CloseableIterable;
6968
import org.apache.iceberg.io.TaskWriter;
7069
import org.apache.iceberg.io.WriteResult;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
package org.apache.amoro.flink;
20+
21+
import org.apache.flink.configuration.Configuration;
22+
import org.apache.flink.configuration.CoreOptions;
23+
import org.apache.flink.runtime.testutils.MiniClusterResourceConfiguration;
24+
import org.apache.flink.test.util.MiniClusterWithClientResource;
25+
26+
/** Forked from org.apache.iceberg.flink.MiniClusterResource which was removed in Iceberg 1.7.0. */
27+
public class MiniClusterResource {
28+
29+
private static final int DEFAULT_TM_NUM = 1;
30+
private static final int DEFAULT_PARALLELISM = 4;
31+
32+
public static final Configuration DISABLE_CLASSLOADER_CHECK_CONFIG =
33+
new Configuration().set(CoreOptions.CHECK_LEAKED_CLASSLOADER, false);
34+
35+
private MiniClusterResource() {}
36+
37+
public static MiniClusterWithClientResource createWithClassloaderCheckDisabled() {
38+
return new MiniClusterWithClientResource(
39+
new MiniClusterResourceConfiguration.Builder()
40+
.setNumberTaskManagers(DEFAULT_TM_NUM)
41+
.setNumberSlotsPerTaskManager(DEFAULT_PARALLELISM)
42+
.setConfiguration(DISABLE_CLASSLOADER_CHECK_CONFIG)
43+
.build());
44+
}
45+
}

amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common/src/test/java/org/apache/amoro/flink/catalog/TestMixedCatalog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.apache.amoro.TableTestHelper;
3434
import org.apache.amoro.catalog.BasicCatalogTestHelper;
3535
import org.apache.amoro.catalog.CatalogTestBase;
36+
import org.apache.amoro.flink.MiniClusterResource;
3637
import org.apache.amoro.flink.catalog.factories.CatalogFactoryOptions;
3738
import org.apache.amoro.shade.guava32.com.google.common.collect.Lists;
3839
import org.apache.amoro.shade.guava32.com.google.common.collect.Maps;
@@ -51,7 +52,6 @@
5152
import org.apache.flink.types.Row;
5253
import org.apache.flink.util.CloseableIterator;
5354
import org.apache.flink.util.CollectionUtil;
54-
import org.apache.iceberg.flink.MiniClusterResource;
5555
import org.junit.After;
5656
import org.junit.Assert;
5757
import org.junit.Before;

amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common/src/test/java/org/apache/amoro/flink/table/AmoroCatalogITCaseBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import static org.apache.flink.table.api.config.TableConfigOptions.TABLE_DYNAMIC_TABLE_OPTIONS_ENABLED;
2222

2323
import org.apache.amoro.TestAms;
24+
import org.apache.amoro.flink.MiniClusterResource;
2425
import org.apache.amoro.formats.AmoroCatalogTestBase;
2526
import org.apache.amoro.formats.AmoroCatalogTestHelper;
2627
import org.apache.amoro.hive.TestHMS;
@@ -36,7 +37,6 @@
3637
import org.apache.flink.table.api.TableResult;
3738
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;
3839
import org.apache.flink.test.util.MiniClusterWithClientResource;
39-
import org.apache.iceberg.flink.MiniClusterResource;
4040
import org.junit.ClassRule;
4141

4242
import java.io.IOException;

amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common/src/test/java/org/apache/amoro/flink/table/CatalogITCaseBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.apache.amoro.TableTestHelper;
2424
import org.apache.amoro.catalog.CatalogTestHelper;
2525
import org.apache.amoro.catalog.TableTestBase;
26+
import org.apache.amoro.flink.MiniClusterResource;
2627
import org.apache.flink.api.common.restartstrategy.RestartStrategies;
2728
import org.apache.flink.configuration.Configuration;
2829
import org.apache.flink.runtime.state.StateBackend;
@@ -35,7 +36,6 @@
3536
import org.apache.flink.table.api.TableResult;
3637
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;
3738
import org.apache.flink.test.util.MiniClusterWithClientResource;
38-
import org.apache.iceberg.flink.MiniClusterResource;
3939
import org.junit.ClassRule;
4040

4141
public abstract class CatalogITCaseBase extends TableTestBase {

amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common/src/test/java/org/apache/amoro/flink/table/TestUnkeyedOverwrite.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.apache.amoro.catalog.BasicCatalogTestHelper;
2525
import org.apache.amoro.catalog.CatalogTestHelper;
2626
import org.apache.amoro.flink.FlinkTestBase;
27+
import org.apache.amoro.flink.MiniClusterResource;
2728
import org.apache.amoro.flink.util.DataUtil;
2829
import org.apache.amoro.hive.TestHMS;
2930
import org.apache.amoro.hive.catalog.HiveCatalogTestHelper;
@@ -32,7 +33,6 @@
3233
import org.apache.flink.table.api.DataTypes;
3334
import org.apache.flink.table.api.Table;
3435
import org.apache.flink.test.util.MiniClusterWithClientResource;
35-
import org.apache.iceberg.flink.MiniClusterResource;
3636
import org.junit.After;
3737
import org.junit.Assert;
3838
import org.junit.ClassRule;

0 commit comments

Comments
 (0)