func testStreamTablesPanics(t *testing.T, bpc binlogplayer.BinlogPlayerClient) { c := make(chan *proto.BinlogTransaction) bpr := bpc.StreamTables(testTablesRequest, c) if se, ok := <-c; ok { t.Fatalf("got a response when error expected: %v", se) } err := bpr.Error() if err == nil || !strings.Contains(err.Error(), "test-triggered panic") { t.Errorf("wrong error from panic: %v", err) } }
func testStreamTables(t *testing.T, bpc binlogplayer.BinlogPlayerClient) { c := make(chan *proto.BinlogTransaction) bpr := bpc.StreamTables(testTablesRequest, c) if se, ok := <-c; !ok { t.Fatalf("got no response") } else { if !reflect.DeepEqual(*se, *testBinlogTransaction) { t.Errorf("got wrong result, got %v expected %v", *se, *testBinlogTransaction) } } if se, ok := <-c; ok { t.Fatalf("got a response when error expected: %v", se) } if err := bpr.Error(); err != nil { t.Errorf("got unexpected error: %v", err) } }