Commit graph

4 commits

Author SHA1 Message Date
Colin Cross
2f08bc1a5c Increase timeouts in Test_runWithTimeout
Under load sometimes the 1 millisecond timeouts are not run before
a 1 second sleep finishes, or `echo foo` is not run before a 1
second timeoutt.  Increase the long sleeps and timeouts to 10 seconds.
This doesn't affect normal test runtime as the command should timeout
after 1 millisecond.

Bug: 199207577
Test: Test_runWithTimeout
Change-Id: I31166850a473b9cde37906a62d026580e7a7bd3f
2021-09-17 21:36:29 +00:00
Colin Cross
11ec0a8f8b Add more debugging to run_with_timeout
Print more messages in run_with_timeout to make it easier to
determine which log statements came before the timeout and the
on_timeout command.

Test: run_with_timeout_test.go
Change-Id: I92ad663529fa03d91185ba382654a73f0eba1ab7
2021-08-05 16:51:50 -07:00
Colin Cross
71d6ab6827 Fix concurrency issues in Test_runWithTimeout
Use a concurrency-safe writer in runWithTimeout to avoid data races
on the bytes.Buffer passed in during tests.

Bug: 181095653
Fixes: 187149270
Test: Test_runWithTimeout
Test: go test -race ./cmd/run_with_timeout
Change-Id: I57a889765cb9ee7b42983f0906313e0c2d1e414e
2021-05-04 09:15:30 -07:00
Colin Cross
9b6bcc6bff Add a wrapper command to detect timeouts
Add a command that can be used to wrap actions with a timeout, and
optionally run an extra debugging command on timeout.

Bug: 181095653
Test: run_with_timeout_test.go
Change-Id: I91df5c3fb5277968717815a4ad4612113766dab1
2021-04-30 14:14:45 -07:00