diff --git a/pkg/tools/builtin/fetch/expander_test.go b/pkg/tools/builtin/fetch/expander_test.go index 6372ad0406..82b7cea9c5 100644 --- a/pkg/tools/builtin/fetch/expander_test.go +++ b/pkg/tools/builtin/fetch/expander_test.go @@ -4,6 +4,7 @@ import ( "context" "net/http" "net/http/httptest" + "runtime" "testing" "github.com/stretchr/testify/assert" @@ -32,7 +33,12 @@ func TestNilExpander(t *testing.T) { t.Parallel() expander := New(WithExpander(tc.expander)).handler.expander assert.Nil(t, expander.ExpandMap(t.Context(), nil)) - assert.Panics(t, func() { expander.ExpandMap(t.Context(), map[string]string{}) }) + t.Run("nonempty map", func(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("recovered hardware faults can corrupt memory on Windows: golang/go#81238") + } + assert.Panics(t, func() { expander.ExpandMap(t.Context(), map[string]string{}) }) + }) }) } } diff --git a/pkg/tools/builtin/webhook/expander_test.go b/pkg/tools/builtin/webhook/expander_test.go index b598a014d3..aaaf83539a 100644 --- a/pkg/tools/builtin/webhook/expander_test.go +++ b/pkg/tools/builtin/webhook/expander_test.go @@ -2,6 +2,7 @@ package webhook import ( "context" + "runtime" "testing" "time" @@ -54,8 +55,13 @@ func TestNilTemplateExpander(t *testing.T) { tool.client = &fakeDoer{} verdict, _, _ := tool.attempt(t.Context(), SendArgs{Message: "hello"}) assert.Equal(t, delivered, verdict) - assert.Panics(t, func() { tool.expander.ExpandMap(t.Context(), map[string]string{}) }) - assert.Panics(t, func() { tool.expander.Expand(t.Context(), "${env.VALUE}", nil) }) + t.Run("nil receiver panics", func(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("recovered hardware faults can corrupt memory on Windows: golang/go#81238") + } + assert.Panics(t, func() { tool.expander.ExpandMap(t.Context(), map[string]string{}) }) + assert.Panics(t, func() { tool.expander.Expand(t.Context(), "${env.VALUE}", nil) }) + }) }) } }