Merge pull request #56940 from misterikkit/subTest

Automatic merge from submit-queue (batch tested with PRs 56894, 56940, 55223, 56554, 54985). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Convert scheduler_perf tests to use subtest.

Combine four separate tests into a table-driven test that uses subtests
to logically organize the tests.



**What this PR does / why we need it**:
Simplifies integration test code in test/integration/scheduler_perf.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```

/sig scheduling
This commit is contained in:
Kubernetes Submit Queue 2017-12-16 13:49:54 -08:00 committed by GitHub
commit fe3eb4ed88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,7 @@ limitations under the License.
package benchmark
import (
"fmt"
"testing"
"time"
@ -27,28 +28,19 @@ import (
"github.com/golang/glog"
)
// BenchmarkScheduling100Nodes0Pods benchmarks the scheduling rate
// when the cluster has 100 nodes and 0 scheduled pods
func BenchmarkScheduling100Nodes0Pods(b *testing.B) {
benchmarkScheduling(100, 0, b)
}
// BenchmarkScheduling100Nodes1000Pods benchmarks the scheduling rate
// when the cluster has 100 nodes and 1000 scheduled pods
func BenchmarkScheduling100Nodes1000Pods(b *testing.B) {
benchmarkScheduling(100, 1000, b)
}
// BenchmarkScheduling1000Nodes0Pods benchmarks the scheduling rate
// when the cluster has 1000 nodes and 0 scheduled pods
func BenchmarkScheduling1000Nodes0Pods(b *testing.B) {
benchmarkScheduling(1000, 0, b)
}
// BenchmarkScheduling1000Nodes1000Pods benchmarks the scheduling rate
// when the cluster has 1000 nodes and 1000 scheduled pods
func BenchmarkScheduling1000Nodes1000Pods(b *testing.B) {
benchmarkScheduling(1000, 1000, b)
// BenchmarkScheduling benchmarks the scheduling rate when the cluster has
// various quantities of nodes and scheduled pods.
func BenchmarkScheduling(b *testing.B) {
tests := []struct{ nodes, pods int }{
{nodes: 100, pods: 0},
{nodes: 100, pods: 1000},
{nodes: 1000, pods: 0},
{nodes: 1000, pods: 1000},
}
for _, test := range tests {
name := fmt.Sprintf("%vNodes/%vPods", test.nodes, test.pods)
b.Run(name, func(b *testing.B) { benchmarkScheduling(test.nodes, test.pods, b) })
}
}
// benchmarkScheduling benchmarks scheduling rate with specific number of nodes