executor: split ddl test into new package (#45834)

close pingcap/tidb#44940
This commit is contained in:
Weizhen Wang
2023-08-05 22:53:40 +08:00
committed by GitHub
parent 92b769c498
commit e3b95fbc76
4 changed files with 89 additions and 7 deletions

View File

@ -297,7 +297,6 @@ go_test(
"concurrent_map_test.go",
"copr_cache_test.go",
"cte_test.go",
"ddl_test.go",
"delete_test.go",
"distsql_test.go",
"executor_failpoint_test.go",
@ -372,8 +371,6 @@ go_test(
"//config",
"//ddl",
"//ddl/placement",
"//ddl/schematracker",
"//ddl/testutil",
"//ddl/util",
"//distsql",
"//domain",
@ -387,7 +384,6 @@ go_test(
"//expression/aggregation",
"//infoschema",
"//kv",
"//meta",
"//meta/autoid",
"//metrics",
"//parser",
@ -406,7 +402,6 @@ go_test(
"//sessionctx/binloginfo",
"//sessionctx/stmtctx",
"//sessionctx/variable",
"//sessionctx/variable/featuretag/disttask",
"//sessiontxn",
"//sessiontxn/staleread",
"//statistics",
@ -424,7 +419,6 @@ go_test(
"//testkit/testdata",
"//testkit/testmain",
"//testkit/testsetup",
"//testkit/testutil",
"//types",
"//util",
"//util/benchdaily",

View File

@ -0,0 +1,44 @@
load("@io_bazel_rules_go//go:def.bzl", "go_test")
go_test(
name = "ddl_test",
timeout = "short",
srcs = [
"ddl_test.go",
"main_test.go",
],
flaky = True,
shard_count = 42,
deps = [
"//config",
"//ddl/schematracker",
"//ddl/testutil",
"//ddl/util",
"//domain",
"//errno",
"//infoschema",
"//kv",
"//meta",
"//meta/autoid",
"//parser/model",
"//parser/mysql",
"//parser/terror",
"//planner/core",
"//sessionctx/variable",
"//sessionctx/variable/featuretag/disttask",
"//sessiontxn",
"//store/mockstore",
"//table",
"//table/tables",
"//testkit",
"//testkit/testutil",
"//types",
"//util/chunk",
"//util/dbterror",
"//util/dbterror/exeerrors",
"@com_github_pingcap_failpoint//:failpoint",
"@com_github_stretchr_testify//require",
"@com_github_tikv_client_go_v2//tikv",
"@org_uber_go_goleak//:goleak",
],
)

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package executor_test
package ddl
import (
"context"

View File

@ -0,0 +1,44 @@
// Copyright 2023 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ddl
import (
"testing"
"github.com/pingcap/tidb/config"
"github.com/pingcap/tidb/meta/autoid"
"github.com/tikv/client-go/v2/tikv"
"go.uber.org/goleak"
)
func TestMain(m *testing.M) {
autoid.SetStep(5000)
config.UpdateGlobal(func(conf *config.Config) {
conf.Log.SlowThreshold = 30000 // 30s
conf.TiKVClient.AsyncCommit.SafeWindow = 0
conf.TiKVClient.AsyncCommit.AllowedClockDrift = 0
conf.Experimental.AllowsExpressionIndex = true
})
tikv.EnableFailpoints()
opts := []goleak.Option{
goleak.IgnoreTopFunction("github.com/golang/glog.(*fileSink).flushDaemon"),
goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"),
goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"),
goleak.IgnoreTopFunction("gopkg.in/natefinch/lumberjack%2ev2.(*Logger).millRun"),
goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/txnkv/transaction.keepAlive"),
}
goleak.VerifyTestMain(m, opts...)
}