From b8537ccea89998a47c8c494ea264ac386d5a5ab9 Mon Sep 17 00:00:00 2001 From: qw4990 Date: Mon, 17 Jun 2024 15:05:31 +0800 Subject: [PATCH] fixup --- pkg/bindinfo/session_handle_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/bindinfo/session_handle_test.go b/pkg/bindinfo/session_handle_test.go index 4ea95e6357f24..7be42b76e1107 100644 --- a/pkg/bindinfo/session_handle_test.go +++ b/pkg/bindinfo/session_handle_test.go @@ -16,6 +16,7 @@ package bindinfo_test import ( "context" + "fmt" "strconv" "testing" "time" @@ -390,8 +391,14 @@ func TestIssue53834(t *testing.T) { for i := 0; i < 12; i++ { tk.MustExec(`insert into t select * from t`) } + oomAction := tk.MustQuery(`select @@tidb_mem_oom_action`).Rows()[0][0].(string) + defer func() { + tk.MustExec(fmt.Sprintf(`set global tidb_mem_oom_action='%v'`, oomAction)) + }() + tk.MustExec(`set global tidb_mem_oom_action='cancel'`) tk.MustExec(`create binding using replace /*+ memory_quota(1 mb) */ into t select * from t`) - tk.MustExec(`replace into t select * from t`) + err := tk.ExecToErr(`replace into t select * from t`) + require.ErrorContains(t, err, "cancelled due to exceeding the allowed memory limit") } func TestPreparedStmt(t *testing.T) {