Skip to content

Commit

Permalink
test: stabilize TestTruncateTableAndSchemaDependence (pingcap#53245)
Browse files Browse the repository at this point in the history
  • Loading branch information
tangenta authored and RidRisR committed May 23, 2024
1 parent 390125a commit 589d2b0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/ddl/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1076,18 +1076,17 @@ func TestTruncateTableAndSchemaDependence(t *testing.T) {
tk.MustExec("create table t(a int);")

var wg sync.WaitGroup

hook := &callback.TestDDLCallback{Do: dom}
wg.Add(2)

var timetk2 time.Time
var timetk3 time.Time

one := false
first := false
f := func(job *model.Job) {
if one {
if first || job.Type != model.ActionTruncateTable {
return
}
one = true
first = true
go func() {
tk3.MustExec("drop database test")
timetk3 = time.Now()
Expand All @@ -1096,6 +1095,7 @@ func TestTruncateTableAndSchemaDependence(t *testing.T) {
time.Sleep(3 * time.Second)
}

hook := &callback.TestDDLCallback{Do: dom}
hook.OnJobUpdatedExported.Store(&f)
dom.DDL().SetHook(hook)

Expand Down

0 comments on commit 589d2b0

Please sign in to comment.