add mutex for test field
Signed-off-by: Meredith Lancaster <malancas@github.com>
This commit is contained in:
parent
fb4fc7e7c2
commit
69865117ab
1 changed files with 4 additions and 0 deletions
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue