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

unit tests take long to finish #10042

Open
lobkovilya opened this issue Apr 22, 2024 · 2 comments
Open

unit tests take long to finish #10042

lobkovilya opened this issue Apr 22, 2024 · 2 comments
Labels
kind/improvement Improvement on an existing feature triage/accepted The issue was reviewed and is complete enough to start working on it

Comments

@lobkovilya
Copy link
Contributor

lobkovilya commented Apr 22, 2024

Description

Top 20 longest packages:

╭────┬──────────────────────────────────────────────────────────────────────┬──────────────╮
│  # │                               package                                │ duration_sec │
├────┼──────────────────────────────────────────────────────────────────────┼──────────────┤
│  0 │ github.com/kumahq/kuma/pkg/plugins/resources/postgres                │       112.33 │
│  1 │ github.com/kumahq/kuma/app/kumactl/cmd/install                       │        89.52 │
│  2 │ github.com/kumahq/kuma/pkg/plugins/runtime/gateway                   │        66.21 │
│  3 │ github.com/kumahq/kuma/pkg/api-server                                │        43.20 │
│  4 │ github.com/kumahq/kuma/pkg/xds/secrets                               │        24.46 │
│  5 │ github.com/kumahq/kuma/pkg/plugins/leader/postgres                   │        22.64 │
│  6 │ github.com/kumahq/kuma/pkg/plugins/runtime/k8s/webhooks/injector     │        13.91 │
│  7 │ github.com/kumahq/kuma/pkg/core/resources/manager                    │        12.53 │
│  8 │ github.com/kumahq/kuma/pkg/xds/auth/universal                        │        11.73 │
│  9 │ github.com/kumahq/kuma/pkg/core/managers/apis/mesh                   │        11.36 │
│ 10 │ github.com/kumahq/kuma/pkg/plugins/runtime/k8s/webhooks              │        10.77 │
│ 11 │ github.com/kumahq/kuma/pkg/plugins/resources/k8s                     │        10.00 │
│ 12 │ github.com/kumahq/kuma/pkg/plugins/resources/k8s/native/api/v1alpha1 │         9.80 │
│ 13 │ github.com/kumahq/kuma/pkg/plugins/runtime/k8s/controllers           │         9.21 │
│ 14 │ github.com/kumahq/kuma/pkg/xds/cache/mesh                            │         8.34 │
│ 15 │ github.com/kumahq/kuma/pkg/plugins/config/k8s                        │         7.49 │
│ 16 │ github.com/kumahq/kuma/pkg/plugins/secrets/k8s                       │         7.29 │
│ 17 │ github.com/kumahq/kuma/pkg/core/tokens                               │         5.44 │
│ 18 │ github.com/kumahq/kuma/pkg/kds/mux                                   │         5.41 │
│ 19 │ github.com/kumahq/kuma/pkg/xds/sync                                  │         5.41 │
╰────┴──────────────────────────────────────────────────────────────────────┴──────────────╯

Package github.com/kumahq/kuma/app/kumactl/cmd/install seems suspiciously long and is worth checking first.

@lobkovilya lobkovilya added triage/pending This issue will be looked at on the next triage meeting kind/improvement Improvement on an existing feature labels Apr 22, 2024
@lahabana
Copy link
Contributor

I looked at cmd/install and it all seems to be linked to -race it takes 4s without and 1m with the flag. Not very surprising as the race detector is meant to slow things down...

@jakubdyszkiewicz jakubdyszkiewicz added triage/accepted The issue was reviewed and is complete enough to start working on it and removed triage/pending This issue will be looked at on the next triage meeting labels Apr 29, 2024
@lobkovilya
Copy link
Contributor Author

lobkovilya commented Apr 29, 2024

I copied the make test output that looks like:

ok  	github.com/kumahq/kuma/pkg/core/policy	1.455s
ok  	github.com/kumahq/kuma/pkg/core/ratelimits	1.417s
ok  	github.com/kumahq/kuma/pkg/core/resources/access	1.311s
?   	github.com/kumahq/kuma/pkg/core/resources/apis/meshservice	[no test files]
?   	github.com/kumahq/kuma/pkg/core/resources/apis/meshservice/api/v1alpha1	[no test files]

and then using nushell:

~> pbpaste | grep -v "no test files" | sed 's/[[:blank:]]\{1,\}/ /g' 
| from csv --noheaders --separator ' ' 
| reject column1
| sort-by column3 -n --reverse
| rename package duration

I got the result:

╭───┬──────────────────────────────────────────────────┬──────────╮
│ # │                     package                      │ duration │
├───┼──────────────────────────────────────────────────┼──────────┤
│ 0 │ github.com/kumahq/kuma/pkg/core/policy           │ 1.455s   │
│ 1 │ github.com/kumahq/kuma/pkg/core/ratelimits       │ 1.417s   │
│ 2 │ github.com/kumahq/kuma/pkg/core/resources/access │ 1.311s   │
╰───┴──────────────────────────────────────────────────┴──────────╯

Unfortunately, I couldn't make from csv work with the original output because there was a mix of tabs and spaces, so I had to use sed. But other than that the experience with the nushell was pretty fun.

cc @michaelbeaumont @slonka

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/improvement Improvement on an existing feature triage/accepted The issue was reviewed and is complete enough to start working on it
Projects
None yet
Development

No branches or pull requests

3 participants