1414 * limitations under the License.
1515 */
1616
17+ import org.gradle.api.plugins.jvm.JvmTestSuite
18+ import org.gradle.kotlin.dsl.register
19+
1720plugins {
1821 id(" authmgr-java" )
1922 id(" authmgr-java-testing" )
@@ -23,72 +26,179 @@ description = "Flink tests for Dremio AuthManager for Apache Iceberg"
2326
2427ext { set(" mavenName" , " Auth Manager for Apache Iceberg - OAuth2 - Flink Tests" ) }
2528
29+ // Matrix testing configuration
30+ val icebergVersions = project.findProperty(" authmgr.test.iceberg.versions" ).toString().split(" ," )
31+ val flinkVersions = project.findProperty(" authmgr.test.flink.versions" ).toString().split(" ," )
32+
33+ // Use the last combination as default for regular intTest
34+ val defaultIcebergVersion = icebergVersions.last()
35+ val defaultFlinkVersion = flinkVersions.last()
36+
37+ val intTestBase =
38+ configurations.create(" intTestBase" ) {
39+ description = " Base configuration holding common dependencies for Flink integration tests"
40+ isCanBeResolved = false
41+ isCanBeConsumed = false
42+ }
43+
44+ // Make intTestImplementation extend from intTestBase
45+ configurations.intTestImplementation.get().extendsFrom(intTestBase)
46+
2647dependencies {
2748
2849 // Note: iceberg-core will be provided by the iceberg-flink-runtime jar,
2950 // with shaded dependencies; it should not leak into this project unshaded.
3051
31- intTestImplementation (project(" :authmgr-oauth2-runtime" ))
52+ intTestBase (project(" :authmgr-oauth2-runtime" ))
3253
33- intTestImplementation (testFixtures(project(" :authmgr-oauth2-core" )) as ModuleDependency ) {
54+ intTestBase (testFixtures(project(" :authmgr-oauth2-core" )) as ModuleDependency ) {
3455 exclude(group = " org.apache.iceberg" )
3556 }
3657
58+ intTestBase(libs.hadoop.common)
59+ intTestBase(libs.hadoop.hdfs.client)
60+ intTestBase(libs.hadoop.mapreduce.client.core)
61+
62+ intTestBase(platform(libs.testcontainers.bom))
63+ intTestBase(" org.testcontainers:testcontainers" )
64+ intTestBase(libs.s3mock.testcontainers)
65+
66+ intTestBase(platform(libs.junit.bom))
67+ intTestBase(" org.junit.jupiter:junit-jupiter" )
68+ intTestBase(" org.junit.jupiter:junit-jupiter-api" )
69+ intTestBase(" org.junit.platform:junit-platform-launcher" )
70+
71+ intTestBase(libs.assertj.core)
72+ intTestBase(libs.mockito.core)
73+ intTestBase(libs.logback.classic)
74+
75+ // Add to intTestImplementation all Iceberg/Flink dependencies (with default versions)
76+ // that are required for compilation of test classes
3777 intTestImplementation(platform(libs.iceberg.bom))
3878 intTestImplementation(" org.apache.iceberg:iceberg-flink-runtime-1.20" )
79+ intTestImplementation(" org.apache.flink:flink-table-api-java:$defaultFlinkVersion " )
80+ }
81+
82+ // Create matrix test tasks for each version combination
83+ val matrixTestTasks = mutableListOf<TaskProvider <Test >>()
84+
85+ icebergVersions.forEach { icebergVersion ->
86+ flinkVersions.forEach { flinkVersion ->
87+ val suiteName =
88+ " intTest_iceberg${icebergVersion.replace(" ." , " _" )} _flink${flinkVersion.replace(" ." , " _" )} "
3989
40- intTestImplementation(libs.flink.table.api.java)
41- intTestImplementation(libs.flink.table.runtime)
42- intTestImplementation(libs.flink.table.planner.loader )
43- intTestImplementation(libs.flink.clients)
44- intTestImplementation(libs.flink.connector.base)
45- intTestImplementation(libs.flink.connector.files)
90+ val runtimeConfig =
91+ configurations.create(suiteName) {
92+ extendsFrom(intTestBase )
93+ isCanBeResolved = true
94+ isCanBeConsumed = false
95+ }
4696
47- intTestImplementation(libs.hadoop.common)
48- intTestImplementation(libs.hadoop.hdfs.client)
49- intTestImplementation(libs.hadoop.mapreduce.client.core)
97+ // Add version-specific dependencies
98+ dependencies {
99+ runtimeConfig(platform(" org.apache.iceberg:iceberg-bom:$icebergVersion " ))
100+ runtimeConfig(" org.apache.iceberg:iceberg-flink-runtime-1.20:$icebergVersion " )
101+ runtimeConfig(" org.apache.flink:flink-table-api-java:$flinkVersion " )
102+ runtimeConfig(" org.apache.flink:flink-table-runtime:$flinkVersion " )
103+ runtimeConfig(" org.apache.flink:flink-table-planner-loader:$flinkVersion " )
104+ runtimeConfig(" org.apache.flink:flink-clients:$flinkVersion " )
105+ runtimeConfig(" org.apache.flink:flink-connector-base:$flinkVersion " )
106+ runtimeConfig(" org.apache.flink:flink-connector-files:$flinkVersion " )
107+ runtimeConfig(" org.apache.iceberg:iceberg-aws-bundle:$icebergVersion " )
108+ }
50109
51- intTestRuntimeOnly(" org.apache.iceberg:iceberg-aws" )
52- intTestRuntimeOnly(" org.apache.iceberg:iceberg-aws-bundle" )
110+ testing {
111+ suites {
112+ register<JvmTestSuite >(suiteName) {
113+ targets.all {
114+ testTask.configure {
115+ shouldRunAfter(" test" )
53116
54- intTestImplementation(platform(libs.testcontainers.bom))
55- intTestImplementation( " org.testcontainers:testcontainers " )
56- intTestImplementation(libs.s3mock.testcontainers)
117+ if ( System .getenv( " CI " ) == null ) {
118+ maxParallelForks = 2
119+ }
57120
58- intTestImplementation(platform(libs.junit.bom))
59- intTestImplementation(" org.junit.jupiter:junit-jupiter" )
60- intTestImplementation(" org.junit.jupiter:junit-jupiter-api" )
121+ description =
122+ " Runs Flink integration tests with Iceberg $icebergVersion and Flink $flinkVersion "
61123
62- intTestImplementation(libs.assertj.core)
63- intTestImplementation(libs.mockito.core)
124+ // Use shared test classes from src/intTest
125+ testClassesDirs = sourceSets.intTest.get().output.classesDirs
126+ classpath = runtimeConfig + sourceSets.intTest.get().output
127+
128+ dependsOn(" :authmgr-oauth2-runtime:shadowJar" )
129+
130+ environment(" AWS_REGION" , " us-west-2" )
131+ environment(" AWS_ACCESS_KEY_ID" , " fake" )
132+ environment(" AWS_SECRET_ACCESS_KEY" , " fake" )
133+
134+ jvmArgs(
135+ " --add-exports" ,
136+ " java.base/sun.nio.ch=ALL-UNNAMED" ,
137+ " --add-opens" ,
138+ " java.base/java.util=ALL-UNNAMED" ,
139+ " --add-opens" ,
140+ " java.base/java.lang=ALL-UNNAMED" ,
141+ " --add-opens" ,
142+ " java.base/java.lang.reflect=ALL-UNNAMED" ,
143+ " --add-opens" ,
144+ " java.base/java.io=ALL-UNNAMED" ,
145+ " --add-opens" ,
146+ " java.base/java.net=ALL-UNNAMED" ,
147+ " --add-opens" ,
148+ " java.base/java.nio=ALL-UNNAMED" ,
149+ " --add-opens" ,
150+ " java.base/java.util.concurrent=ALL-UNNAMED" ,
151+ " --add-opens" ,
152+ " java.base/java.security=ALL-UNNAMED" ,
153+ )
154+
155+ // Set system properties to identify the versions being tested
156+ systemProperty(" authmgr.test.iceberg.version" , icebergVersion)
157+ systemProperty(" authmgr.test.flink.version" , flinkVersion)
158+
159+ inputs.property(" icebergVersion" , icebergVersion)
160+ inputs.property(" flinkVersion" , flinkVersion)
161+ }
162+ matrixTestTasks.add(testTask)
163+ }
164+ }
165+ }
166+ }
167+ }
64168}
65169
66170tasks.named<Test >(" intTest" ).configure {
67- if (System .getenv(" CI" ) == null ) {
68- maxParallelForks = 2
69- }
70- dependsOn(" :authmgr-oauth2-runtime:shadowJar" )
71- environment(" AWS_REGION" , " us-west-2" )
72- environment(" AWS_ACCESS_KEY_ID" , " fake" )
73- environment(" AWS_SECRET_ACCESS_KEY" , " fake" )
74- jvmArgs(
75- " --add-exports" ,
76- " java.base/sun.nio.ch=ALL-UNNAMED" ,
77- " --add-opens" ,
78- " java.base/java.util=ALL-UNNAMED" ,
79- " --add-opens" ,
80- " java.base/java.lang=ALL-UNNAMED" ,
81- " --add-opens" ,
82- " java.base/java.lang.reflect=ALL-UNNAMED" ,
83- " --add-opens" ,
84- " java.base/java.io=ALL-UNNAMED" ,
85- " --add-opens" ,
86- " java.base/java.net=ALL-UNNAMED" ,
87- " --add-opens" ,
88- " java.base/java.nio=ALL-UNNAMED" ,
89- " --add-opens" ,
90- " java.base/java.util.concurrent=ALL-UNNAMED" ,
91- " --add-opens" ,
92- " java.base/java.security=ALL-UNNAMED" ,
171+ dependsOn(
172+ tasks.named(
173+ " intTest_iceberg${defaultIcebergVersion.replace(" ." , " _" )} _flink${defaultFlinkVersion.replace(" ." , " _" )} "
174+ )
93175 )
176+ // the task itself should not run any tests
177+ enabled = false
178+ description =
179+ " Runs Flink integration tests with the default Iceberg version ($defaultIcebergVersion ) and default Flink version ($defaultFlinkVersion )."
180+ }
181+
182+ // Create a task to run all matrix tests
183+ tasks.register(" intTestMatrix" ) {
184+ group = " verification"
185+ description = " Runs all integration test matrix combinations."
186+ dependsOn(matrixTestTasks)
187+ }
188+
189+ // Helper task to print matrix configuration
190+ tasks.register(" printTestMatrix" ) {
191+ group = " help"
192+ description = " Prints the test matrix configuration."
193+ doLast {
194+ println (" Flink Integration Test Matrix:" )
195+ println (" Iceberg versions: ${icebergVersions.joinToString(" , " )} " )
196+ println (" Flink versions: ${flinkVersions.joinToString(" , " )} " )
197+ println (" Available tasks:" )
198+ matrixTestTasks.forEach { task ->
199+ val icebergVersion = task.get().inputs.properties[" icebergVersion" ]
200+ val flinkVersion = task.get().inputs.properties[" flinkVersion" ]
201+ println (" - ${task.name} uses: Iceberg $icebergVersion , Flink $flinkVersion " )
202+ }
203+ }
94204}
0 commit comments