pingcap / pingcap/tidb

Run categorized test cases for each component

Open
#64,317 0 comments 3 reactions 0 assignees View on GitHub
type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement

This repository now contains approximately **1.3 million lines of Go code**, representing a large, mature, and complex project. It includes an extensive set of test cases written in Go, Bash, and SQL, distributed across various packages.

Although contributors are encouraged to execute sufficient tests *before* pushing commits or submitting pull requests, running the entire test suite (via the `make ut` command) is both time-consuming and resource-intensive. Furthermore, the presence of flaky tests can make it challenging to achieve fully consistent results in local environments.

To improve efficiency and focus, we utilize **components** and **SIGs (Special Interest Groups)** to categorize issues and pull requests. Engineers typically concentrate on items tagged with their corresponding components or SIGs.

We propose establishing a **mapping between test cases and component tags**, enabling contributors to run only the tests relevant to the components they are working on. This approach ensures that pull requests related to specific components are validated by the appropriate tests, without requiring a complete test suite run.

For example, we can maintain a mapping like the following:

```
planner:
pkg/planner
pkg/statistics
pkg/bindinfo
tests/integrationtest/t/planner
...

ddl:
pkg/ddl
tests/integrationtest/t/ddl
...
```
With this mapping in place, we can extend the `make` command to support component-based test execution:

```
make ut planner
make ut ddl
```
This enhancement will streamline the development workflow, reduce redundant test runs, and help contributors focus on the correctness of their changes within relevant areas of the codebase.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.