Commit d696ecdb authored by Yifan Gu's avatar Yifan Gu

integration: Randomize the order of the integration tests.

parent 4f3f1951
...@@ -999,25 +999,25 @@ func main() { ...@@ -999,25 +999,25 @@ func main() {
} }
// Only run at most maxConcurrency tests in parallel. // Only run at most maxConcurrency tests in parallel.
numFinishedTests := 0 if maxConcurrency <= 0 {
for numFinishedTests < len(testFuncs) { maxConcurrency = len(testFuncs)
numTestsToRun := len(testFuncs) - numFinishedTests }
if maxConcurrency > 0 && numTestsToRun > maxConcurrency { glog.Infof("Running %d tests in parallel.", maxConcurrency)
numTestsToRun = maxConcurrency ch := make(chan struct{}, maxConcurrency)
}
glog.Infof("Running %d tests in parallel.", numTestsToRun) var wg sync.WaitGroup
var wg sync.WaitGroup wg.Add(len(testFuncs))
wg.Add(numTestsToRun) for i := range testFuncs {
for i := 0; i < numTestsToRun; i++ { f := testFuncs[i]
f := testFuncs[i+numFinishedTests] go func() {
go func() { ch <- struct{}{}
f(kubeClient) f(kubeClient)
wg.Done() <-ch
}() wg.Done()
} }()
wg.Wait()
numFinishedTests += numTestsToRun
} }
wg.Wait()
close(ch)
// Check that kubelet tried to make the containers. // Check that kubelet tried to make the containers.
// Using a set to list unique creation attempts. Our fake is // Using a set to list unique creation attempts. Our fake is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment