Skip to content

Commit 8666d0f

Browse files
mtojekpull[bot]
authored andcommitted
fix: ignore cancellation error in test (#15532)
Fixes: coder/internal#211
1 parent 7f67c27 commit 8666d0f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

provisionersdk/agent_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"net/http"
1414
"net/http/httptest"
1515
"net/url"
16+
"os"
1617
"os/exec"
1718
"runtime"
1819
"strings"
@@ -119,7 +120,9 @@ func TestAgentScript(t *testing.T) {
119120

120121
// Kill the command, wait for the command to yield.
121122
err := cmd.Cancel()
122-
if err != nil {
123+
if errors.Is(err, os.ErrProcessDone) {
124+
t.Log("script has already finished execution")
125+
} else if err != nil {
123126
t.Fatalf("unable to cancel the command: %v, see logs:\n%s", err, output.String())
124127
}
125128
wg.Wait()

0 commit comments

Comments
 (0)