From 40a8ae771130e0e4c56f2c580b3d21d01e989a18 Mon Sep 17 00:00:00 2001 From: Lynn Date: Thu, 20 May 2021 20:42:17 +0800 Subject: [PATCH] ddl: make `TestDropLastVisibleColumns` stable (#24790) * ddl: make `TestDropLastVisibleColumns` stable --- ddl/db_integration_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ddl/db_integration_test.go b/ddl/db_integration_test.go index 8a49182e92f08..a39322c2f5b9c 100644 --- a/ddl/db_integration_test.go +++ b/ddl/db_integration_test.go @@ -2614,24 +2614,24 @@ func (s *testIntegrationSuite5) TestDropColumnsWithMultiIndex(c *C) { tk.MustQuery(query).Check(testkit.Rows()) } -func (s *testIntegrationSuite5) TestDropLastVisibleColumn(c *C) { +func (s *testSerialDBSuite) TestDropLastVisibleColumnOrColumns(c *C) { + defer config.RestoreFunc() + config.UpdateGlobal(func(conf *config.Config) { + conf.Experimental.AllowsExpressionIndex = true + }) tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test_db") tk.MustExec("create table t_drop_last_column(x int, key((1+1)))") - defer tk.MustExec("drop table if exists t_drop_last_column") _, err := tk.Exec("alter table t_drop_last_column drop column x") c.Assert(err, NotNil) c.Assert(err.Error(), Equals, "[ddl:1113]A table must have at least 1 column") -} - -func (s *testIntegrationSuite5) TestDropLastVisibleColumns(c *C) { - tk := testkit.NewTestKit(c, s.store) - tk.MustExec("use test_db") + // for visible columns tk.MustExec("create table t_drop_last_columns(x int, y int, key((1+1)))") - defer tk.MustExec("drop table if exists t_drop_last_columns") - _, err := tk.Exec("alter table t_drop_last_columns drop column x, drop column y") + _, err = tk.Exec("alter table t_drop_last_columns drop column x, drop column y") c.Assert(err, NotNil) c.Assert(err.Error(), Equals, "[ddl:1113]A table must have at least 1 column") + + tk.MustExec("drop table if exists t_drop_last_column, t_drop_last_columns") } func (s *testIntegrationSuite7) TestAutoIncrementTableOption(c *C) {