From b1b432e720e73c4a008e3c2e5803cb7668931059 Mon Sep 17 00:00:00 2001 From: yisaer Date: Fri, 13 May 2022 16:25:59 +0800 Subject: [PATCH] add test Signed-off-by: yisaer --- executor/set_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/executor/set_test.go b/executor/set_test.go index 185805143e49b..cdacc31b905a7 100644 --- a/executor/set_test.go +++ b/executor/set_test.go @@ -627,6 +627,12 @@ func TestSetVar(t *testing.T) { tk.MustQuery("select @@global.tidb_stats_cache_mem_quota").Check(testkit.Rows("0")) tk.MustExec("set global tidb_stats_cache_mem_quota = 200") tk.MustQuery("select @@global.tidb_stats_cache_mem_quota").Check(testkit.Rows("200")) + // assert quota must larger than -1 + tk.MustExec("set global tidb_stats_cache_mem_quota = -1") + tk.MustQuery("select @@global.tidb_stats_cache_mem_quota").Check(testkit.Rows("0")) + // assert quota muster smaller than 1TB + tk.MustExec("set global tidb_stats_cache_mem_quota = 1099511627777") + tk.MustQuery("select @@global.tidb_stats_cache_mem_quota").Check(testkit.Rows("1099511627776")) // for read-only instance scoped system variables. tk.MustGetErrCode("set @@global.plugin_load = ''", errno.ErrIncorrectGlobalLocalVar) tk.MustGetErrCode("set @@global.plugin_dir = ''", errno.ErrIncorrectGlobalLocalVar)