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
Rent Boskos project only once per test run. #405
Conversation
The old implementation rents Boskos project for each Ginkgo node.
/assign @wangzhen127 |
Just curious, has this been a problem before (despite waste of resources)? |
No, there is no problem at all. The only thing that I'm concerned with is the waste of resources. |
The ginkgo documentation has said "When possible, you should make every effort to start up a new instance of an external resource for every parallel node. This helps avoid test-pollution by strictly separating each parallel node." If there were no problem before, maybe we should just use the old way? |
I agree with the principle that tests should be isolated to avoid pollution. And although we don't see any resource deficiency at the moment, we have plans to expanding the test infra which will start eating away the Boskos project pool:
I agree that this PR is not strictly necessary right now. And I agree that it could potentially add technical maintenance burden (of maintaining this synchronization). However I think the improvement out-weights the cost :) |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: wangzhen127, xueweiz 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 |
The e2e tests are running in parallel in different Ginkgo nodes (i.e. separate processes).
The old implementation is renting a Boskos project on each Ginkgo node. This is actually a waste of resource, because we already have VM-level isolation between test cases, we don't need project-level isolation. That could exhaust Boskos project pool.
The new implementation uses the
SynchronizedBeforeSuite()
andSynchronizedAfterSuite()
functions to help. See the Managing Singleton External Processes in Parallel Test Suites subsection in the Ginkgo documentation for parallel tests.Basically
rentBoskosProjectIfNeededOnNode1()
is called only once on Ginkgo node 1. It will rent a GCP project from Boskos, then pass the project name to all Ginkgo nodes. It will also spawn a goroutine to keep renewing the rented project.The other Gingko nodes waits for node 1 to rent the project, and will then accept the project using the
acceptBoskosProjectIfNeededFromNode1()
function.In the end, Gingko node 1 will wait for all other nodes to finish, then call the
releaseBoskosResourcesOnNode1()
function which releases the rented project.Here is the logs from a sample run:
Most importantly, note that only Ginkgo node 1 rented the project, and all other nodes simple accepts it from node 1. And that the resource is only released after all nodes have finished.