Skip to content

Commit

Permalink
executor: fix unstable TestMaxPreparedStmtCount (#40024)
Browse files Browse the repository at this point in the history
ref #39735
  • Loading branch information
xuyifangreeneyes authored Dec 19, 2022
1 parent 08f6ea4 commit 3edde02
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions executor/prepared_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"fmt"
"strconv"
"strings"
"sync/atomic"
"testing"

"github.com/pingcap/tidb/parser/auth"
Expand Down Expand Up @@ -1258,6 +1259,11 @@ func TestIssue31141(t *testing.T) {
}

func TestMaxPreparedStmtCount(t *testing.T) {
oldVal := atomic.LoadInt64(&variable.PreparedStmtCount)
atomic.StoreInt64(&variable.PreparedStmtCount, 0)
defer func() {
atomic.StoreInt64(&variable.PreparedStmtCount, oldVal)
}()
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec("set @@global.max_prepared_stmt_count = 2")
Expand Down

0 comments on commit 3edde02

Please sign in to comment.