diff --git a/Makefile b/Makefile index 4bcd553735886..84c60380f0376 100644 --- a/Makefile +++ b/Makefile @@ -568,6 +568,30 @@ bazel_addindextest: failpoint-enable bazel_ci_simple_prepare -- //tests/realtikvtest/addindextest/... ./build/jenkins_collect_coverage.sh +bazel_addindextest1: failpoint-enable bazel_ci_simple_prepare + bazel $(BAZEL_GLOBAL_CONFIG) coverage $(BAZEL_CMD_CONFIG) --test_arg=-with-real-tikv --define gotags=deadlock,intest \ + --@io_bazel_rules_go//go/config:cover_format=go_cover \ + -- //tests/realtikvtest/addindextest1/... + ./build/jenkins_collect_coverage.sh + +bazel_addindextest2: failpoint-enable bazel_ci_simple_prepare + bazel $(BAZEL_GLOBAL_CONFIG) coverage $(BAZEL_CMD_CONFIG) --test_arg=-with-real-tikv --define gotags=deadlock,intest \ + --@io_bazel_rules_go//go/config:cover_format=go_cover \ + -- //tests/realtikvtest/addindextest2/... + ./build/jenkins_collect_coverage.sh + +bazel_addindextest3: failpoint-enable bazel_ci_simple_prepare + bazel $(BAZEL_GLOBAL_CONFIG) coverage $(BAZEL_CMD_CONFIG) --test_arg=-with-real-tikv --define gotags=deadlock,intest \ + --@io_bazel_rules_go//go/config:cover_format=go_cover \ + -- //tests/realtikvtest/addindextest3/... + ./build/jenkins_collect_coverage.sh + +bazel_addindextest4: failpoint-enable bazel_ci_simple_prepare + bazel $(BAZEL_GLOBAL_CONFIG) coverage $(BAZEL_CMD_CONFIG) --test_arg=-with-real-tikv --define gotags=deadlock,intest \ + --@io_bazel_rules_go//go/config:cover_format=go_cover \ + -- //tests/realtikvtest/addindextest4/... + ./build/jenkins_collect_coverage.sh + # on timeout, bazel won't print log sometimes, so we use --test_output=all to print log always bazel_importintotest: failpoint-enable bazel_ci_simple_prepare bazel $(BAZEL_GLOBAL_CONFIG) coverage $(BAZEL_CMD_CONFIG) --test_output=all --test_arg=-with-real-tikv --define gotags=deadlock,intest \ diff --git a/tests/realtikvtest/addindextest1/BUILD.bazel b/tests/realtikvtest/addindextest1/BUILD.bazel new file mode 100644 index 0000000000000..43ed92ac76991 --- /dev/null +++ b/tests/realtikvtest/addindextest1/BUILD.bazel @@ -0,0 +1,16 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_test") + +go_test( + name = "addindextest1_test", + timeout = "short", + srcs = [ + "dummy_test.go", + "main_test.go", + ], + flaky = True, + deps = [ + "//pkg/config", + "//tests/realtikvtest", + "@com_github_stretchr_testify//require", + ], +) diff --git a/tests/realtikvtest/addindextest1/dummy_test.go b/tests/realtikvtest/addindextest1/dummy_test.go new file mode 100644 index 0000000000000..38b93a4517380 --- /dev/null +++ b/tests/realtikvtest/addindextest1/dummy_test.go @@ -0,0 +1,25 @@ +// 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 addindextest + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestDummy(t *testing.T) { + require.NoError(t, nil) +} diff --git a/tests/realtikvtest/addindextest1/main_test.go b/tests/realtikvtest/addindextest1/main_test.go new file mode 100644 index 0000000000000..30ba7d0424a87 --- /dev/null +++ b/tests/realtikvtest/addindextest1/main_test.go @@ -0,0 +1,34 @@ +// 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 addindextest + +import ( + "flag" + "testing" + + "github.com/pingcap/tidb/pkg/config" + "github.com/pingcap/tidb/tests/realtikvtest" +) + +// FullMode is a flag identify it should be run in full mode. +// In full mode, the test will run all the cases. +var FullMode = flag.Bool("full-mode", false, "whether tests run in full mode") + +func TestMain(m *testing.M) { + config.UpdateGlobal(func(conf *config.Config) { + conf.Store = "tikv" + }) + realtikvtest.RunTestMain(m) +} diff --git a/tests/realtikvtest/addindextest2/BUILD.bazel b/tests/realtikvtest/addindextest2/BUILD.bazel new file mode 100644 index 0000000000000..da2e42c9e6827 --- /dev/null +++ b/tests/realtikvtest/addindextest2/BUILD.bazel @@ -0,0 +1,16 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_test") + +go_test( + name = "addindextest2_test", + timeout = "short", + srcs = [ + "dummy_test.go", + "main_test.go", + ], + flaky = True, + deps = [ + "//pkg/config", + "//tests/realtikvtest", + "@com_github_stretchr_testify//require", + ], +) diff --git a/tests/realtikvtest/addindextest2/dummy_test.go b/tests/realtikvtest/addindextest2/dummy_test.go new file mode 100644 index 0000000000000..38b93a4517380 --- /dev/null +++ b/tests/realtikvtest/addindextest2/dummy_test.go @@ -0,0 +1,25 @@ +// 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 addindextest + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestDummy(t *testing.T) { + require.NoError(t, nil) +} diff --git a/tests/realtikvtest/addindextest2/main_test.go b/tests/realtikvtest/addindextest2/main_test.go new file mode 100644 index 0000000000000..30ba7d0424a87 --- /dev/null +++ b/tests/realtikvtest/addindextest2/main_test.go @@ -0,0 +1,34 @@ +// 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 addindextest + +import ( + "flag" + "testing" + + "github.com/pingcap/tidb/pkg/config" + "github.com/pingcap/tidb/tests/realtikvtest" +) + +// FullMode is a flag identify it should be run in full mode. +// In full mode, the test will run all the cases. +var FullMode = flag.Bool("full-mode", false, "whether tests run in full mode") + +func TestMain(m *testing.M) { + config.UpdateGlobal(func(conf *config.Config) { + conf.Store = "tikv" + }) + realtikvtest.RunTestMain(m) +} diff --git a/tests/realtikvtest/addindextest3/BUILD.bazel b/tests/realtikvtest/addindextest3/BUILD.bazel new file mode 100644 index 0000000000000..73ddcbfe00b09 --- /dev/null +++ b/tests/realtikvtest/addindextest3/BUILD.bazel @@ -0,0 +1,16 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_test") + +go_test( + name = "addindextest3_test", + timeout = "short", + srcs = [ + "dummy_test.go", + "main_test.go", + ], + flaky = True, + deps = [ + "//pkg/config", + "//tests/realtikvtest", + "@com_github_stretchr_testify//require", + ], +) diff --git a/tests/realtikvtest/addindextest3/dummy_test.go b/tests/realtikvtest/addindextest3/dummy_test.go new file mode 100644 index 0000000000000..38b93a4517380 --- /dev/null +++ b/tests/realtikvtest/addindextest3/dummy_test.go @@ -0,0 +1,25 @@ +// 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 addindextest + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestDummy(t *testing.T) { + require.NoError(t, nil) +} diff --git a/tests/realtikvtest/addindextest3/main_test.go b/tests/realtikvtest/addindextest3/main_test.go new file mode 100644 index 0000000000000..30ba7d0424a87 --- /dev/null +++ b/tests/realtikvtest/addindextest3/main_test.go @@ -0,0 +1,34 @@ +// 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 addindextest + +import ( + "flag" + "testing" + + "github.com/pingcap/tidb/pkg/config" + "github.com/pingcap/tidb/tests/realtikvtest" +) + +// FullMode is a flag identify it should be run in full mode. +// In full mode, the test will run all the cases. +var FullMode = flag.Bool("full-mode", false, "whether tests run in full mode") + +func TestMain(m *testing.M) { + config.UpdateGlobal(func(conf *config.Config) { + conf.Store = "tikv" + }) + realtikvtest.RunTestMain(m) +} diff --git a/tests/realtikvtest/addindextest4/BUILD.bazel b/tests/realtikvtest/addindextest4/BUILD.bazel new file mode 100644 index 0000000000000..a2309052c43e0 --- /dev/null +++ b/tests/realtikvtest/addindextest4/BUILD.bazel @@ -0,0 +1,16 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_test") + +go_test( + name = "addindextest4_test", + timeout = "short", + srcs = [ + "dummy_test.go", + "main_test.go", + ], + flaky = True, + deps = [ + "//pkg/config", + "//tests/realtikvtest", + "@com_github_stretchr_testify//require", + ], +) diff --git a/tests/realtikvtest/addindextest4/dummy_test.go b/tests/realtikvtest/addindextest4/dummy_test.go new file mode 100644 index 0000000000000..38b93a4517380 --- /dev/null +++ b/tests/realtikvtest/addindextest4/dummy_test.go @@ -0,0 +1,25 @@ +// 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 addindextest + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestDummy(t *testing.T) { + require.NoError(t, nil) +} diff --git a/tests/realtikvtest/addindextest4/main_test.go b/tests/realtikvtest/addindextest4/main_test.go new file mode 100644 index 0000000000000..30ba7d0424a87 --- /dev/null +++ b/tests/realtikvtest/addindextest4/main_test.go @@ -0,0 +1,34 @@ +// 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 addindextest + +import ( + "flag" + "testing" + + "github.com/pingcap/tidb/pkg/config" + "github.com/pingcap/tidb/tests/realtikvtest" +) + +// FullMode is a flag identify it should be run in full mode. +// In full mode, the test will run all the cases. +var FullMode = flag.Bool("full-mode", false, "whether tests run in full mode") + +func TestMain(m *testing.M) { + config.UpdateGlobal(func(conf *config.Config) { + conf.Store = "tikv" + }) + realtikvtest.RunTestMain(m) +}