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
Run all integration tests in parallel #2769
Comments
It looks like Option 1We can make a custom suite, which wraps an original suite. The custom suite uses Option 2We can get rid of |
Basic Suite execution time measurementWe used worker pool pattern to lauch tests in parallel. Here are the results of running tests Locally and on CI with 1 and 5 workers
|
Decomposition
Total: 51h |
Current behaviorIntegration tests are launched sequentially in suites. Suites are not designed to run tests in parallel. Here is the issue about the feature stretchr/testify#187. SolutionHow do we run tests in parallelIn order to launch tests in parallel we can use sub-test pattern using package t.Parallel() Here is an example of how a parallel version of tests could look: func TestAll(t *testing.T) {
s := Suite{}
s.SetT(t)
s.SetupSuite()
tests := []struct {
Name string
Test func(t *testing.T)
}{
{"Kernel2Ethernet2Kernel", s.Kernel2Ethernet2Kernel},
{"Kernel2Kernel", s.Kernel2Kernel},
{"Memif2Memif", s.Memif2Memif},
}
for _, test := range tests {
t.Run(test.Name, test.Test)
}
}
func (s *Suite) TestKernel2Ethernet2Kernel(t *testing.T) {
t.Parallel()
...
}
func (s *Suite) TestKernel2Kernel(t *testing.T) {
t.Parallel()
...
}
func (s *Suite) TestMemif2Memif(t *testing.T) {
t.Parallel()
...
} We add one top-level test The way we lauch tests is different now. func TestRunBasicSuite(t *testing.T) {
suite.Run(t, new(basic.Suite))
} New way: func TestRunBasicSuite(t *testing.T) {
basic.TestAll(t)
} How do we control a number of concurrent testsWe can control a number of concurrent tests with flag If there are tests, which conflict with other tests or require a lot of resources (for example, Changes in
|
PR with parallel running in testify stretchr/testify#1109 |
Decomposition
|
Results
|
Description
Each integration test is launched in its own namespace. If we launch several tests simultaneously they won't interfere with each other. It will reduce time of testing on CI and also it will improve coverage and quality of the project.
Results:
Solution
We can use worker pool pattern to launch tests in parallel. That is necessary for public clusters because they have limited resources.
We need to add some changes to
gotestmd
to generate test suites that can run in parallel. Also we need to add special flagparallel
for each suite to have a possibility to launch them sequentially.We can launch tests with
and add special flag
to launch several tests in parallel.
The text was updated successfully, but these errors were encountered: