Skip to content

Commit

Permalink
testkit: fix a previous mistake that causes infoschema v2 not run (#5…
Browse files Browse the repository at this point in the history
  • Loading branch information
tiancaiamao authored Apr 25, 2024
1 parent e8c397f commit 6ed307e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion pkg/infoschema/test/infoschemav2test/v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ func TestSpecialSchemas(t *testing.T) {
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
tk.MustExec("use test")

tk.MustQuery("select @@global.tidb_schema_cache_size;").Check(testkit.Rows("0"))
tk.MustExec("set @@global.tidb_schema_cache_size = 1024;")
tk.MustQuery("select @@global.tidb_schema_cache_size;").Check(testkit.Rows("1024"))
tk.MustExec("create table t (id int);")
Expand Down
4 changes: 2 additions & 2 deletions pkg/testkit/testkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ func (tk *TestKit) RefreshSession() {
eb, ok := tk.store.(kv.EtcdBackend)
if ok { // Only for unit test now
addrs, err := eb.EtcdAddrs()
if err == nil && len(addrs) > 0 {
if rand.Intn(10) > 3 { // 70% chance to run infoschema v2
if err == nil && len(addrs) == 0 {
if rand.Intn(10) >= 3 { // 70% chance to run infoschema v2
tk.MustExec("set @@global.tidb_schema_cache_size = 1024")
}
}
Expand Down

0 comments on commit 6ed307e

Please sign in to comment.