Exemplo n.º 1
0
func getUpdateStreamError(stream vtgateconn.UpdateStreamReader, err error) error {
	if err != nil {
		return err
	}
	for {
		_, _, err := stream.Recv()
		switch err {
		case nil:
			// keep going
		case io.EOF:
			return nil
		default:
			return err
		}
	}
}
Exemplo n.º 2
0
func testEchoUpdateStream(t *testing.T, conn *vtgateconn.VTGateConn) {
	var stream vtgateconn.UpdateStreamReader
	var err error

	ctx := callerid.NewContext(context.Background(), callerID, nil)

	stream, err = conn.UpdateStream(ctx, echoPrefix+query, keyRanges[0], tabletType, 0, eventToken)
	if err != nil {
		t.Fatal(err)
	}
	se, _, err := stream.Recv()
	if err != nil {
		t.Fatal(err)
	}
	if se.EventToken.Position != updateStreamEcho {
		t.Errorf("UpdateStream(0) = %v, want %v", se.EventToken.Position, updateStreamEcho)
	}
}