Skip to content

Commit 87e51fa

Browse files
authored
Fix surefire version inconsistency and smoke tests (#3223)
* Fix surefire version inconsistency * Use JUnit 5 expression after surefire update * Fix Smoke test pick up test for run after corrected labels
1 parent ff9870f commit 87e51fa

File tree

9 files changed

+50
-16
lines changed

9 files changed

+50
-16
lines changed

cicd/cmd/run-it-smoke-tests/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func main() {
4949
// Run integration tests
5050
mvnFlags = workflows.NewMavenFlags()
5151
err = workflows.MvnVerify().Run(
52-
mvnFlags.IncludeDependencies(),
52+
mvnFlags.DoNotIncludeDependencies(),
5353
mvnFlags.SkipDependencyAnalysis(),
5454
mvnFlags.SkipCheckstyle(),
5555
mvnFlags.SkipJib(),

cicd/cmd/run-it-tests/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func main() {
4848
// Run integration tests
4949
mvnFlags = workflows.NewMavenFlags()
5050
err = workflows.MvnVerify().Run(
51-
mvnFlags.IncludeDependencies(),
51+
mvnFlags.DoNotIncludeDependencies(),
5252
mvnFlags.SkipDependencyAnalysis(),
5353
mvnFlags.SkipCheckstyle(),
5454
mvnFlags.SkipJib(),

cicd/internal/op/maven.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ import (
2222
"github.com/GoogleCloudPlatform/DataflowTemplates/cicd/internal/flags"
2323
)
2424

25+
const IncludeDependencies string = "-am"
26+
const DoNotIncludeDependencies string = "-no-am"
27+
2528
// Runs the given Maven command on a specified POM file. Considering the input, this is equivalent to:
2629
//
2730
// mvn -B {cmd} -f {pom} {args...}
@@ -30,12 +33,23 @@ func RunMavenOnPom(pom string, cmd string, args ...string) error {
3033
fullArgs = append(fullArgs, strings.Split(cmd, " ")...)
3134
fullArgs = append(fullArgs, "-f", pom)
3235
fullArgs = append(fullArgs, "-e")
33-
fullArgs = append(fullArgs, args...)
36+
includeDep := true
37+
for _, arg := range args {
38+
if arg == DoNotIncludeDependencies {
39+
includeDep = false
40+
} else if arg == IncludeDependencies {
41+
includeDep = true
42+
} else {
43+
fullArgs = append(fullArgs, arg)
44+
}
45+
}
3446
modules := flags.ModulesToBuild()
3547
if len(modules) != 0 {
3648
moduleArgs := []string{"-pl", strings.Join(modules, ",")}
3749
fullArgs = append(fullArgs, moduleArgs...)
38-
fullArgs = append(fullArgs, "-am")
50+
if includeDep {
51+
fullArgs = append(fullArgs, "-am")
52+
}
3953
}
4054
return RunCmdAndStreamOutput("mvn", fullArgs)
4155
}

cicd/internal/workflows/maven-workflows.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const (
3939
// `Run` method.
4040
type MavenFlags interface {
4141
IncludeDependencies() string
42+
DoNotIncludeDependencies() string
4243
IncludeDependents() string
4344
SkipCheckstyle() string
4445
SkipDependencyAnalysis() string
@@ -65,7 +66,11 @@ type MavenFlags interface {
6566
type mvnFlags struct{}
6667

6768
func (*mvnFlags) IncludeDependencies() string {
68-
return "-am"
69+
return op.IncludeDependencies
70+
}
71+
72+
func (*mvnFlags) DoNotIncludeDependencies() string {
73+
return op.DoNotIncludeDependencies
6974
}
7075

7176
func (*mvnFlags) IncludeDependents() string {

it/iceberg/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</parent>
2424
<modelVersion>4.0.0</modelVersion>
2525

26-
<artifactId>iceberg</artifactId>
26+
<artifactId>it-iceberg</artifactId>
2727

2828
<properties>
2929
<iceberg.version>1.10.1</iceberg.version>

it/iceberg/src/test/java/com/google/cloud/teleport/it/iceberg/IcebergResourceManagerIT.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.apache.iceberg.types.Types;
4141
import org.junit.After;
4242
import org.junit.Before;
43+
import org.junit.Ignore;
4344
import org.junit.Test;
4445
import org.junit.experimental.categories.Category;
4546
import org.junit.runner.RunWith;
@@ -48,6 +49,9 @@
4849
/** Integration tests for Iceberg Resource Manager. */
4950
@Category(TestContainersIntegrationTest.class)
5051
@RunWith(JUnit4.class)
52+
@Ignore(
53+
"https://github.com/GoogleCloudPlatform/DataflowTemplates/issues/3224") // re-enable after tests
54+
// fixed
5155
public class IcebergResourceManagerIT {
5256

5357
private static String warehouseLocation;

pom.xml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
<snakeyaml.version>2.4</snakeyaml.version>
8484
<snappy.version>1.1.10.8</snappy.version>
8585
<spotless-maven-plugin.version>2.46.1</spotless-maven-plugin.version>
86-
<surefire.version>2.21.0</surefire.version>
86+
<surefire.version>3.5.3</surefire.version>
8787
<truth.version>1.4.5</truth.version>
8888
<netty.version>4.1.125.Final</netty.version>
8989

@@ -366,11 +366,21 @@
366366
<excludedGroups>${excluded.spanner.tests}</excludedGroups>
367367
<trimStackTrace>false</trimStackTrace>
368368
<reportFormat>html</reportFormat>
369+
<enableOutErrElements>false</enableOutErrElements>
370+
<enablePropertiesElement>false</enablePropertiesElement>
369371
<systemPropertyVariables>
370372
<!-- Allow this project to be tested with JDK 21 -->
371373
<net.bytebuddy.experimental>true</net.bytebuddy.experimental>
372374
</systemPropertyVariables>
373375
</configuration>
376+
<dependencies>
377+
<dependency>
378+
<!-- Specify JUnit4 provider as Templates tests currently using JUnit4 -->
379+
<groupId>org.apache.maven.surefire</groupId>
380+
<artifactId>surefire-junit47</artifactId>
381+
<version>${surefire.version}</version>
382+
</dependency>
383+
</dependencies>
374384
</plugin>
375385
<plugin>
376386
<groupId>com.diffplug.spotless</groupId>
@@ -514,7 +524,7 @@
514524
<plugin>
515525
<groupId>org.apache.maven.plugins</groupId>
516526
<artifactId>maven-surefire-report-plugin</artifactId>
517-
<version>3.5.3</version>
527+
<version>${surefire.version}</version>
518528
<configuration>
519529
<outputDirectory>${project.build.directory}/surefire-reports</outputDirectory>
520530
<outputName>surefire-report</outputName>
@@ -593,6 +603,8 @@
593603
<parallel>${itParallelismType}</parallel>
594604
<threadCount>${itParallelism}</threadCount>
595605
<trimStackTrace>false</trimStackTrace>
606+
<enableOutErrElements>false</enableOutErrElements>
607+
<enablePropertiesElement>false</enablePropertiesElement>
596608
</configuration>
597609
</plugin>
598610
</plugins>
@@ -749,8 +761,7 @@
749761
com.google.cloud.teleport.metadata.SkipDirectRunnerTest
750762
</excludedGroups>
751763
<groups>
752-
${integration.tests}
753-
${direct-runner.tests}
764+
${integration.tests},${direct-runner.tests}
754765
</groups>
755766
<systemProperties>
756767
<!-- Pass on the flag directRunnerTest to the templates test base -->
@@ -793,14 +804,14 @@
793804
<include>**/*IT.java</include>
794805
</includes>
795806
<groups>
796-
${direct-runner.tests}
797-
org.apache.beam.it.testcontainers.TestContainersIntegrationTest
798-
org.apache.beam.it.gcp.GoogleCloudIntegrationTest
807+
${direct-runner.tests},org.apache.beam.it.testcontainers.TestContainersIntegrationTest,org.apache.beam.it.gcp.GoogleCloudIntegrationTest
799808
</groups>
800809
<reuseForks>true</reuseForks>
801810
<parallel>${itParallelismType}</parallel>
802811
<threadCount>${itParallelism}</threadCount>
803812
<trimStackTrace>false</trimStackTrace>
813+
<enableOutErrElements>false</enableOutErrElements>
814+
<enablePropertiesElement>false</enablePropertiesElement>
804815
</configuration>
805816
</plugin>
806817
</plugins>

v2/cdc-parent/cdc-embedded-connector/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@
144144
</dependency>
145145
<dependency>
146146
<groupId>org.mockito</groupId>
147-
<artifactId>mockito-all</artifactId>
148-
<version>1.10.19</version>
147+
<artifactId>mockito-core</artifactId>
148+
<version>${mockito.version}</version>
149149
<scope>test</scope>
150150
</dependency>
151151
</dependencies>

yaml/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
</dependency>
7575
<dependency>
7676
<groupId>com.google.cloud.teleport</groupId>
77-
<artifactId>iceberg</artifactId>
77+
<artifactId>it-iceberg</artifactId>
7878
<version>${project.version}</version>
7979
<scope>test</scope>
8080
</dependency>

0 commit comments

Comments
 (0)