Skip to content

Commit 564a509

Browse files
committed
Retry more occasionally flaky tests on the CI
1 parent a5f1049 commit 564a509

File tree

6 files changed

+85
-38
lines changed

6 files changed

+85
-38
lines changed

modules/integration/src/test/scala/scala/cli/integration/BspTestDefinitions.scala

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2169,16 +2169,25 @@ abstract class BspTestDefinitions extends ScalaCliSuite with TestScalaVersionArg
21692169

21702170
for { cliVersion <- Seq("1.5.0", "1.5.0-19-g932866db6-SNAPSHOT", "1.0.0") }
21712171
test(s"setup-ide doesn't pass unrecognised arguments to old --cli-versions: $cliVersion") {
2172-
val scriptName = "cli-version.sc"
2173-
val inputs = TestInputs(
2174-
os.rel / scriptName -> s"""println("Hello from launcher v$cliVersion"""
2175-
)
2176-
inputs.fromRoot { root =>
2177-
val r =
2178-
os.proc(TestUtil.cli, "--cli-version", cliVersion, "setup-ide", scriptName, extraOptions)
2179-
.call(cwd = root, stderr = os.Pipe, check = false)
2180-
expect(!r.err.text().contains("Unrecognized argument"))
2181-
expect(r.exitCode == 0)
2172+
TestUtil.retryOnCi() {
2173+
val scriptName = "cli-version.sc"
2174+
val inputs = TestInputs(
2175+
os.rel / scriptName -> s"""println("Hello from launcher v$cliVersion"""
2176+
)
2177+
inputs.fromRoot { root =>
2178+
val r =
2179+
os.proc(
2180+
TestUtil.cli,
2181+
"--cli-version",
2182+
cliVersion,
2183+
"setup-ide",
2184+
scriptName,
2185+
extraOptions
2186+
)
2187+
.call(cwd = root, stderr = os.Pipe, check = false)
2188+
expect(!r.err.text().contains("Unrecognized argument"))
2189+
expect(r.exitCode == 0)
2190+
}
21822191
}
21832192
}
21842193

modules/integration/src/test/scala/scala/cli/integration/ExportCommonTestDefinitions.scala

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,23 +99,33 @@ trait ExportCommonTestDefinitions { _: ScalaCliSuite & TestScalaVersionArgs =>
9999

100100
if (runExportTests) {
101101
test("JVM") {
102-
jvmTest(runMainArgs(Some("Main")), runTestsArgs(Some("Main")), mainClassName = "Main")
102+
TestUtil.retryOnCi() {
103+
jvmTest(runMainArgs(Some("Main")), runTestsArgs(Some("Main")), mainClassName = "Main")
104+
}
103105
}
104106
test("extra source from a directive introducing a dependency") {
105-
extraSourceFromDirectiveWithExtraDependency("Main", "Main.scala")
107+
TestUtil.retryOnCi() {
108+
extraSourceFromDirectiveWithExtraDependency("Main", "Main.scala")
109+
}
106110
}
107111
test("extra source passed both via directive and from command line") {
108-
extraSourceFromDirectiveWithExtraDependency("Main", ".")
112+
TestUtil.retryOnCi() {
113+
extraSourceFromDirectiveWithExtraDependency("Main", ".")
114+
}
109115
}
110116
scalaVersionsInDir.foreach { scalaV =>
111117
test(s"check export for project with scala version in directive as $scalaV") {
112-
scalaVersionTest(scalaV, "Main")
118+
TestUtil.retryOnCi() {
119+
scalaVersionTest(scalaV, "Main")
120+
}
113121
}
114122
}
115123

116124
test("just test scope") {
117125
// Keeping the test name ends with Test to support maven convention
118-
justTestScope("MyTest")
126+
TestUtil.retryOnCi() {
127+
justTestScope("MyTest")
128+
}
119129
}
120130

121131
}

modules/integration/src/test/scala/scala/cli/integration/ExportMillTestDefinitions.scala

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,28 +81,36 @@ abstract class ExportMillTestDefinitions extends ScalaCliSuite
8181

8282
if (runExportTests) {
8383
test("JVM custom project name") {
84-
val customProjectName = "newproject"
85-
jvmTest(
86-
mainArgs = Seq(s"$customProjectName.run"),
87-
testArgs = Seq(s"$customProjectName.test"),
88-
extraExportArgs = Seq("-p", customProjectName),
89-
mainClassName = "Hello"
90-
)
84+
TestUtil.retryOnCi() {
85+
val customProjectName = "newproject"
86+
jvmTest(
87+
mainArgs = Seq(s"$customProjectName.run"),
88+
testArgs = Seq(s"$customProjectName.test"),
89+
extraExportArgs = Seq("-p", customProjectName),
90+
mainClassName = "Hello"
91+
)
92+
}
9193
}
9294
test("JVM scalac options") {
93-
jvmTestScalacOptions("Hello")
95+
TestUtil.retryOnCi() {
96+
jvmTestScalacOptions("Hello")
97+
}
9498
}
9599
}
96100
if (runExportTests && !actualScalaVersion.startsWith("3."))
97101
test("JVM with compiler plugin") {
98-
jvmTestCompilerPlugin("Hello")
102+
TestUtil.retryOnCi() {
103+
jvmTestCompilerPlugin("Hello")
104+
}
99105
}
100106

101107
test("Scala Native") {
102108
// FIXME this should be adjusted to Scala Native 0.5.x syntax once Mill gets support for it
103-
simpleTest(
104-
ExportTestProjects.nativeTest(actualScalaVersion, useNative04Syntax = true),
105-
mainClass = None
106-
)
109+
TestUtil.retryOnCi() {
110+
simpleTest(
111+
ExportTestProjects.nativeTest(actualScalaVersion, useNative04Syntax = true),
112+
mainClass = None
113+
)
114+
}
107115
}
108116
}

modules/integration/src/test/scala/scala/cli/integration/ExportSbtTestDefinitions.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ abstract class ExportSbtTestDefinitions extends ScalaCliSuite
2323
override def runTestsArgs(mainClass: Option[String]): Seq[String] = Seq("test")
2424

2525
test("Scala Native") {
26-
simpleTest(ExportTestProjects.nativeTest(actualScalaVersion), mainClass = None)
26+
TestUtil.retryOnCi() {
27+
simpleTest(ExportTestProjects.nativeTest(actualScalaVersion), mainClass = None)
28+
}
2729
}
2830
}

