Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dumpling: fix unstable sql mock #32667

Merged
merged 4 commits into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dumpling/export/dump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"time"

"github.com/DATA-DOG/go-sqlmock"
"github.com/pingcap/errors"
"github.com/stretchr/testify/require"
"golang.org/x/sync/errgroup"

"github.com/pingcap/errors"
"github.com/pingcap/tidb/br/pkg/version"
tcontext "github.com/pingcap/tidb/dumpling/context"
"github.com/pingcap/tidb/parser"
Expand All @@ -26,6 +26,7 @@ func TestDumpBlock(t *testing.T) {
}()

mock.ExpectQuery(fmt.Sprintf("SHOW CREATE DATABASE `%s`", escapeString(database))).
WillDelayFor(time.Second).
WillReturnRows(sqlmock.NewRows([]string{"Database", "Create Database"}).
AddRow("test", "CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET utf8mb4 */"))
mock.ExpectQuery(fmt.Sprintf("SELECT DEFAULT_COLLATION_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '%s'", escapeString(database))).
Expand Down
2 changes: 1 addition & 1 deletion dumpling/export/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func ShowCreateTable(tctx *tcontext.Context, db *BaseConn, database, table strin
}

// ShowCreatePlacementPolicy constructs the create policy SQL for a specified table
// returns (createPoilicySQL, error)
// returns (createPolicySQL, error)
func ShowCreatePlacementPolicy(tctx *tcontext.Context, db *BaseConn, policy string) (string, error) {
var oneRow [2]string
handleOneRow := func(rows *sql.Rows) error {
Expand Down