func agentRPCTestHealthStream(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) { c, errFunc, err := client.HealthStream(ctx, ti) if err != nil { t.Fatalf("HealthStream failed: %v", err) } // channel should have one response, then closed hsr, ok := <-c if !ok { t.Fatalf("HealthStream got no response") } // close HealthStreamSynchronization so server side knows we // got the response, and it can send the error close(HealthStreamSynchronization) _, ok = <-c if ok { t.Fatalf("HealthStream wasn't closed") } err = errFunc() if !strings.Contains(err.Error(), testRegisterHealthStreamError) { t.Fatalf("HealthStream failed with the wrong error: %v", err) } compareError(t, "HealthStream", nil, *hsr, *testHealthStreamHealthStreamReply) }
func agentRPCTestHealthStreamPanic(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) { c, errFunc, err := client.HealthStream(ctx, ti) if err != nil { t.Fatalf("HealthStream failed: %v", err) } // channel should have no response, just closed _, ok := <-c if ok { t.Fatalf("HealthStream wasn't closed") } err = errFunc() expectRPCWrapPanic(t, err) }