From 69865117ab92abc2a1cb075b38f24302185de03e Mon Sep 17 00:00:00 2001 From: Meredith Lancaster Date: Mon, 6 Jan 2025 13:14:02 -0700 Subject: [PATCH] add mutex for test field Signed-off-by: Meredith Lancaster --- pkg/cmd/attestation/api/mock_httpClient_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/cmd/attestation/api/mock_httpClient_test.go b/pkg/cmd/attestation/api/mock_httpClient_test.go index b89c101fe..2914d7887 100644 --- a/pkg/cmd/attestation/api/mock_httpClient_test.go +++ b/pkg/cmd/attestation/api/mock_httpClient_test.go @@ -5,18 +5,22 @@ import ( "fmt" "io" "net/http" + "sync" "github.com/cli/cli/v2/pkg/cmd/attestation/test/data" "github.com/golang/snappy" ) type mockHttpClient struct { + mutex sync.RWMutex called bool OnGet func(url string) (*http.Response, error) } func (m *mockHttpClient) Get(url string) (*http.Response, error) { + m.mutex.Lock() m.called = true + m.mutex.Unlock() return m.OnGet(url) }