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

Make Unit Test Great! #7969

Closed
HuSharp opened this issue Mar 22, 2024 · 0 comments
Closed

Make Unit Test Great! #7969

HuSharp opened this issue Mar 22, 2024 · 0 comments
Labels
type/development The issue belongs to a development tasks

Comments

@HuSharp
Copy link
Member

HuSharp commented Mar 22, 2024

Development Task

  • The unstable CI has been a hinder to our daily development. Sometimes we have to run it again and again, and again ... to merge a PR.
  • When run make basic-test in local machine, there will be a lot of strange problems, as well as running extremely slow :(

Need 5:44.15 total for Intel(R) Xeon(R) Gold 6240 CPU @ 2.60GH, 144 core 72 CPU
but local mac(m1pro 16G) needs > 15min

We use a wrong way to parallel. Some test cases are not side effect free, for example:

  • the enable and disable of the failpoint
  • modification of the configuration
  • change of the global variable in a single process.
    etc...

What's the solution?

Add back parallel by run a single test case in a isolated OS process #7952

If the test cases with side effect run parallelly with others, it could cause some test fail unexpectedly.
When they're in a single OS process, make them parallel is not a big deal.

print function time

when using ./pd-ut run --junitfile xxx, can get junitfile as XML file to get every function cost time.

Furthermore

Related

Result Show

Local Test

Since we run parallel now, the CI runs faster than before, on my server computer (Intel(R) Xeon(R) Gold 6240 CPU @ 2.60GH, 144 core 72 CPU):
reduce from 6min -> 1min

for make ut:

time make ut
building task finish, parallelism=144, count=641, takes=10.154869881s
run all tasks takes 50.559951196s
> make ut  327.15s user 48.61s system 615% cpu 1:01.03 total

for make basic-test

time make basic-test
CGO_ENABLED=1 go test -tags tso_function_test,deadlock -timeout 20m -race
> make basic-test 1176.46s user 169.41s system 473% cpu 5:44.15 total

CI Result

Before After
@HuSharp HuSharp added the type/development The issue belongs to a development tasks label Mar 22, 2024
ti-chi-bot bot pushed a commit that referenced this issue Apr 9, 2024
ti-chi-bot bot added a commit that referenced this issue Apr 10, 2024
ref #7969

Signed-off-by: husharp <[email protected]>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
ti-chi-bot bot pushed a commit that referenced this issue Apr 11, 2024
ti-chi-bot bot added a commit that referenced this issue Apr 15, 2024
ref #7969

Signed-off-by: husharp <[email protected]>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
ti-chi-bot bot added a commit that referenced this issue Apr 16, 2024
ref #7969

Signed-off-by: husharp <[email protected]>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
ti-chi-bot bot pushed a commit that referenced this issue Apr 19, 2024
nolouch pushed a commit to nolouch/pd that referenced this issue Apr 29, 2024
ti-chi-bot bot pushed a commit that referenced this issue May 13, 2024
ti-chi-bot bot added a commit that referenced this issue May 13, 2024
ref #7969

Signed-off-by: husharp <[email protected]>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
ti-chi-bot bot pushed a commit that referenced this issue May 14, 2024
ti-chi-bot bot added a commit that referenced this issue May 15, 2024
ref #7969

Signed-off-by: husharp <[email protected]>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
ti-chi-bot bot pushed a commit that referenced this issue May 17, 2024
ti-chi-bot bot pushed a commit that referenced this issue May 20, 2024
ti-chi-bot bot pushed a commit that referenced this issue May 21, 2024
ti-chi-bot bot added a commit that referenced this issue May 22, 2024
ref #7969

Signed-off-by: husharp <[email protected]>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
ti-chi-bot bot pushed a commit that referenced this issue May 23, 2024
ref #7969

add parallel parameter

Signed-off-by: husharp <[email protected]>
okJiang pushed a commit to okJiang/pd that referenced this issue May 23, 2024
ref tikv#7969

add parallel parameter

Signed-off-by: husharp <[email protected]>
Signed-off-by: okJiang <[email protected]>
okJiang pushed a commit to okJiang/pd that referenced this issue May 23, 2024
ref tikv#7969

add parallel parameter

Signed-off-by: husharp <[email protected]>
Signed-off-by: okJiang <[email protected]>
ti-chi-bot bot pushed a commit that referenced this issue Jul 2, 2024
ti-chi-bot bot pushed a commit that referenced this issue Jul 19, 2024
ti-chi-bot bot added a commit that referenced this issue Aug 6, 2024
ref #7969, ref #8475

Signed-off-by: husharp <[email protected]>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
ti-chi-bot bot added a commit that referenced this issue Aug 8, 2024
ref #7969

Signed-off-by: Ryan Leung <[email protected]>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
ti-chi-bot bot pushed a commit that referenced this issue Sep 2, 2024
ti-chi-bot bot added a commit that referenced this issue Sep 12, 2024
ref #7969

Signed-off-by: Ryan Leung <[email protected]>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
@HuSharp HuSharp closed this as completed Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/development The issue belongs to a development tasks
Projects
None yet
Development

No branches or pull requests

1 participant