1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2026-03-30 08:20:09 +02:00

♻️ Ensure services status is known at launch

- Added shell pipe timeout (w/ new tests)
- Reworked ServicesManager to be blocking for startup (10s)
- Renamed queues to be more consistent
This commit is contained in:
2026-01-30 13:26:04 +01:00
parent 4fc4737434
commit 2fe58bcb5b
10 changed files with 145 additions and 60 deletions

View File

@@ -64,6 +64,27 @@ struct RealShellTest {
}
}
@Test func pipe_can_timeout_and_return_empty_output() async {
let start = ContinuousClock.now
let output = await container.shell.pipe("php -r \"sleep(30);\"", timeout: 0.5)
let duration = start.duration(to: .now)
// Should return empty output on timeout
#expect(output.out.isEmpty)
#expect(output.err.isEmpty)
// Should have timed out in roughly 0.5 seconds (allow some margin)
#expect(duration < .seconds(2))
}
@Test func pipe_without_timeout_completes_normally() async {
let output = await container.shell.pipe("php -v")
#expect(output.out.contains("Copyright (c) The PHP Group"))
}
@Test func can_run_multiple_shell_commands_in_parallel() async throws {
let start = ContinuousClock.now