Skip to content

Commit

Permalink
Fix arguments in fakeworkloadapi
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Turner <turner@uber.com>
  • Loading branch information
Ryan Turner committed Apr 1, 2024
1 parent 0895de6 commit 55ac1e5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion v2/internal/test/fakeworkloadapi/workload_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func New(tb testing.TB) *WorkloadAPI {
x509BundlesChans: make(map[chan *workload.X509BundlesResponse]struct{}),
}

listener, err := newListener()
listener, err := newListener(tb)
require.NoError(tb, err)

server := grpc.NewServer()
Expand Down
3 changes: 2 additions & 1 deletion v2/internal/test/fakeworkloadapi/workload_api_posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ package fakeworkloadapi
import (
"fmt"
"net"
"testing"
)

func newListener() (net.Listener, error) {
func newListener(_ testing.TB) (net.Listener, error) {
return net.Listen("tcp", "localhost:0")
}

Expand Down
6 changes: 3 additions & 3 deletions v2/internal/test/fakeworkloadapi/workload_api_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func NewWithNamedPipeListener(tb testing.TB) *WorkloadAPI {
jwtBundlesChans: make(map[chan *workload.JWTBundlesResponse]struct{}),
}

listener, err := winio.ListenPipe(fmt.Sprintf(`\\.\pipe\go-spiffe-test-pipe-%x`, randUint64()), nil)
listener, err := winio.ListenPipe(fmt.Sprintf(`\\.\pipe\go-spiffe-test-pipe-%x`, randUint64(tb)), nil)
require.NoError(tb, err)

server := grpc.NewServer()
Expand Down Expand Up @@ -54,8 +54,8 @@ func randUint64(t testing.TB) uint64 {
return n.Uint64()
}

func newListener() (net.Listener, error) {
return winio.ListenPipe(fmt.Sprintf(`\\.\pipe\go-spiffe-test-pipe-%x`, randUint64()), nil)
func newListener(tb testing.TB) (net.Listener, error) {
return winio.ListenPipe(fmt.Sprintf(`\\.\pipe\go-spiffe-test-pipe-%x`, randUint64(tb)), nil)
}

func getTargetName(addr net.Addr) string {
Expand Down

0 comments on commit 55ac1e5

Please sign in to comment.