From 3ea4f28f1929961fe111ffbb8513b21ec4ffdd9b Mon Sep 17 00:00:00 2001 From: lance6716 Date: Thu, 8 Aug 2024 14:31:51 +0800 Subject: [PATCH] test: port unit test from #55286 to master Signed-off-by: lance6716 --- pkg/session/bootstraptest/BUILD.bazel | 3 ++- .../bootstraptest/bootstrap_upgrade_test.go | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/pkg/session/bootstraptest/BUILD.bazel b/pkg/session/bootstraptest/BUILD.bazel index 67477675738cf..f63cc64645392 100644 --- a/pkg/session/bootstraptest/BUILD.bazel +++ b/pkg/session/bootstraptest/BUILD.bazel @@ -8,7 +8,7 @@ go_test( "main_test.go", ], flaky = True, - shard_count = 11, + shard_count = 12, deps = [ "//pkg/config", "//pkg/ddl", @@ -17,6 +17,7 @@ go_test( "//pkg/meta", "//pkg/parser/model", "//pkg/parser/terror", + "//pkg/planner/core", "//pkg/server/handler", "//pkg/session", #keep "//pkg/sessionctx", diff --git a/pkg/session/bootstraptest/bootstrap_upgrade_test.go b/pkg/session/bootstraptest/bootstrap_upgrade_test.go index da38f275afe76..31832bcae9f09 100644 --- a/pkg/session/bootstraptest/bootstrap_upgrade_test.go +++ b/pkg/session/bootstraptest/bootstrap_upgrade_test.go @@ -31,6 +31,7 @@ import ( "github.com/pingcap/tidb/pkg/meta" "github.com/pingcap/tidb/pkg/parser/model" "github.com/pingcap/tidb/pkg/parser/terror" + plannercore "github.com/pingcap/tidb/pkg/planner/core" "github.com/pingcap/tidb/pkg/server/handler" "github.com/pingcap/tidb/pkg/session" "github.com/pingcap/tidb/pkg/sessionctx" @@ -848,3 +849,19 @@ func TestUpgradeWithPauseDDL(t *testing.T) { " PARTITION `p3` VALUES LESS THAN (4096),\n" + " PARTITION `p4` VALUES LESS THAN (7096))")) } + +func TestUpgradeWithCrossJoinDisabled(t *testing.T) { + session.SupportUpgradeHTTPOpVer-- + ddl.SetWaitTimeWhenErrorOccurred(1 * time.Microsecond) + backup := plannercore.AllowCartesianProduct.Load() + t.Cleanup(func() { + plannercore.AllowCartesianProduct.Store(backup) + }) + plannercore.AllowCartesianProduct.Store(false) + + store, dom := session.CreateStoreAndBootstrap(t) + defer func() { + dom.Close() + require.NoError(t, store.Close()) + }() +}