From defecd5a185898166db287b1276a355a11e915b7 Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Fri, 15 Nov 2024 12:04:29 +0100 Subject: [PATCH] fix: ignore cancellation error in test --- provisionersdk/agent_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/provisionersdk/agent_test.go b/provisionersdk/agent_test.go index 142b3f5b860d6..b415b2396f94b 100644 --- a/provisionersdk/agent_test.go +++ b/provisionersdk/agent_test.go @@ -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()