Skip to content

Commit

Permalink
dumpling: fix unstable test TestDumpBlock (#32009)
Browse files Browse the repository at this point in the history
close #32008
  • Loading branch information
Ehco1996 authored Jan 27, 2022
1 parent 6a5be6c commit d9b0c3a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dumpling/export/dump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ func TestDumpBlock(t *testing.T) {
time.Sleep(time.Second)
return context.Canceled
})

writerCtx := tctx.WithContext(writingCtx)
// simulate taskChan is full
taskChan := make(chan Task, 1)
taskChan <- &TaskDatabaseMeta{}
d.conf.Tables = DatabaseTables{}.AppendTable(database, nil)
d.conf.ServerInfo.ServerType = version.ServerTypeMySQL
require.ErrorIs(t, d.dumpDatabases(writerCtx, baseConn, taskChan), sqlmock.ErrCancelled)
require.ErrorIs(t, wg.Wait(), writerErr)
// if writerCtx is canceled , QuerySQL in `dumpDatabases` will return sqlmock.ErrCancelled
require.ErrorIs(t, d.dumpDatabases(writerCtx, baseConn, taskChan), sqlmock.ErrCancelled)
}

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

0 comments on commit d9b0c3a

Please sign in to comment.