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

Split integration tests(IT) and unit tests(UT) in TiDB repo #45961

Closed
45 of 48 tasks
Defined2014 opened this issue Aug 10, 2023 · 1 comment · Fixed by #48956
Closed
45 of 48 tasks

Split integration tests(IT) and unit tests(UT) in TiDB repo #45961

Defined2014 opened this issue Aug 10, 2023 · 1 comment · Fixed by #48956
Assignees
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@Defined2014
Copy link
Contributor

Defined2014 commented Aug 10, 2023

Goals:

Current Status of cmd/explaintest:

  • check_dev: Runs tidb + unistore (use 34s, 08/23)
  • check_dev2: Runs tidb + tikv (use 39s, 08/23)

Optional:

  • Migrate tests to planner/core/casetest directory
    • Pros
      • Inherent support for concurrency and Bazel cache
    • Cons
      • Currently doesn't support running with tikv
      • Coverage statistics would include in UT (Unit Tests), making later analysis less convenient

Sub Tasks

@Defined2014
Copy link
Contributor Author

Defined2014 commented Aug 29, 2023

Use a shell script to get all *_test.go files in TiDB repo

should_exclude_dir() {
    local dir="$1"

    if [[ "$dir" == "bazel"* ]]; then
        return 0 
    fi

    return 1
}

count_files() {
    local dir="$1"
    local count=0

    while IFS= read -r file; do
        if [ -f "$file" ]; then
            if [[ "$file" == *"/main_test.go" ]]; then
                continue
            fi
            if [[ $count == 0 ]]; then
                echo "Dir:$dir"
            fi
            count=$((count + 1))
            echo "File:$file"
        fi
    done < <(find "$dir" -type f -name "*_test.go")

    if [[ $count -eq 0 ]]; then
        return 1
    fi

    echo "count:$count"
    echo ""
}

for dir in */; do
    if should_exclude_dir "$dir"; then
        continue
    fi

    if ! count_files "$dir"; then
        continue
    fi
done

ti-chi-bot bot pushed a commit that referenced this issue Sep 4, 2023
ti-chi-bot bot pushed a commit that referenced this issue Nov 23, 2023
@Defined2014 Defined2014 reopened this Nov 28, 2023
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this issue Dec 5, 2023
ti-chi-bot bot pushed a commit that referenced this issue Dec 5, 2023
wuhuizuo pushed a commit to wuhuizuo/tidb that referenced this issue Apr 2, 2024
terry1purcell pushed a commit to terry1purcell/tidb that referenced this issue May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant