Skip to content

Commit

Permalink
test(dm): fix query to mock is unordered (#7570)
Browse files Browse the repository at this point in the history
close #7569
  • Loading branch information
lance6716 authored Nov 10, 2022
1 parent c982fca commit 07fa0b9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dm/checker/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ func TestTableSchemaChecking(t *testing.T) {
// no PK/UK should raise error per table

mock := initMockDB(t)
mock.MatchExpectationsInOrder(false)
mock.ExpectQuery("SHOW VARIABLES LIKE 'max_connections'").WillReturnRows(sqlmock.NewRows([]string{"Variable_name", "Value"}).AddRow("max_connections", "2"))
mock.ExpectQuery("SHOW VARIABLES LIKE 'sql_mode'").WillReturnRows(sqlmock.NewRows([]string{"Variable_name", "Value"}).AddRow("sql_mode", ""))
mock.ExpectQuery("SHOW VARIABLES LIKE 'sql_mode'").WillReturnRows(sqlmock.NewRows([]string{"Variable_name", "Value"}).AddRow("sql_mode", ""))
Expand All @@ -386,6 +387,7 @@ func TestTableSchemaChecking(t *testing.T) {
require.NoError(t, mock.ExpectationsWereMet())

mock = initMockDB(t)
mock.MatchExpectationsInOrder(false)
mock.ExpectQuery("SHOW VARIABLES LIKE 'max_connections'").WillReturnRows(sqlmock.NewRows([]string{"Variable_name", "Value"}).AddRow("max_connections", "2"))
mock.ExpectQuery("SHOW VARIABLES LIKE 'sql_mode'").WillReturnRows(sqlmock.NewRows([]string{"Variable_name", "Value"}).AddRow("sql_mode", ""))
mock.ExpectQuery("SHOW VARIABLES LIKE 'sql_mode'").WillReturnRows(sqlmock.NewRows([]string{"Variable_name", "Value"}).AddRow("sql_mode", ""))
Expand Down

0 comments on commit 07fa0b9

Please sign in to comment.