test: fix flaky TestAlterAddConstraintStateChange3 (#48131)

close pingcap/tidb#48123
This commit is contained in:
jiyfhust
2023-10-31 16:51:38 +08:00
committed by GitHub
parent 3894bc5232
commit de6ebc057f

View File

@ -17,6 +17,7 @@ package ddl_test
import (
"fmt"
"testing"
"time"
"github.com/pingcap/failpoint"
"github.com/pingcap/tidb/pkg/ddl/util/callback"
@ -243,6 +244,8 @@ func TestAlterAddConstraintStateChange3(t *testing.T) {
callback.OnJobUpdatedExported.Store(&onJobUpdatedExportedFunc3)
d.SetHook(callback)
tk.MustExec("alter table t add constraint c3 check ( a > 10)")
// Issue TiDB#48123.
time.Sleep(50 * time.Millisecond)
tk.MustQuery("select * from t").Check(testkit.Rows("12"))
tk.MustQuery("show create table t").Check(testkit.Rows("t CREATE TABLE `t` (\n `a` int(11) DEFAULT NULL,\nCONSTRAINT `c3` CHECK ((`a` > 10))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin"))
}