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

use --parallel to set Ginkgo's --procs flag #172

Merged
merged 6 commits into from
Apr 12, 2024

Conversation

xrstf
Copy link
Contributor

@xrstf xrstf commented Apr 3, 2024

This is a suggestion to how we could handle --parallel to control the concurrency in Ginkgo. Importantly, setting --parallel to a value larger than 1 does not set E2E_PARALLEL=true, as this would make the go-runner automatically set --p --skip=\[Serial\], which would skip a few important test cases.

Since we would now already control the E2E_EXTRA_GINKGO_ARGS variable, I also made it available on the CLI. This would allow someone to run --parallel --extra-ginkgo-args="--parallel=true --skip=...." to really only run the parallel tests.

It would work like this:

$ hydrophone --conformance --parallel 20
00:19:10 INF API endpoint: https://yadda.yadda.yadda:6443
00:19:10 INF Server version: version.Info{Major:"1", Minor:"29", GitVersion:"v1.29.2", GitCommit:"4b8e819355d791d96b7e9d9efe4cbafae2311c88", GitTreeState:"clean", BuildDate:"2024-02-14T10:32:40Z", GoVersion:"go1.21.7", Compiler:"gc", Platform:"linux/amd64"}
00:19:10 INF Using namespace: conformance
00:19:10 INF Using conformance image: registry.k8s.io/conformance:v1.29.2
00:19:10 INF Using busybox image: registry.k8s.io/e2e-test-images/busybox:1.36.1-1
00:19:10 INF Test framework will start 20 thread(s) and use verbosity level 4.
00:19:10 INF Created Namespace conformance.
00:19:10 INF Created ServiceAccount conformance-serviceaccount.
00:19:10 INF Created Clusterrole conformance-serviceaccount.
00:19:10 INF Created ClusterRoleBinding conformance-serviceaccount-role.
00:19:10 INF Created Pod e2e-conformance-test.
⢆⡱2024/04/03 22:19:11 Running command:
Command env: []
Run from directory:
Executable path: /usr/local/bin/ginkgo
Args (comma-delimited): /usr/local/bin/ginkgo,--focus=\[Conformance\],--skip=,--no-color=true,--procs=20,--timeout=24h,/usr/local/bin/e2e.test,--,--disable-log-dump,--repo-root=/kubernetes,--provider=skeleton,--report-dir=/tmp/results,--kubeconfig=
2024/04/03 22:34:16 Now listening for interrupts
⢀⡱Running Suite: Kubernetes e2e suite - /usr/local/bin
====================================================
Random Seed: 1712183656 - will randomize all specs

Will run 388 of 7407 specs
Running in parallel across 20 processes

and dramatically speeds up the conformance tests, from ~1h30min to 20min.

I'm not sure if this is the best/correct solution, but it seems to work :-) Maybe the way --parallel here does not map to --parallel in Ginkgo is confusing, maybe it would make more sense to introduce a new flag / rename --parallel to something like --concurrency=<int>? Or even directly adapt Ginkgo's --procs/--nodes?

Fixes #167

@k8s-ci-robot k8s-ci-robot requested a review from dims April 3, 2024 23:14
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 3, 2024
@k8s-ci-robot k8s-ci-robot requested a review from rjsadow April 3, 2024 23:14
@k8s-ci-robot
Copy link
Contributor

Hi @xrstf. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 3, 2024
log.Printf("Test framework will start %d thread(s) and use verbosity level %d.",
viper.Get("parallel"), viper.Get("verbosity"))

outputDir := viper.GetString("output-dir")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing L94-97 does not seem right, do we not need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't remove those lines, I moved them from this function into SetDefaults, where all the other status printing happens. Seems more natural to have all the validation in one func and all the information printing in the other.

@reetasingh
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 4, 2024
@xrstf xrstf marked this pull request as draft April 4, 2024 06:37
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 4, 2024
@xrstf xrstf marked this pull request as ready for review April 4, 2024 06:52
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 4, 2024
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 6, 2024
@xrstf xrstf force-pushed the fix-parallel-flag branch from a38241d to 4538853 Compare April 6, 2024 18:36
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 6, 2024
@xrstf xrstf force-pushed the fix-parallel-flag branch from 4538853 to 6462efa Compare April 7, 2024 18:12
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 7, 2024
@dims
Copy link
Member

dims commented Apr 8, 2024

/assign @reetasingh @rjsadow

@rjsadow
Copy link
Collaborator

rjsadow commented Apr 12, 2024

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 12, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rjsadow, xrstf

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 12, 2024
@k8s-ci-robot k8s-ci-robot merged commit 607432d into kubernetes-sigs:main Apr 12, 2024
8 checks passed
@xrstf xrstf deleted the fix-parallel-flag branch April 18, 2024 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--parallel flag not working?
5 participants