Merge pull request #117196 from pohly/scheduler-perf-labels

scheduler_perf: support test case selection via labels
This commit is contained in:
Kubernetes Prow Robot
2023-04-26 14:26:14 -07:00
committed by GitHub
5 changed files with 175 additions and 0 deletions

View File

@@ -121,6 +121,8 @@ type testCase struct {
// This path can be overridden in createPodsOp by setting PodTemplatePath .
// Optional
DefaultPodTemplatePath *string
// Labels can be used to enable or disable workloads inside this test case.
Labels []string
}
func (tc *testCase) collectsMetrics() bool {
@@ -151,6 +153,8 @@ type workload struct {
Name string
// Values of parameters used in the workloadTemplate.
Params params
// Labels can be used to enable or disable a workload.
Labels []string
}
type params struct {
@@ -608,6 +612,8 @@ func initTestOutput(tb testing.TB) io.Writer {
return output
}
var perfSchedulingLabelFilter = flag.String("perf-scheduling-label-filter", "performance", "comma-separated list of labels which a testcase must have (no prefix or +) or must not have (-)")
func BenchmarkPerfScheduling(b *testing.B) {
testCases, err := getTestCases(configFile)
if err != nil {
@@ -632,6 +638,10 @@ func BenchmarkPerfScheduling(b *testing.B) {
b.Run(tc.Name, func(b *testing.B) {
for _, w := range tc.Workloads {
b.Run(w.Name, func(b *testing.B) {
if !enabled(*perfSchedulingLabelFilter, append(tc.Labels, w.Labels...)...) {
b.Skipf("disabled by label filter %q", *perfSchedulingLabelFilter)
}
// Ensure that there are no leaked
// goroutines. They could influence
// performance of the next benchmark.