func testSplitQuery(t *testing.T, conn *vtgateconn.VTGateConn) { ctx := context.Background() qsl, err := conn.SplitQuery(ctx, splitQueryRequest.Keyspace, splitQueryRequest.Query, splitQueryRequest.SplitCount) if err != nil { t.Fatalf("SplitQuery failed: %v", err) } if !reflect.DeepEqual(qsl, splitQueryResult.Splits) { t.Errorf("SplitQuery returned worng result: got %v wanted %v", qsl, splitQueryResult.Splits) } }
func testEchoSplitQuery(t *testing.T, conn *vtgateconn.VTGateConn) { want := &pbg.SplitQueryResponse_Part{ Query: tproto.BoundQueryToProto3(echoPrefix+query+":split_column:123", bindVars), KeyRangePart: &pbg.SplitQueryResponse_KeyRangePart{Keyspace: keyspace}, } got, err := conn.SplitQuery(context.Background(), keyspace, echoPrefix+query, bindVars, "split_column", 123) if err != nil { t.Fatalf("SplitQuery error: %v", err) } // For some reason, proto.Equal() is calling them unequal even though no diffs // are found. gotstr, wantstr := got[0].String(), want.String() if gotstr != wantstr { t.Errorf("SplitQuery() = %v, want %v", gotstr, wantstr) } }
func testSplitQueryPanic(t *testing.T, conn *vtgateconn.VTGateConn) { ctx := context.Background() _, err := conn.SplitQuery(ctx, splitQueryRequest.Keyspace, splitQueryRequest.Query, splitQueryRequest.SplitCount) expectPanic(t, err) }