fix(agent/x/agentdesktop): flaky TestPortableDesktop_StopRecording_WithThumbnail (#24671)

Fixes https://github.com/coder/internal/issues/1462
This commit is contained in:
Hugo Dutka
2026-04-23 14:54:05 +02:00
committed by GitHub
parent 95386f526a
commit 397c9fb76a
@@ -636,7 +636,9 @@ func TestPortableDesktop_StopRecording_ReturnsArtifact(t *testing.T) {
logger := slogtest.Make(t, nil)
rec := &recordedExecer{
scripts: map[string]string{
"record": `trap 'exit 0' INT; sleep 120 & wait`,
// Use exec so SIGINT is delivered directly to sleep
// and the process exits immediately. (See coder/internal#1462.)
"record": `exec sleep 120`,
"up": `printf '{"vncPort":5901,"geometry":"1920x1080"}\n' && sleep 120`,
},
}
@@ -680,7 +682,9 @@ func TestPortableDesktop_StopRecording_WithThumbnail(t *testing.T) {
logger := slogtest.Make(t, nil)
rec := &recordedExecer{
scripts: map[string]string{
"record": `trap 'exit 0' INT; sleep 120 & wait`,
// See TestPortableDesktop_StopRecording_ReturnsArtifact
// for why we use exec instead of trap+wait.
"record": `exec sleep 120`,
"up": `printf '{"vncPort":5901,"geometry":"1920x1080"}\n' && sleep 120`,
},
}