Skip to content

Commit

Permalink
planner: split index test (#46780)
Browse files Browse the repository at this point in the history
close #44940
  • Loading branch information
hawkingrei authored Sep 8, 2023
1 parent 968c712 commit a41f5ea
Show file tree
Hide file tree
Showing 13 changed files with 1,771 additions and 1,700 deletions.
4 changes: 2 additions & 2 deletions cmd/mirror/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func downloadZips(
cmd := exec.Command(gobin, downloadArgs...)
cmd.Dir = tmpdir
env := os.Environ()
env = append(env, fmt.Sprintf("GOPROXY=%s", "https://proxy.golang.org,direct"))
env = append(env, fmt.Sprintf("GOPROXY=%s", "https://mirrors.aliyun.com/goproxy/,https://proxy.golang.org,direct"))
env = append(env, fmt.Sprintf("GOSUMDB=%s", "sum.golang.org"))
cmd.Env = env
jsonBytes, err := cmd.Output()
Expand Down Expand Up @@ -228,7 +228,7 @@ func listAllModules(tmpdir string) (map[string]listedModule, error) {
cmd := exec.Command(gobin, "list", "-mod=readonly", "-m", "-json", "all")
cmd.Dir = tmpdir
env := os.Environ()
env = append(env, fmt.Sprintf("GOPROXY=%s", "https://proxy.golang.org,direct"))
env = append(env, fmt.Sprintf("GOPROXY=%s", "https://mirrors.aliyun.com/goproxy/,https://proxy.golang.org,direct"))
env = append(env, fmt.Sprintf("GOSUMDB=%s", "sum.golang.org"))
cmd.Env = env
jsonBytes, err := cmd.Output()
Expand Down
17 changes: 0 additions & 17 deletions executor/distsql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,23 +273,6 @@ func TestInconsistentIndex(t *testing.T) {
}
}

func TestPushLimitDownIndexLookUpReader(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)

tk.MustExec("use test")
tk.MustExec("drop table if exists tbl")
tk.MustExec("create table tbl(a int, b int, c int, key idx_b_c(b,c))")
tk.MustExec("insert into tbl values(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)")
tk.MustQuery("select * from tbl use index(idx_b_c) where b > 1 limit 2,1").Check(testkit.Rows("4 4 4"))
tk.MustQuery("select * from tbl use index(idx_b_c) where b > 4 limit 2,1").Check(testkit.Rows())
tk.MustQuery("select * from tbl use index(idx_b_c) where b > 3 limit 2,1").Check(testkit.Rows())
tk.MustQuery("select * from tbl use index(idx_b_c) where b > 2 limit 2,1").Check(testkit.Rows("5 5 5"))
tk.MustQuery("select * from tbl use index(idx_b_c) where b > 1 limit 1").Check(testkit.Rows("2 2 2"))
tk.MustQuery("select * from tbl use index(idx_b_c) where b > 1 order by b desc limit 2,1").Check(testkit.Rows("3 3 3"))
tk.MustQuery("select * from tbl use index(idx_b_c) where b > 1 and c > 1 limit 2,1").Check(testkit.Rows("4 4 4"))
}

func TestPartitionTableIndexLookUpReader(t *testing.T) {
failpoint.Enable("github.com/pingcap/tidb/planner/core/forceDynamicPrune", `return(true)`)
defer failpoint.Disable("github.com/pingcap/tidb/planner/core/forceDynamicPrune")
Expand Down
1 change: 0 additions & 1 deletion planner/core/casetest/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ go_test(
"//testkit/testdata",
"//testkit/testmain",
"//testkit/testsetup",
"//util",
"//util/hint",
"//util/plancodec",
"@com_github_pingcap_failpoint//:failpoint",
Expand Down
23 changes: 23 additions & 0 deletions planner/core/casetest/index/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
load("@io_bazel_rules_go//go:def.bzl", "go_test")

go_test(
name = "index_test",
timeout = "short",
srcs = [
"index_test.go",
"main_test.go",
],
data = glob(["testdata/**"]),
flaky = True,
shard_count = 12,
deps = [
"//sessionctx/variable",
"//testkit",
"//testkit/testdata",
"//testkit/testmain",
"//testkit/testsetup",
"//util",
"@com_github_stretchr_testify//require",
"@org_uber_go_goleak//:goleak",
],
)
Loading

0 comments on commit a41f5ea

Please sign in to comment.