modules/integration/src/test/scala/scala/cli/integration/ExportScalaOrientedBuildToolsTestDefinitions.scala

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,24 @@ trait ExportScalaOrientedBuildToolsTestDefinitions {
7373

7474
if (runExportTests) {
7575
test("compile-time only for jsoniter macros") {
76-
compileOnlyTest("main")
76+
TestUtil.retryOnCi() {
77+
compileOnlyTest("main")
78+
}
7779
}
7880
test("Scala.js") {
79-
simpleTest(ExportTestProjects.jsTest(actualScalaVersion), mainClass = None)
81+
TestUtil.retryOnCi() {
82+
simpleTest(ExportTestProjects.jsTest(actualScalaVersion), mainClass = None)
83+
}
8084
}
8185
test("zio test") {
82-
testZioTest("ZioSpec")
86+
TestUtil.retryOnCi() {
87+
testZioTest("ZioSpec")
88+
}
8389
}
8490
test("Ensure test framework NPE is not thrown when depending on logback") {
85-
logbackBugCase("main")
91+
TestUtil.retryOnCi() {
92+
logbackBugCase("main")
93+
}
8694
}
8795
}
8896
}

modules/integration/src/test/scala/scala/cli/integration/PackageTestDefinitions.scala

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -506,21 +506,29 @@ abstract class PackageTestDefinitions extends ScalaCliSuite with TestScalaVersio
506506

507507
if (!Properties.isWin && actualScalaVersion.startsWith("2.13")) {
508508
test("simple native") {
509-
simpleNativeTest()
509+
TestUtil.retryOnCi() {
510+
simpleNativeTest()
511+
}
510512
}
511513
test("dynamic library native") {
512-
libraryNativeTest(shared = true)
514+
TestUtil.retryOnCi() {
515+
libraryNativeTest(shared = true)
516+
}
513517
}
514518

515519
test("dynamic library native override from command line") {
516-
libraryNativeTest(shared = false, commandLineShared = Some(true))
520+
TestUtil.retryOnCi() {
521+
libraryNativeTest(shared = false, commandLineShared = Some(true))
522+
}
517523
}
518524

519525
// To produce a static library, `LLVM_BIN` environment variable needs to be
520526
// present (for `llvm-ar` utility)
521527
if (sys.env.contains("LLVM_BIN"))
522528
test("shared library native") {
523-
libraryNativeTest(shared = false)
529+
TestUtil.retryOnCi() {
530+
libraryNativeTest(shared = false)
531+
}
524532
}
525533

526534
}
@@ -1102,7 +1110,9 @@ abstract class PackageTestDefinitions extends ScalaCliSuite with TestScalaVersio
11021110

11031111
if (Properties.isLinux)
11041112
test("pass java options to docker") {
1105-
javaOptionsDockerTest()
1113+
TestUtil.retryOnCi() {
1114+
javaOptionsDockerTest()
1115+
}
11061116
}
11071117

11081118
test("default values in help") {

0 commit comments

Comments
 (0)