-
-
Notifications
You must be signed in to change notification settings - Fork 382
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
--no-server
mode also terminate on removal of processId
file…
…, use it in integration test cleanup (#4587) This attempts to fix some of the residual flakiness encountered in #4570 Somehow the recursive process termination we pulled in from upstream com-lihaoyi/os-lib#359 only works some of the time, and other times the processes get leaked. This PR extends the `serverId`-file-deleted shutdown logic we already used for client-server mode and enables it for `--no-server` mode as well. This lets us put an additional guardrail in our `IntegrationTester#close` to delete any such files, to try and force any Mill processes to terminate. Added an additional integration test to exercise this behavior Also fixed a bug in `ExampleTester` not honoring the `clientServerMode` flag, and update `testkit.test` to assert on those behaviors
- Loading branch information
Showing
16 changed files
with
187 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
integration/invalidation/process-file-deleted-exit/resources/build.mill
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package build | ||
import mill._ | ||
|
||
def foo = Task { 123 } |
49 changes: 49 additions & 0 deletions
49
integration/invalidation/process-file-deleted-exit/src/ProcessFileDeletedExit.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package mill.integration | ||
|
||
import mill.testkit.{UtestIntegrationTestSuite, IntegrationTester} | ||
import utest._ | ||
|
||
import scala.concurrent.Future | ||
import scala.concurrent.ExecutionContext.Implicits.global | ||
import scala.concurrent.duration._ | ||
import utest.asserts.{RetryMax, RetryInterval} | ||
|
||
/** | ||
* Make sure removing the `mill-server` or `mill-no-server` directory | ||
* kills any running process | ||
*/ | ||
object ProcessFileDeletedExit extends UtestIntegrationTestSuite { | ||
implicit val retryMax: RetryMax = RetryMax(10.seconds) | ||
implicit val retryInterval: RetryInterval = RetryInterval(1.seconds) | ||
val tests: Tests = Tests { | ||
integrationTest { tester => | ||
import tester._ | ||
|
||
assert(!os.exists(workspacePath / "out/mill-server")) | ||
assert(!os.exists(workspacePath / "out/mill-no-server")) | ||
|
||
@volatile var watchTerminated = false | ||
Future { | ||
eval( | ||
("--watch", "foo"), | ||
stdout = os.ProcessOutput.Readlines { println(_) }, | ||
stderr = os.ProcessOutput.Readlines { println(_) } | ||
) | ||
watchTerminated = true | ||
} | ||
|
||
if (tester.clientServerMode) eventually { os.exists(workspacePath / "out/mill-server") } | ||
else eventually { os.exists(workspacePath / "out/mill-no-server") } | ||
|
||
assert(watchTerminated == false) | ||
|
||
val processRoot = | ||
if (tester.clientServerMode) workspacePath / "out/mill-server" | ||
else workspacePath / "out/mill-no-server" | ||
|
||
os.list(processRoot).map(p => os.remove(p / "processId")) | ||
|
||
eventually { watchTerminated == true } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,7 +157,7 @@ object IntegrationTester { | |
) | ||
} | ||
|
||
removeServerIdFile() | ||
removeProcessIdFile() | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.