From f0ac8f4aaf1cc28f3bef738d32af52005563925a Mon Sep 17 00:00:00 2001 From: tangenta Date: Fri, 13 Sep 2024 17:21:29 +0800 Subject: [PATCH] test: fix unstable TestAdminShowNextID (#56002) close pingcap/tidb#55828 --- pkg/executor/test/seqtest/seq_executor_test.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/executor/test/seqtest/seq_executor_test.go b/pkg/executor/test/seqtest/seq_executor_test.go index 14f68aaa0abd3..784bd8ad3c7c8 100644 --- a/pkg/executor/test/seqtest/seq_executor_test.go +++ b/pkg/executor/test/seqtest/seq_executor_test.go @@ -760,6 +760,8 @@ func checkGoroutineExists(keyword string) bool { } func TestAdminShowNextID(t *testing.T) { + step := int64(10) + autoid.SetStep(step) store := testkit.CreateMockStore(t) HelperTestAdminShowNextID(t, store, `admin show `) @@ -771,10 +773,6 @@ func HelperTestAdminShowNextID(t *testing.T, store kv.Storage, str string) { defer func() { require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/pkg/meta/autoid/mockAutoIDChange")) }() - step := int64(10) - autoIDStep := autoid.GetStep() - autoid.SetStep(step) - defer autoid.SetStep(autoIDStep) tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("drop table if exists t,tt") @@ -787,7 +785,7 @@ func HelperTestAdminShowNextID(t *testing.T, store kv.Storage, str string) { r = tk.MustQuery(str + " t next_row_id") r.Check(testkit.Rows("test t _tidb_rowid 11 _TIDB_ROWID")) // Row ID is original + step. - for i := 0; i < int(step); i++ { + for i := 0; i < int(10); i++ { tk.MustExec("insert into t values(10000, 1)") } r = tk.MustQuery(str + " t next_row_id")