jaegertracing/jaeger

Improve unit test speed

クローズ

#6,111 opened on 2024/10/22

 (25 件のコメント) (0 件のリアクション) (0 人の担当者)Go (2,326 件のフォーク)batch import
good first issuehelp wantedperformance

Repository metrics

Stars
 (18,974 個のスター)
PR merge metrics
 (平均マージ 4d 11h) (30d で 85 merged PRs)

説明

This blog post provides a good background / introduction: https://threedots.tech/post/go-test-parallelism/

When I ran the following command

GOMAXPROCS=1 go test -parallel 128 -p 16 -json ./... | go run github.com/roblaszczak/vgt@latest

I got the following output:

Image

It shows some tests running for a very long time (the darker blue colors), but even of some of them were sped up there are others (like in the first group in top left corner) that are still relatively long.

We also almost never use t.Parallel() in our test (right now I only found one instance), even though many of our tests are starting servers and making network calls, so could benefit from parallelism. But adding t.Parallel() should be done with care - some tests are starting servers on the same port (instead of ephemeral port) and must be refactored before adding parallelism.

コントリビューターガイド