Skip to content

Commit 65417f1

Browse files
authored
Use correct testing object, and add order by to test query to ensure determinism. (#2875)
1 parent 16743f5 commit 65417f1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

enginetest/server_engine_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ type serverScriptTestAssertion struct {
8383
expectedRows []any
8484

8585
// can't avoid writing custom comparator because of how gosql.Rows.Scan() works
86-
checkRows func(rows *gosql.Rows, expectedRows []any) (bool, error)
86+
checkRows func(t *testing.T, rows *gosql.Rows, expectedRows []any) (bool, error)
8787
}
8888

8989
type serverScriptTest struct {
@@ -108,7 +108,7 @@ func TestServerPreparedStatements(t *testing.T) {
108108
expectedRows: []any{
109109
[]float64{321.4},
110110
},
111-
checkRows: func(rows *gosql.Rows, expectedRows []any) (bool, error) {
111+
checkRows: func(t *testing.T, rows *gosql.Rows, expectedRows []any) (bool, error) {
112112
var i float64
113113
var rowNum int
114114
for rows.Next() {
@@ -133,7 +133,7 @@ func TestServerPreparedStatements(t *testing.T) {
133133
[]float64{213.4},
134134
[]float64{213.4},
135135
},
136-
checkRows: func(rows *gosql.Rows, expectedRows []any) (bool, error) {
136+
checkRows: func(t *testing.T, rows *gosql.Rows, expectedRows []any) (bool, error) {
137137
var i float64
138138
var rowNum int
139139
for rows.Next() {
@@ -197,7 +197,7 @@ func TestServerPreparedStatements(t *testing.T) {
197197
[]uint64{uint64(math.MaxInt64 + 1)},
198198
[]uint64{uint64(math.MaxUint64)},
199199
},
200-
checkRows: func(rows *gosql.Rows, expectedRows []any) (bool, error) {
200+
checkRows: func(t *testing.T, rows *gosql.Rows, expectedRows []any) (bool, error) {
201201
var i uint64
202202
var rowNum int
203203
for rows.Next() {
@@ -247,7 +247,7 @@ func TestServerPreparedStatements(t *testing.T) {
247247
[]int64{int64(-1)},
248248
[]int64{int64(math.MaxInt64)},
249249
},
250-
checkRows: func(rows *gosql.Rows, expectedRows []any) (bool, error) {
250+
checkRows: func(t *testing.T, rows *gosql.Rows, expectedRows []any) (bool, error) {
251251
var i int64
252252
var rowNum int
253253
for rows.Next() {
@@ -275,12 +275,12 @@ func TestServerPreparedStatements(t *testing.T) {
275275
},
276276
assertions: []serverScriptTestAssertion{
277277
{
278-
query: "select * from test where c0 = 2 and c1 = 3;",
278+
query: "select * from test where c0 = 2 and c1 = 3 order by pk;",
279279
expectedRows: []any{
280280
[]uint64{uint64(2), uint64(3), uint64(1)},
281281
[]uint64{uint64(2), uint64(3), uint64(7)},
282282
},
283-
checkRows: func(rows *gosql.Rows, expectedRows []any) (bool, error) {
283+
checkRows: func(t *testing.T, rows *gosql.Rows, expectedRows []any) (bool, error) {
284284
var c0, c1, pk uint64
285285
var rowNum int
286286
for rows.Next() {
@@ -363,7 +363,7 @@ func TestServerPreparedStatements(t *testing.T) {
363363
} else {
364364
require.NoError(t, err)
365365
}
366-
ok, err := assertion.checkRows(rows, assertion.expectedRows)
366+
ok, err := assertion.checkRows(t, rows, assertion.expectedRows)
367367
require.NoError(t, err)
368368
require.True(t, ok)
369369
})

0 commit comments

Comments
 (0)