Install a nightly Docker cleanup timer with init --systemd (v0.9.7)
Port of the legacy host's docker-prune.timer: 02:00 host time, Persistent=true, docker system prune -af — but without --volumes, so the per-repository Gradle cache volumes survive. The units are host-global; several GitTally instances share one timer. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
74bc4c2d73
commit
e1f3f5f384
@@ -104,6 +104,26 @@ class InitCommandTest : FunSpec() {
|
||||
tempDir.resolve(".git/gittally/gittally.env").toFile().shouldExist()
|
||||
}
|
||||
|
||||
test("--systemd also generates the nightly Docker cleanup timer") {
|
||||
val tempDir = Files.createTempDirectory("gittally-init-test")
|
||||
initCommand.workingDir = tempDir
|
||||
initCommand.systemd = true
|
||||
initCommand.jarPathResolver = { Paths.get("/home/ci/bin/gittally.jar") }
|
||||
initCommand.javaExecutableResolver = { Paths.get("/usr/bin/java") }
|
||||
|
||||
every { gitService.getTopLevel(tempDir) } returns tempDir
|
||||
every { gitService.getOriginUrl(tempDir) } returns "https://git.example.org/my-org/my-repo.git"
|
||||
|
||||
initCommand.run()
|
||||
|
||||
val pruneService = tempDir.resolve(".git/gittally/gittally-docker-prune.service")
|
||||
pruneService.toFile().shouldExist()
|
||||
pruneService.toFile().readText() shouldContain "docker system prune -af"
|
||||
val pruneTimer = tempDir.resolve(".git/gittally/gittally-docker-prune.timer")
|
||||
pruneTimer.toFile().shouldExist()
|
||||
pruneTimer.toFile().readText() shouldContain "OnCalendar=*-*-* 02:00:00"
|
||||
}
|
||||
|
||||
test("--systemd keeps an existing environment file") {
|
||||
val tempDir = Files.createTempDirectory("gittally-init-test")
|
||||
initCommand.workingDir = tempDir
|
||||
|
||||
Reference in New Issue
Block a user