RefreshSession set a new session for the testkit
()
| 122 | |
| 123 | // RefreshSession set a new session for the testkit |
| 124 | func (tk *TestKit) RefreshSession() { |
| 125 | tk.session = NewSession(tk.t, tk.store) |
| 126 | if intest.InTest { |
| 127 | seed := uint64(time.Now().UnixNano()) |
| 128 | tk.t.Logf("RefreshSession rand seed: %d", seed) |
| 129 | rng := rand.New(rand.NewSource(int64(seed))) |
| 130 | if rng.Intn(10) < 3 { // 70% chance to run infoschema v2 |
| 131 | tk.MustExec("set @@global.tidb_schema_cache_size = 0") |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | // enforce sysvar cache loading, ref loadCommonGlobalVariableIfNeeded |
| 136 | tk.MustExec("select 3") |
| 137 | } |
| 138 | |
| 139 | // SetSession set the session of testkit |
| 140 | func (tk *TestKit) SetSession(session sessiontypes.Session) { |