Skip to content

Commit 9b666ba

Browse files
authored
Merge pull request #3049 from Gedochao/maintenance/overriding-versions-sanity-check
Prevent some flaky tests from failing on the CI
2 parents 96d1b39 + b112bc8 commit 9b666ba

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

modules/cli/src/test/scala/cli/tests/LauncherCliTest.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import scala.cli.commands.shared.CoursierOptions
88
import scala.cli.launcher.LauncherCli
99

1010
class LauncherCliTest extends munit.FunSuite {
11+
override def munitFlakyOK: Boolean = TestUtil.isCI
1112

12-
test("resolve nightly version") {
13+
test("resolve nightly version".flaky) {
1314
val logger = TestLogger()
1415
val cache = CoursierOptions().coursierCache(logger.coursierLogger(""))
1516
val scalaParameters = ScalaParameters(Constants.defaultScalaVersion)

modules/cli/src/test/scala/cli/tests/TestUtil.scala

+1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ object TestUtil {
2222

2323
file.map(f => os.read.bytes(os.Path(f, os.pwd)))
2424
}
25+
val isCI: Boolean = System.getenv("CI") != null
2526
}

modules/docs-tests/src/test/scala/sclicheck/DocTests.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import java.util.concurrent.TimeUnit
55
import scala.concurrent.duration.FiniteDuration
66

77
class DocTests extends munit.FunSuite {
8-
override def munitTimeout = new FiniteDuration(240, TimeUnit.SECONDS)
8+
override def munitTimeout = new FiniteDuration(360, TimeUnit.SECONDS)
99
case class DocTestEntry(name: String, path: os.Path, depth: Int = Int.MaxValue)
1010

1111
val docsRootPath: os.Path = os.pwd / "website" / "docs"

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

+6-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class SipScalaTests extends ScalaCliSuite with SbtTestHelper with MillTestHelper
1414
.takeWhile(_ != "Please bear in mind that non-ideal user experience should be expected.")
1515
.contains(s" - $featureNameAndType")
1616
}
17+
override def munitFlakyOK: Boolean = TestUtil.isCI
1718

1819
implicit class BinaryNameOps(binaryName: String) {
1920
def prepareBinary(root: os.Path): os.Path = {
@@ -458,7 +459,7 @@ class SipScalaTests extends ScalaCliSuite with SbtTestHelper with MillTestHelper
458459
}
459460
}
460461

461-
test(s"code using scala-continuations should compile for Scala 2.12.2") {
462+
test(s"code using scala-continuations should compile for Scala 2.12.2".flaky) {
462463
val sourceFileName = "example.scala"
463464
TestInputs(os.rel / sourceFileName ->
464465
"""import scala.util.continuations._
@@ -520,8 +521,9 @@ class SipScalaTests extends ScalaCliSuite with SbtTestHelper with MillTestHelper
520521
if (sv.startsWith("3")) "println(dotty.tools.dotc.config.Properties.simpleVersionString)"
521522
else "println(scala.util.Properties.versionNumberString)"
522523
anotherVersion =
523-
if (sv.startsWith("3")) Constants.scala3Lts
524-
else "2.13.7"
524+
if (sv.startsWith("2.13")) Constants.scala212
525+
else if (sv.startsWith("2.12")) Constants.scala213
526+
else Constants.scala3Lts
525527
} {
526528
test(
527529
s"default Scala version overridden with $sv by a launcher parameter is respected when running a script"
@@ -541,7 +543,7 @@ class SipScalaTests extends ScalaCliSuite with SbtTestHelper with MillTestHelper
541543
}
542544
}
543545
test(
544-
s"default Scala version overridden with $sv by a launcher parameter is overridable by -S"
546+
s"default Scala version overridden with $sv by a launcher parameter is overridable by -S passing $anotherVersion"
545547
) {
546548
TestInputs(os.rel / "simple.sc" -> code)
547549
.fromRoot { root =>

0 commit comments

Comments
 (0)