Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

planner/core: migrate test-infra to testify for integration_test.go #32560

Merged
merged 3 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,208 changes: 1,293 additions & 915 deletions planner/core/integration_test.go

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions planner/core/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func TestMain(m *testing.M) {
testDataMap.LoadTestSuiteData("testdata", "expression_rewriter_suite")
testDataMap.LoadTestSuiteData("testdata", "partition_pruner")
testDataMap.LoadTestSuiteData("testdata", "plan_suite")
testDataMap.LoadTestSuiteData("testdata", "integration_suite")

indexMergeSuiteData = testDataMap["index_merge_suite"]

Expand Down Expand Up @@ -93,3 +94,7 @@ func GetPartitionPrunerData() testdata.TestData {
func GetPlanSuiteData() testdata.TestData {
return testDataMap["plan_suite"]
}

func GetIntegrationSuiteData() testdata.TestData {
return testDataMap["integration_suite"]
}
2 changes: 1 addition & 1 deletion planner/core/prepare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1747,7 +1747,7 @@ func TestPrepareForGroupByMultiItems(t *testing.T) {
tk.MustQuery(`execute stmt2 using @v1, @v2`).Check(testkit.Rows("10"))
}

func TestInvisibleIndex(t *testing.T) {
func TestInvisibleIndexPrepare(t *testing.T) {
store, clean := testkit.CreateMockStore(t)
defer clean()
tk := testkit.NewTestKit(t, store)
Expand Down
442 changes: 0 additions & 442 deletions planner/core/testdata/integration_serial_suite_in.json

This file was deleted.

4,275 changes: 0 additions & 4,275 deletions planner/core/testdata/integration_serial_suite_out.json

This file was deleted.

440 changes: 440 additions & 0 deletions planner/core/testdata/integration_suite_in.json

Large diffs are not rendered by default.

4,273 changes: 4,273 additions & 0 deletions planner/core/testdata/integration_suite_out.json

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions testkit/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,22 @@ func (res *Result) Rows() [][]interface{} {
}
return ifacesSlice
}

// CheckAt asserts the result of selected columns equals the expected results.
func (res *Result) CheckAt(cols []int, expected [][]interface{}) {
for _, e := range expected {
res.require.Equal(len(e), len(cols))
}

rows := make([][]string, 0, len(expected))
for i := range res.rows {
row := make([]string, 0, len(cols))
for _, r := range cols {
row = append(row, res.rows[i][r])
}
rows = append(rows, row)
}
got := fmt.Sprintf("%s", rows)
need := fmt.Sprintf("%s", expected)
res.require.Equal(need, got, res.comment)
}