Skip to content

Commit

Permalink
Accept testing.T instead of returning error
Browse files Browse the repository at this point in the history
  • Loading branch information
arjan-bal committed Dec 3, 2024
1 parent 446264a commit 1cc5991
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions balancer/pickfirst/pickfirstleaf/pickfirstleaf_ext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ func (s *testServer) resume() {
s.lis.Restart()
}

func newTestServer() (*testServer, error) {
func newTestServer(t *testing.T) *testServer {
l, err := testutils.LocalTCPListener()
if err != nil {
return nil, err
t.Fatalf("Failed to create listener: %v", err)
}
rl := testutils.NewRestartableListener(l)
ss := stubserver.StubServer{
Expand All @@ -96,7 +96,7 @@ func newTestServer() (*testServer, error) {
return &testServer{
StubServer: ss,
lis: rl,
}, nil
}
}

// setupPickFirstLeaf performs steps required for pick_first tests. It starts a
Expand All @@ -108,10 +108,7 @@ func setupPickFirstLeaf(t *testing.T, backendCount int, opts ...grpc.DialOption)
addrs := make([]resolver.Address, backendCount)

for i := 0; i < backendCount; i++ {
server, err := newTestServer()
if err != nil {
t.Fatalf("net.Listen() failed: %v", err)
}
server := newTestServer(t)
backend := stubserver.StartTestService(t, &server.StubServer)
t.Cleanup(func() {
backend.Stop()
Expand Down

0 comments on commit 1cc5991

Please sign in to comment.