Skip to content

Commit 32691e6

Browse files
authored
test(agent/agentscripts): fix test flake in TestEnv (#12326)
1 parent cbaf1c6 commit 32691e6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

agent/agentscripts/agentscripts_test.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,18 @@ func TestEnv(t *testing.T) {
6969

7070
ctx := testutil.Context(t, testutil.WaitLong)
7171

72-
testutil.Go(t, func() {
72+
done := testutil.Go(t, func() {
7373
err := runner.Execute(ctx, func(script codersdk.WorkspaceAgentScript) bool {
7474
return true
7575
})
7676
assert.NoError(t, err)
7777
})
78+
defer func() {
79+
select {
80+
case <-ctx.Done():
81+
case <-done:
82+
}
83+
}()
7884

7985
var log []agentsdk.Log
8086
for {

0 commit comments

Comments
 (0)