mirror of
https://github.com/kopia/kopia.git
synced 2026-09-14 22:32:19 -04:00
Fix TestServerControlSocketActivated flake. - Clear `runner.ExtraFiles` before calling running other commands. This appears to be the primary source of the spurious test failures. Refactor `TestServerControlSocketActivated` to: - start server from the test (go)routine instead of a background one; - process server's output synchrounously in the test goroutine; - fix race: close the listener file descriptor synchronously in the test goroutine instead of async, which ensures the descriptor is closed before sending the first request to the (status) server; otherwise, shutdown hangs (when the listener close is delayed); - check and assert server's exit status; - improve test cleanup: ensure child server process terminates and is reaped on assertion failure. Also, address potential race in `TestServerControlSocketActivatedTooManyFDs` check with explanation comment. There is still a posible race where the stderr pipe is closed before the background async callback gets the error message. This will be addressed separately.