From 64533289a936bc67ed3887a7ac53094d64a6c72b Mon Sep 17 00:00:00 2001 From: Tomasz Godzik Date: Mon, 28 Oct 2024 09:45:43 +0100 Subject: [PATCH] chore: Retry code actions for Scala CLi diags I must have lost it during one of the rebases --- .../main/scala/tests/scalacli/BaseScalaCLIActionSuite.scala | 4 +++- .../src/test/scala/tests/scalacli/ScalaCliActionsSuite.scala | 3 +++ .../main/scala/tests/codeactions/BaseCodeActionLspSuite.scala | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/slow/src/main/scala/tests/scalacli/BaseScalaCLIActionSuite.scala b/tests/slow/src/main/scala/tests/scalacli/BaseScalaCLIActionSuite.scala index 0a393090de0..c6459cec44c 100644 --- a/tests/slow/src/main/scala/tests/scalacli/BaseScalaCLIActionSuite.scala +++ b/tests/slow/src/main/scala/tests/scalacli/BaseScalaCLIActionSuite.scala @@ -66,6 +66,7 @@ class BaseScalaCLIActionSuite(name: String) changeFile: String => String = identity, expectError: Boolean = false, filterAction: CodeAction => Boolean = _ => true, + retryAction: Int = 0, )(implicit loc: Location): Unit = { val path = toPath(fileName) @@ -95,7 +96,8 @@ class BaseScalaCLIActionSuite(name: String) changeFile, expectError, filterAction, - overrideLayout = layout, + layout, + retryAction, ) } } diff --git a/tests/slow/src/test/scala/tests/scalacli/ScalaCliActionsSuite.scala b/tests/slow/src/test/scala/tests/scalacli/ScalaCliActionsSuite.scala index c6e306bd8a7..e7c1c3b7814 100644 --- a/tests/slow/src/test/scala/tests/scalacli/ScalaCliActionsSuite.scala +++ b/tests/slow/src/test/scala/tests/scalacli/ScalaCliActionsSuite.scala @@ -28,6 +28,7 @@ class ScalaCliActionsSuite val coursierComplete = new CoursierComplete(scalaCompilerVersion) val newestOsLib: String = coursierComplete .complete("com.lihaoyi::os-lib:") + .filterNot(_.contains("M")) .headOption .map(_.stripPrefix(":")) .getOrElse("0.8.1") @@ -53,6 +54,7 @@ class ScalaCliActionsSuite scalaCliOptions = List("--actions", "-S", scalaVersion), expectNoDiagnostics = false, selectedActionIndex = 1, + retryAction = 5, ) checkScalaCLI( @@ -83,6 +85,7 @@ class ScalaCliActionsSuite scalaCliOptions = List("--actions", "-S", scalaVersion), expectNoDiagnostics = false, selectedActionIndex = 1, + retryAction = 5, ) checkNoActionScalaCLI( diff --git a/tests/unit/src/main/scala/tests/codeactions/BaseCodeActionLspSuite.scala b/tests/unit/src/main/scala/tests/codeactions/BaseCodeActionLspSuite.scala index bd2c2d04958..55d812a46d2 100644 --- a/tests/unit/src/main/scala/tests/codeactions/BaseCodeActionLspSuite.scala +++ b/tests/unit/src/main/scala/tests/codeactions/BaseCodeActionLspSuite.scala @@ -138,6 +138,7 @@ abstract class BaseCodeActionLspSuite( .recoverWith { case _: Throwable if retry > 0 => Thread.sleep(2000) + scribe.debug("Retrying code actions") assertCodeAction(retry - 1) case _: Throwable if expectError => Future.successful(Nil)