fix: ignore cancellation error in test (#15532)

Fixes: https://github.com/coder/internal/issues/211
This commit is contained in:
Marcin Tojek
2024-11-15 12:20:35 +01:00
committed by GitHub
parent dbf41a1160
commit 23470789f1
+4 -1
View File
@@ -13,6 +13,7 @@ import (
"net/http"
"net/http/httptest"
"net/url"
"os"
"os/exec"
"runtime"
"strings"
@@ -119,7 +120,9 @@ func TestAgentScript(t *testing.T) {
// Kill the command, wait for the command to yield.
err := cmd.Cancel()
if err != nil {
if errors.Is(err, os.ErrProcessDone) {
t.Log("script has already finished execution")
} else if err != nil {
t.Fatalf("unable to cancel the command: %v, see logs:\n%s", err, output.String())
}
wg.Wait()