Skip to content

Commit

Permalink
test: update test assertions
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Taylor <andres@planetscale.com>
  • Loading branch information
systay committed May 23, 2024
1 parent b915f19 commit 07d72f4
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions go/vt/vtgate/executor_select_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2894,10 +2894,8 @@ func TestCrossShardSubquery(t *testing.T) {
}}
utils.MustMatch(t, wantQueries, sbc2.Queries)

wantResult := sqltypes.MakeTestResult(sqltypes.MakeTestFields("id", "int32"), "1")
if !result.Equal(wantResult) {
t.Errorf("result: %+v, want %+v", result, wantResult)
}
wantResult := sqltypes.MakeTestResult(sqltypes.MakeTestFields("id1", "int32"), "1")
assert.Equal(t, wantResult, result)
}

func TestSubQueryAndQueryWithLimit(t *testing.T) {
Expand Down Expand Up @@ -2971,15 +2969,13 @@ func TestCrossShardSubqueryStream(t *testing.T) {

wantResult := &sqltypes.Result{
Fields: []*querypb.Field{
{Name: "id", Type: sqltypes.Int32, Charset: collations.CollationBinaryID, Flags: uint32(querypb.MySqlFlag_NUM_FLAG)},
{Name: "id1", Type: sqltypes.Int32, Charset: collations.CollationBinaryID, Flags: uint32(querypb.MySqlFlag_NUM_FLAG)},
},
Rows: [][]sqltypes.Value{{
sqltypes.NewInt32(1),
}},
}
if !result.Equal(wantResult) {
t.Errorf("result: %+v, want %+v", result, wantResult)
}
assert.Equal(t, wantResult, result)
}

func TestCrossShardSubqueryGetFields(t *testing.T) {
Expand Down Expand Up @@ -3015,12 +3011,10 @@ func TestCrossShardSubqueryGetFields(t *testing.T) {
wantResult := &sqltypes.Result{
Fields: []*querypb.Field{
{Name: "col", Type: sqltypes.Int32, Charset: collations.CollationBinaryID, Flags: uint32(querypb.MySqlFlag_NUM_FLAG)},
{Name: "id", Type: sqltypes.Int32, Charset: collations.CollationBinaryID, Flags: uint32(querypb.MySqlFlag_NUM_FLAG)},
{Name: "id1", Type: sqltypes.Int32, Charset: collations.CollationBinaryID, Flags: uint32(querypb.MySqlFlag_NUM_FLAG)},
},
}
if !result.Equal(wantResult) {
t.Errorf("result: %+v, want %+v", result, wantResult)
}
assert.Equal(t, wantResult, result)
}

func TestSelectBindvarswithPrepare(t *testing.T) {
Expand All @@ -3042,9 +3036,7 @@ func TestSelectBindvarswithPrepare(t *testing.T) {
BindVariables: map[string]*querypb.BindVariable{"id": sqltypes.Int64BindVariable(1)},
}}
utils.MustMatch(t, wantQueries, sbc1.Queries)
if sbc2.Queries != nil {
t.Errorf("sbc2.Queries: %+v, want nil\n", sbc2.Queries)
}
assert.Empty(t, sbc2.Queries)
}

func TestSelectDatabasePrepare(t *testing.T) {
Expand Down

0 comments on commit 07d72f4

Please sign in to comment.