Skip to content

Commit 0dc2c24

Browse files
authored
[Managed Iceberg] refactor integration tests; make it easy to add a new catalog to test suite (#33444)
1 parent def0678 commit 0dc2c24

File tree

12 files changed

+323
-503
lines changed

12 files changed

+323
-503
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"comment": "Modify this file in a trivial way to cause this test suite to run",
3-
"modification": 7
3+
"modification": 1
44
}

.github/workflows/IO_Iceberg_Integration_Tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,4 @@ jobs:
7575
- name: Run IcebergIO Integration Test
7676
uses: ./.github/actions/gradle-command-self-hosted-action
7777
with:
78-
gradle-command: :sdks:java:io:iceberg:catalogTests --info
78+
gradle-command: :sdks:java:io:iceberg:integrationTest --info

sdks/java/io/iceberg/build.gradle

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ hadoopVersions.each {kv -> configurations.create("hadoopVersion$kv.key")}
4040
def iceberg_version = "1.6.1"
4141
def parquet_version = "1.12.0"
4242
def orc_version = "1.9.2"
43+
def hive_version = "3.1.3"
4344

4445
dependencies {
4546
implementation library.java.vendored_guava_32_1_2_jre
@@ -66,6 +67,18 @@ dependencies {
6667
testImplementation project(path: ":sdks:java:core", configuration: "shadowTest")
6768
testImplementation project(":sdks:java:extensions:google-cloud-platform-core")
6869
testImplementation library.java.junit
70+
71+
// Hive catalog test dependencies
72+
testImplementation project(path: ":sdks:java:io:iceberg:hive")
73+
testImplementation "org.apache.iceberg:iceberg-common:$iceberg_version"
74+
testImplementation ("org.apache.iceberg:iceberg-hive-metastore:$iceberg_version")
75+
testImplementation ("org.apache.hive:hive-metastore:$hive_version")
76+
testImplementation "org.assertj:assertj-core:3.11.1"
77+
testRuntimeOnly ("org.apache.hive.hcatalog:hive-hcatalog-core:$hive_version") {
78+
exclude group: "org.apache.hive", module: "hive-exec"
79+
exclude group: "org.apache.parquet", module: "parquet-hadoop-bundle"
80+
}
81+
6982
testRuntimeOnly library.java.slf4j_jdk14
7083
testRuntimeOnly project(path: ":runners:direct-java", configuration: "shadow")
7184
testRuntimeOnly project(path: ":runners:google-cloud-dataflow-java")
@@ -106,10 +119,10 @@ hadoopVersions.each { kv ->
106119
}
107120
}
108121

109-
task integrationTest(type: Test) {
122+
task catalogTests(type: Test) {
110123
group = "Verification"
111124
def gcpProject = project.findProperty('gcpProject') ?: 'apache-beam-testing'
112-
def gcpTempLocation = project.findProperty('gcpTempLocation') ?: 'gs://temp-storage-for-end-to-end-tests'
125+
def gcpTempLocation = project.findProperty('gcpTempLocation') ?: 'gs://managed-iceberg-integration-tests'
113126
systemProperty "beamTestPipelineOptions", JsonOutput.toJson([
114127
"--project=${gcpProject}",
115128
"--tempLocation=${gcpTempLocation}",
@@ -125,11 +138,6 @@ task integrationTest(type: Test) {
125138
testClassesDirs = sourceSets.test.output.classesDirs
126139
}
127140

128-
tasks.register('catalogTests') {
129-
dependsOn integrationTest
130-
dependsOn ":sdks:java:io:iceberg:hive:integrationTest"
131-
}
132-
133141
task loadTest(type: Test) {
134142
def gcpProject = project.findProperty('gcpProject') ?: 'apache-beam-testing'
135143
def gcpTempLocation = project.findProperty('gcpTempLocation') ?: 'gs://temp-storage-for-end-to-end-tests/temp-lt'

sdks/java/io/iceberg/hive/build.gradle

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ def avatica_version = "1.25.0"
3636
dependencies {
3737
// dependencies needed to run with iceberg's hive catalog
3838
// these dependencies are going to be included in io-expansion-service
39-
implementation ("org.apache.iceberg:iceberg-hive-metastore:$iceberg_version")
40-
permitUnusedDeclared ("org.apache.iceberg:iceberg-hive-metastore:$iceberg_version")
39+
runtimeOnly ("org.apache.iceberg:iceberg-hive-metastore:$iceberg_version")
4140
// analyzeClassesDependencies fails with "Cannot accept visitor on URL", likely the plugin does not recognize "core" classifier
4241
// use "core" classifier to depend on un-shaded jar
4342
runtimeOnly ("org.apache.hive:hive-exec:$hive_version:core") {
@@ -51,53 +50,10 @@ dependencies {
5150
runtimeOnly ("org.apache.hadoop:hadoop-yarn-server-resourcemanager:$hadoop_version")
5251
runtimeOnly ("org.apache.hbase:hbase-client:$hbase_version")
5352
runtimeOnly ("org.apache.calcite.avatica:avatica-core:$avatica_version")
54-
implementation ("org.apache.hive:hive-metastore:$hive_version")
55-
runtimeOnly ("org.apache.iceberg:iceberg-parquet:$iceberg_version")
56-
permitUnusedDeclared ("org.apache.hive:hive-metastore:$hive_version")
57-
58-
// ----- below dependencies are for testing and will not appear in the shaded jar -----
59-
// Beam IcebergIO dependencies
60-
testImplementation project(path: ":sdks:java:core", configuration: "shadow")
61-
testImplementation project(":sdks:java:managed")
62-
testImplementation project(":sdks:java:io:iceberg")
63-
testRuntimeOnly project(path: ":runners:direct-java", configuration: "shadow")
64-
testRuntimeOnly library.java.snake_yaml
65-
testRuntimeOnly library.java.bigdataoss_gcs_connector
66-
testRuntimeOnly library.java.hadoop_client
67-
68-
// needed to set up the test environment
69-
testImplementation "org.apache.iceberg:iceberg-common:$iceberg_version"
70-
testImplementation "org.apache.iceberg:iceberg-core:$iceberg_version"
71-
testImplementation "org.assertj:assertj-core:3.11.1"
72-
testImplementation library.java.junit
73-
74-
// needed to set up test Hive Metastore and run tests
75-
testRuntimeOnly ("org.apache.hive.hcatalog:hive-hcatalog-core:$hive_version") {
76-
exclude group: "org.apache.hive", module: "hive-exec"
77-
exclude group: "org.apache.parquet", module: "parquet-hadoop-bundle"
78-
}
79-
testImplementation "org.apache.iceberg:iceberg-parquet:$iceberg_version"
80-
testImplementation "org.apache.parquet:parquet-column:1.12.0"
53+
runtimeOnly ("org.apache.hive:hive-metastore:$hive_version")
8154
}
8255

8356
configurations.all {
8457
// the fatjar "parquet-hadoop-bundle" conflicts with "parquet-hadoop" used by org.apache.iceberg:iceberg-parquet
8558
exclude group: "org.apache.parquet", module: "parquet-hadoop-bundle"
8659
}
87-
88-
task integrationTest(type: Test) {
89-
group = "Verification"
90-
def gcpTempLocation = project.findProperty('gcpTempLocation') ?: 'gs://temp-storage-for-end-to-end-tests/iceberg-hive-it'
91-
systemProperty "beamTestPipelineOptions", JsonOutput.toJson([
92-
"--tempLocation=${gcpTempLocation}",
93-
])
94-
95-
// Disable Gradle cache: these ITs interact with live service that should always be considered "out of date"
96-
outputs.upToDateWhen { false }
97-
98-
include '**/*IT.class'
99-
100-
maxParallelForks 4
101-
classpath = sourceSets.test.runtimeClasspath
102-
testClassesDirs = sourceSets.test.output.classesDirs
103-
}

0 commit comments

Comments
 (0)