mirror of https://github.com/sbt/sbt.git
Retry on IO error
This commit is contained in:
parent
2de01a8a05
commit
49e46c2451
|
|
@ -362,7 +362,7 @@ lazy val integrationTest = (project in file("integration-test"))
|
|||
libraryDependencies ++= Seq(
|
||||
"io.monix" %% "minitest" % "2.3.2" % Test,
|
||||
"com.eed3si9n.expecty" %% "expecty" % "0.11.0" % Test,
|
||||
"org.scala-sbt" %% "io" % "1.3.1" % Test
|
||||
"org.scala-sbt" %% "io" % "1.10.5" % Test
|
||||
),
|
||||
testFrameworks += new TestFramework("minitest.runner.Framework"),
|
||||
test in Test := {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,16 @@ object SbtScriptTest extends SimpleTestSuite with PowerAssertions {
|
|||
|
||||
private val javaBinDir = new File("integration-test", "bin").getAbsolutePath
|
||||
|
||||
private def makeTest(
|
||||
private def retry[A1](f: () => A1, maxAttempt: Int = 10): A1 =
|
||||
try {
|
||||
f()
|
||||
} catch {
|
||||
case _ if maxAttempt <= 1 =>
|
||||
Thread.sleep(100)
|
||||
retry(f, maxAttempt - 1)
|
||||
}
|
||||
|
||||
def makeTest(
|
||||
name: String,
|
||||
javaOpts: String = "",
|
||||
sbtOpts: String = "",
|
||||
|
|
@ -25,7 +34,7 @@ object SbtScriptTest extends SimpleTestSuite with PowerAssertions {
|
|||
)(args: String*)(f: List[String] => Any) = {
|
||||
test(name) {
|
||||
val workingDirectory = Files.createTempDirectory("sbt-launcher-package-test").toFile
|
||||
IO.copyDirectory(new File("citest"), workingDirectory)
|
||||
retry(() => IO.copyDirectory(new File("citest"), workingDirectory))
|
||||
|
||||
try {
|
||||
val sbtOptsFile = new File(workingDirectory, ".sbtopts")
|
||||
|
|
|
|||
Loading…
Reference in New Issue