Skip to content

Commit

Permalink
bugfix: Try to fix Mill flaky test
Browse files Browse the repository at this point in the history
My guess is that the test failed because it takes a while for the build server to connect. Let's see if this helps.
  • Loading branch information
tgodzik committed Sep 22, 2023
1 parent b511ce9 commit 7a8c6b7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,7 @@ class MetalsLspService(
}
} else {
buildServerPromise.future.flatMap { _ =>
scribe.info("Build server promise finished")
def load(): Future[Unit] = {
val compileAndLoad =
Future.sequence(
Expand Down
13 changes: 13 additions & 0 deletions tests/slow/src/test/scala/tests/mill/MillServerCodeLensSuite.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package tests.mill

import java.util.concurrent.TimeUnit

import scala.concurrent.duration.Duration

import scala.meta.internal.metals.MetalsEnrichments._
import tests.MetalsTestEnrichments._
import scala.meta.internal.metals.ServerCommands
import scala.meta.internal.metals.{BuildInfo => V}

Expand All @@ -14,8 +18,15 @@ class MillServerCodeLensSuite

override def munitTimeout: Duration = Duration("4min")

override def afterEach(context: AfterEach): Unit = {
super.afterEach(context)
scribe.info(workspace.resolve(".metals/bsp.trace.json").text)
}
test("run-mill-lens", maxRetry = 3) {

cleanWorkspace()
val bsp = workspace.resolve(".metals/bsp.trace.json")
bsp.touch()
writeLayout(
MillBuildLayout(
"""|/MillMinimal/src/Main.scala
Expand All @@ -40,6 +51,8 @@ class MillServerCodeLensSuite
_ <- server.initialize()
_ <- server.initialized()
_ <- server.executeCommand(ServerCommands.GenerateBspConfig)
_ <- server.server.indexingPromise.future
.withTimeout(2, TimeUnit.MINUTES)
_ <- server.didOpen("MillMinimal/src/Main.scala")
_ <- server.didSave("MillMinimal/src/Main.scala")(identity)
_ = assertNoDiagnostics()
Expand Down

0 comments on commit 7a8c6b7

Please sign in to comment.