Skip to content

Commit

Permalink
test: fix not-stable test about ExchangePartition when wait for ddl e…
Browse files Browse the repository at this point in the history
…nter next state (#49879)

close #49777
  • Loading branch information
jiyfhust authored Dec 29, 2023
1 parent c766530 commit c575685
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions pkg/table/tables/test/partition/partition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,11 @@ func TestExchangePartitionStates(t *testing.T) {
logutil.BgLogger().Info("Got state", zap.String("State", s))
break
}
gotime.Sleep(50 * gotime.Millisecond)
gotime.Sleep(10 * gotime.Millisecond)
}
// Sleep 50ms to wait load InforSchema finish, issue #46815.
gotime.Sleep(50 * gotime.Millisecond)
dom := domain.GetDomain(tk.Session())
// Make sure the table schema is the new schema.
require.NoError(t, dom.Reload())
}
waitFor("t", "write only", 4)
tk3.MustExec(`BEGIN`)
Expand Down Expand Up @@ -519,10 +520,11 @@ func TestExchangePartitionCheckConstraintStates(t *testing.T) {
logutil.BgLogger().Info("Got state", zap.String("State", s))
break
}
gotime.Sleep(50 * gotime.Millisecond)
gotime.Sleep(10 * gotime.Millisecond)
}
// Sleep 50ms to wait load InforSchema finish.
gotime.Sleep(50 * gotime.Millisecond)
dom := domain.GetDomain(tk.Session())
// Make sure the table schema is the new schema.
require.NoError(t, dom.Reload())
}
waitFor("nt", "write only", 4)

Expand Down Expand Up @@ -630,10 +632,11 @@ func TestExchangePartitionCheckConstraintStatesTwo(t *testing.T) {
logutil.BgLogger().Info("Got state", zap.String("State", s))
break
}
gotime.Sleep(50 * gotime.Millisecond)
gotime.Sleep(10 * gotime.Millisecond)
}
// Sleep 50ms to wait load InforSchema finish.
gotime.Sleep(50 * gotime.Millisecond)
dom := domain.GetDomain(tk.Session())
// Make sure the table schema is the new schema.
require.NoError(t, dom.Reload())
}
waitFor("nt", "write only", 4)

Expand Down Expand Up @@ -691,8 +694,9 @@ func TestAddKeyPartitionStates(t *testing.T) {
}
gotime.Sleep(10 * gotime.Millisecond)
}
// Sleep 50ms to wait load InforSchema finish.
gotime.Sleep(50 * gotime.Millisecond)
dom := domain.GetDomain(tk.Session())
// Make sure the table schema is the new schema.
require.NoError(t, dom.Reload())
}
waitFor(4, "delete only")
tk3.MustExec(`BEGIN`)
Expand Down

0 comments on commit c575685

Please sign in to comment.