mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +00:00
Convert scheduler_perf tests to use subtest.
Combine four separate tests into a table-driven test that uses subtests to logically organize the tests.
This commit is contained in:
parent
f875ee596d
commit
e256c28beb
@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package benchmark
|
package benchmark
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -27,28 +28,19 @@ import (
|
|||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BenchmarkScheduling100Nodes0Pods benchmarks the scheduling rate
|
// BenchmarkScheduling benchmarks the scheduling rate when the cluster has
|
||||||
// when the cluster has 100 nodes and 0 scheduled pods
|
// various quantities of nodes and scheduled pods.
|
||||||
func BenchmarkScheduling100Nodes0Pods(b *testing.B) {
|
func BenchmarkScheduling(b *testing.B) {
|
||||||
benchmarkScheduling(100, 0, 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 {
|
||||||
// BenchmarkScheduling100Nodes1000Pods benchmarks the scheduling rate
|
name := fmt.Sprintf("%vNodes/%vPods", test.nodes, test.pods)
|
||||||
// when the cluster has 100 nodes and 1000 scheduled pods
|
b.Run(name, func(b *testing.B) { benchmarkScheduling(test.nodes, test.pods, b) })
|
||||||
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 scheduling rate with specific number of nodes
|
// benchmarkScheduling benchmarks scheduling rate with specific number of nodes
|
||||||
|
Loading…
Reference in New Issue
Block a user