Merge pull request #515 from bradfitz/fatalf
Don't call t.FailNow in goroutines started by tests.
This commit is contained in:
@ -286,21 +286,23 @@ func TestReconnectTimeout(t *testing.T) {
|
|||||||
waitC := make(chan struct{})
|
waitC := make(chan struct{})
|
||||||
go func() {
|
go func() {
|
||||||
defer close(waitC)
|
defer close(waitC)
|
||||||
argSize := 271828
|
const argSize = 271828
|
||||||
respSize := 314159
|
const respSize = 314159
|
||||||
|
|
||||||
payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, int32(argSize))
|
payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, argSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Error(err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
req := &testpb.SimpleRequest{
|
req := &testpb.SimpleRequest{
|
||||||
ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(),
|
ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(),
|
||||||
ResponseSize: proto.Int32(int32(respSize)),
|
ResponseSize: proto.Int32(respSize),
|
||||||
Payload: payload,
|
Payload: payload,
|
||||||
}
|
}
|
||||||
if _, err := tc.UnaryCall(context.Background(), req); err == nil {
|
if _, err := tc.UnaryCall(context.Background(), req); err == nil {
|
||||||
t.Fatalf("TestService/UnaryCall(_, _) = _, <nil>, want _, non-nil")
|
t.Errorf("TestService/UnaryCall(_, _) = _, <nil>, want _, non-nil")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// Block untill reconnect times out.
|
// Block untill reconnect times out.
|
||||||
@ -664,29 +666,32 @@ func testMetadataUnaryRPC(t *testing.T, e env) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func performOneRPC(t *testing.T, tc testpb.TestServiceClient, wg *sync.WaitGroup) {
|
func performOneRPC(t *testing.T, tc testpb.TestServiceClient, wg *sync.WaitGroup) {
|
||||||
argSize := 2718
|
defer wg.Done()
|
||||||
respSize := 314
|
const argSize = 2718
|
||||||
|
const respSize = 314
|
||||||
|
|
||||||
payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, int32(argSize))
|
payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, argSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Error(err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
req := &testpb.SimpleRequest{
|
req := &testpb.SimpleRequest{
|
||||||
ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(),
|
ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(),
|
||||||
ResponseSize: proto.Int32(int32(respSize)),
|
ResponseSize: proto.Int32(respSize),
|
||||||
Payload: payload,
|
Payload: payload,
|
||||||
}
|
}
|
||||||
reply, err := tc.UnaryCall(context.Background(), req)
|
reply, err := tc.UnaryCall(context.Background(), req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("TestService/UnaryCall(_, _) = _, %v, want _, <nil>", err)
|
t.Errorf("TestService/UnaryCall(_, _) = _, %v, want _, <nil>", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
pt := reply.GetPayload().GetType()
|
pt := reply.GetPayload().GetType()
|
||||||
ps := len(reply.GetPayload().GetBody())
|
ps := len(reply.GetPayload().GetBody())
|
||||||
if pt != testpb.PayloadType_COMPRESSABLE || ps != respSize {
|
if pt != testpb.PayloadType_COMPRESSABLE || ps != respSize {
|
||||||
t.Fatalf("Got the reply with type %d len %d; want %d, %d", pt, ps, testpb.PayloadType_COMPRESSABLE, respSize)
|
t.Errorf("Got reply with type %d len %d; want %d, %d", pt, ps, testpb.PayloadType_COMPRESSABLE, respSize)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
wg.Done()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRetry(t *testing.T) {
|
func TestRetry(t *testing.T) {
|
||||||
|
Reference in New Issue
Block a user