(t *testing.T, watchFunc healthWatchFunc)
| 141 | } |
| 142 | |
| 143 | func setupServer(t *testing.T, watchFunc healthWatchFunc) (*grpc.Server, net.Listener, *testHealthServer) { |
| 144 | t.Helper() |
| 145 | |
| 146 | lis, err := net.Listen("tcp", "localhost:0") |
| 147 | if err != nil { |
| 148 | t.Fatalf("net.Listen() failed: %v", err) |
| 149 | } |
| 150 | |
| 151 | var ts *testHealthServer |
| 152 | if watchFunc != nil { |
| 153 | ts = newTestHealthServerWithWatchFunc(watchFunc) |
| 154 | } else { |
| 155 | ts = newTestHealthServer() |
| 156 | } |
| 157 | s := grpc.NewServer() |
| 158 | healthgrpc.RegisterHealthServer(s, ts) |
| 159 | testgrpc.RegisterTestServiceServer(s, &testServer{}) |
| 160 | go s.Serve(lis) |
| 161 | t.Cleanup(func() { s.Stop() }) |
| 162 | return s, lis, ts |
| 163 | } |
| 164 | |
| 165 | type clientConfig struct { |
| 166 | balancerName string |
no test coverage detected