Merge pull request #127269 from sanposhiho/patch-11

chore: tidy up labels in scheduler-perf
This commit is contained in:
Kubernetes Prow Robot 2024-09-19 04:18:44 +01:00 committed by GitHub
commit 2850d302ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 108 additions and 98 deletions

View File

@ -44,9 +44,9 @@ be used to select workloads. It works like GitHub label filtering: the flag acce
a comma-separated list of label names. Each label may have a `+` or `-` as prefix. Labels with a comma-separated list of label names. Each label may have a `+` or `-` as prefix. Labels with
`+` or no prefix must be set for a workload for it to be run. `-` means that the label must not `+` or no prefix must be set for a workload for it to be run. `-` means that the label must not
be set. For example, this runs all performance benchmarks except those that are labeled be set. For example, this runs all performance benchmarks except those that are labeled
as "fast": as "integration-test":
```shell ```shell
make test-integration WHAT=./test/integration/scheduler_perf ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling -perf-scheduling-label-filter=performance,-fast" make test-integration WHAT=./test/integration/scheduler_perf ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling -perf-scheduling-label-filter=performance,-integration-test"
``` ```
Once the benchmark is finished, JSON file with metrics is available in the current directory (test/integration/scheduler_perf). Look for `BenchmarkPerfScheduling_benchmark_YYYY-MM-DDTHH:MM:SSZ.json`. Once the benchmark is finished, JSON file with metrics is available in the current directory (test/integration/scheduler_perf). Look for `BenchmarkPerfScheduling_benchmark_YYYY-MM-DDTHH:MM:SSZ.json`.
@ -139,6 +139,8 @@ The test cases labeled as `short` are executed in pull-kubernetes-integration jo
| pull-kubernetes-integration | integration-test,short | | pull-kubernetes-integration | integration-test,short |
| ci-benchmark-scheduler-perf | performance | | ci-benchmark-scheduler-perf | performance |
See the comment on [./config/performance-config.yaml](./config/performance-config.yaml) for the details.
## Scheduling throughput thresholds ## Scheduling throughput thresholds
Thresholds are used to capture scheduler performance regressions in a periodic ci-benchmark-scheduler-perf job. Thresholds are used to capture scheduler performance regressions in a periodic ci-benchmark-scheduler-perf job.

View File

@ -1,18 +1,18 @@
# The following labels are used in this file: # The following labels are used in this file. (listed in ascending order of the number of covered test cases)
# - fast: short execution time, ideally less than 30 seconds #
# - integration-test: used to select workloads that # - integration-test: test cases to run as the integration test, usually to spot some issues in the scheduler implementation or scheduler-perf itself.
# run in ci-kubernetes-integration-master. Choosing those tests # - performance: test cases to run in the performance test.
# is a tradeoff between code coverage and overall runtime. # - short: supplemental label for the above two labels (must not used alone), which literally means short execution time test cases.
# - short: used to select workloads that #
# run in pull-kubernetes-integration. # Specifically, the CIs use labels like the following:
# We should make each test case with short label very small, # - `ci-kubernetes-integration-master` (`integration-test`): Test cases are chosen based on a tradeoff between code coverage and overall runtime.
# so that all tests with the label should take less than 5 min to complete. # It basically covers all test cases but with their smallest workload.
# They can be run using --short=true flag. # - `pull-kubernetes-integration` (`integration-test`,`short`): Test cases are chosen so that they should take less than total 5 min to complete.
# - performance: used to select workloads that run # - `ci-benchmark-scheduler-perf` (`performance`): Long enough test cases are chosen (ideally, longer than 10 seconds)
# in ci-benchmark-scheduler-perf. Such workloads # to provide meaningful samples for the pod scheduling rate.
# must run long enough (ideally, longer than 10 seconds) #
# to provide meaningful samples for the pod scheduling # Also, `performance`+`short` isn't used in the CIs, but it's used to test the performance test locally.
# rate. # (Sometimes, the test cases with `integration-test` are too small to spot issues.)
# #
# Combining "performance" and "fast" selects suitable workloads for a local # Combining "performance" and "fast" selects suitable workloads for a local
# before/after comparisons with benchstat. # before/after comparisons with benchstat.
@ -29,19 +29,19 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 5Nodes - name: 5Nodes
labels: [integration-test, fast, short] labels: [integration-test, performance, short]
params: params:
initNodes: 5 initNodes: 5
initPods: 5 initPods: 5
measurePods: 10 measurePods: 10
- name: 500Nodes - name: 500Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 500 initNodes: 500
initPods: 500 initPods: 500
measurePods: 1000 measurePods: 1000
- name: 5000Nodes - name: 5000Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 5000 initNodes: 5000
initPods: 1000 initPods: 1000
@ -71,19 +71,19 @@
namespace: sched-1 namespace: sched-1
workloads: workloads:
- name: 5Nodes - name: 5Nodes
labels: [integration-test, fast, short] labels: [integration-test, performance, short]
params: params:
initNodes: 5 initNodes: 5
initPods: 1 initPods: 1
measurePods: 4 measurePods: 4
- name: 500Nodes - name: 500Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 500 initNodes: 500
initPods: 100 initPods: 100
measurePods: 400 measurePods: 400
- name: 5000Nodes - name: 5000Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 5000 initNodes: 5000
initPods: 1000 initPods: 1000
@ -108,19 +108,19 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 5Nodes - name: 5Nodes
labels: [integration-test, fast, short] labels: [integration-test, performance, short]
params: params:
initNodes: 5 initNodes: 5
initPods: 5 initPods: 5
measurePods: 10 measurePods: 10
- name: 500Nodes - name: 500Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 500 initNodes: 500
initPods: 500 initPods: 500
measurePods: 1000 measurePods: 1000
- name: 5000Nodes - name: 5000Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 5000 initNodes: 5000
initPods: 5000 initPods: 5000
@ -148,13 +148,13 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 5Nodes - name: 5Nodes
labels: [integration-test, fast] labels: [integration-test, performance, short]
params: params:
initNodes: 5 initNodes: 5
initPods: 5 initPods: 5
measurePods: 10 measurePods: 10
- name: 500Nodes - name: 500Nodes
labels: [performance, fast] labels: [performance, short]
params: params:
initNodes: 500 initNodes: 500
initPods: 500 initPods: 500
@ -197,13 +197,13 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 5Nodes - name: 5Nodes
labels: [integration-test, fast] labels: [integration-test, performance, short]
params: params:
initNodes: 5 initNodes: 5
initPods: 5 initPods: 5
measurePods: 10 measurePods: 10
- name: 500Nodes - name: 500Nodes
labels: [performance, fast] labels: [performance, short]
params: params:
initNodes: 500 initNodes: 500
initPods: 500 initPods: 500
@ -244,13 +244,13 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 5Nodes - name: 5Nodes
labels: [integration-test, fast, short] labels: [integration-test, performance, short]
params: params:
initNodes: 5 initNodes: 5
initPods: 5 initPods: 5
measurePods: 10 measurePods: 10
- name: 500Nodes - name: 500Nodes
labels: [performance, fast] labels: [performance, short]
params: params:
initNodes: 500 initNodes: 500
initPods: 500 initPods: 500
@ -290,19 +290,19 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 5Nodes - name: 5Nodes
labels: [integration-test, fast] labels: [integration-test, performance, short]
params: params:
initNodes: 5 initNodes: 5
initPods: 5 initPods: 5
measurePods: 10 measurePods: 10
- name: 500Nodes - name: 500Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 500 initNodes: 500
initPods: 500 initPods: 500
measurePods: 1000 measurePods: 1000
- name: 5000Nodes - name: 5000Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 5000 initNodes: 5000
initPods: 5000 initPods: 5000
@ -332,13 +332,13 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 5Nodes - name: 5Nodes
labels: [integration-test, fast] labels: [integration-test, performance, short]
params: params:
initNodes: 5 initNodes: 5
initPods: 5 initPods: 5
measurePods: 10 measurePods: 10
- name: 500Nodes - name: 500Nodes
labels: [performance, fast] labels: [performance, short]
params: params:
initNodes: 500 initNodes: 500
initPods: 500 initPods: 500
@ -374,19 +374,19 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 5Nodes - name: 5Nodes
labels: [integration-test, fast] labels: [integration-test, performance, short]
params: params:
initNodes: 5 initNodes: 5
initPods: 5 initPods: 5
measurePods: 10 measurePods: 10
- name: 500Nodes - name: 500Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 500 initNodes: 500
initPods: 500 initPods: 500
measurePods: 1000 measurePods: 1000
- name: 5000Nodes - name: 5000Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 5000 initNodes: 5000
initPods: 5000 initPods: 5000
@ -421,12 +421,12 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 5Nodes - name: 5Nodes
labels: [integration-test, fast] labels: [integration-test, performance, short]
params: params:
initNodes: 5 initNodes: 5
measurePods: 10 measurePods: 10
- name: 15000Nodes - name: 15000Nodes
labels: [performance, fast] labels: [performance, short]
threshold: 390 threshold: 390
params: params:
initNodes: 15000 initNodes: 15000
@ -448,19 +448,19 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 5Nodes - name: 5Nodes
labels: [integration-test, fast, short] labels: [integration-test, performance, short]
params: params:
initNodes: 5 initNodes: 5
initPods: 5 initPods: 5
measurePods: 10 measurePods: 10
- name: 500Nodes - name: 500Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 500 initNodes: 500
initPods: 500 initPods: 500
measurePods: 1000 measurePods: 1000
- name: 5000Nodes - name: 5000Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 5000 initNodes: 5000
initPods: 5000 initPods: 5000
@ -490,19 +490,19 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 5Nodes - name: 5Nodes
labels: [integration-test, fast, short] labels: [integration-test, performance, short]
params: params:
initNodes: 5 initNodes: 5
initPods: 10 initPods: 10
measurePods: 10 measurePods: 10
- name: 500Nodes - name: 500Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 500 initNodes: 500
initPods: 1000 initPods: 1000
measurePods: 1000 measurePods: 1000
- name: 5000Nodes - name: 5000Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 5000 initNodes: 5000
initPods: 5000 initPods: 5000
@ -532,13 +532,13 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 5Nodes - name: 5Nodes
labels: [integration-test, fast] labels: [integration-test, performance, short]
params: params:
initNodes: 5 initNodes: 5
initPods: 10 initPods: 10
measurePods: 10 measurePods: 10
- name: 500Nodes - name: 500Nodes
labels: [performance, fast] labels: [performance, short]
params: params:
initNodes: 500 initNodes: 500
initPods: 1000 initPods: 1000
@ -593,13 +593,13 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 5Nodes - name: 5Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 5 initNodes: 5
initPods: 2 initPods: 2
measurePods: 10 measurePods: 10
- name: 500Nodes - name: 500Nodes
labels: [performance, fast] labels: [performance, short]
params: params:
initNodes: 500 initNodes: 500
initPods: 200 initPods: 200
@ -631,13 +631,13 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 5Nodes - name: 5Nodes
labels: [integration-test, fast, short] labels: [integration-test, performance, short]
params: params:
initNodes: 5 initNodes: 5
initPods: 20 initPods: 20
measurePods: 5 measurePods: 5
- name: 500Nodes - name: 500Nodes
labels: [performance, fast] labels: [performance, short]
threshold: 18 threshold: 18
params: params:
initNodes: 500 initNodes: 500
@ -667,13 +667,13 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 5Nodes - name: 5Nodes
labels: [integration-test, fast] labels: [integration-test, performance, short]
params: params:
initNodes: 5 initNodes: 5
initPods: 20 initPods: 20
measurePods: 5 measurePods: 5
- name: 500Nodes - name: 500Nodes
labels: [performance, fast] labels: [performance, short]
threshold: 18 threshold: 18
params: params:
initNodes: 500 initNodes: 500
@ -702,19 +702,19 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 5Nodes/2InitPods - name: 5Nodes/2InitPods
labels: [integration-test, fast, short] labels: [integration-test, performance, short]
params: params:
initNodes: 5 initNodes: 5
initPods: 2 initPods: 2
measurePods: 10 measurePods: 10
- name: 500Nodes/200InitPods - name: 500Nodes/200InitPods
labels: [fast] labels: [performance, short]
params: params:
initNodes: 500 initNodes: 500
initPods: 200 initPods: 200
measurePods: 1000 measurePods: 1000
- name: 5000Nodes/200InitPods - name: 5000Nodes/200InitPods
labels: [fast] labels: [performance, short]
params: params:
initNodes: 5000 initNodes: 5000
initPods: 200 initPods: 200
@ -750,17 +750,17 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 10Nodes - name: 10Nodes
labels: [integration-test, fast] labels: [integration-test, performance, short]
params: params:
initNodes: 10 initNodes: 10
measurePods: 100 measurePods: 100
- name: 1000Nodes - name: 1000Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 1000 initNodes: 1000
measurePods: 1000 measurePods: 1000
- name: 5000Nodes - name: 5000Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 5000 initNodes: 5000
measurePods: 2000 measurePods: 2000
@ -796,14 +796,14 @@
namespace: measure-ns-0 namespace: measure-ns-0
workloads: workloads:
- name: 10Nodes - name: 10Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 10 initNodes: 10
initPodsPerNamespace: 2 initPodsPerNamespace: 2
initNamespaces: 2 initNamespaces: 2
measurePods: 6 measurePods: 6
- name: 500Nodes - name: 500Nodes
labels: [performance, fast] labels: [performance, short]
params: params:
initNodes: 500 initNodes: 500
initPodsPerNamespace: 4 initPodsPerNamespace: 4
@ -850,14 +850,14 @@
namespace: measure-ns-0 namespace: measure-ns-0
workloads: workloads:
- name: 10Nodes - name: 10Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 10 initNodes: 10
initPodsPerNamespace: 2 initPodsPerNamespace: 2
initNamespaces: 2 initNamespaces: 2
measurePods: 10 measurePods: 10
- name: 500Nodes - name: 500Nodes
labels: [performance, fast] labels: [performance, short]
params: params:
initNodes: 500 initNodes: 500
initPodsPerNamespace: 4 initPodsPerNamespace: 4
@ -907,14 +907,14 @@
namespace: measure-ns-0 namespace: measure-ns-0
workloads: workloads:
- name: 10Nodes - name: 10Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 10 initNodes: 10
initPodsPerNamespace: 2 initPodsPerNamespace: 2
initNamespaces: 2 initNamespaces: 2
measurePods: 10 measurePods: 10
- name: 500Nodes - name: 500Nodes
labels: [performance, fast] labels: [performance, short]
params: params:
initNodes: 500 initNodes: 500
initPodsPerNamespace: 4 initPodsPerNamespace: 4
@ -961,14 +961,14 @@
namespace: measure-ns-0 namespace: measure-ns-0
workloads: workloads:
- name: 10Nodes - name: 10Nodes
labels: [fast] labels: [performance, short]
params: params:
initNodes: 10 initNodes: 10
initPodsPerNamespace: 2 initPodsPerNamespace: 2
initNamespaces: 2 initNamespaces: 2
measurePods: 10 measurePods: 10
- name: 500Nodes - name: 500Nodes
labels: [performance, fast] labels: [performance, short]
params: params:
initNodes: 500 initNodes: 500
initPodsPerNamespace: 4 initPodsPerNamespace: 4
@ -1005,19 +1005,19 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 5Nodes - name: 5Nodes
labels: [integration-test, fast] labels: [integration-test, performance, short]
params: params:
taintNodes: 1 taintNodes: 1
normalNodes: 4 normalNodes: 4
measurePods: 4 measurePods: 4
- name: 500Nodes - name: 500Nodes
labels: [fast] labels: [performance, short]
params: params:
taintNodes: 100 taintNodes: 100
normalNodes: 400 normalNodes: 400
measurePods: 400 measurePods: 400
- name: 5000Nodes - name: 5000Nodes
labels: [performance, fast] labels: [performance, short]
threshold: 68 threshold: 68
params: params:
taintNodes: 1000 taintNodes: 1000
@ -1060,7 +1060,7 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: fast - name: fast
labels: [integration-test, fast] labels: [integration-test, performance, short]
params: params:
# This testcase runs through all code paths without # This testcase runs through all code paths without
# taking too long overall. # taking too long overall.
@ -1137,7 +1137,7 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: fast - name: fast
labels: [integration-test, fast] labels: [integration-test, performance, short]
params: params:
# This testcase runs through all code paths without # This testcase runs through all code paths without
# taking too long overall. # taking too long overall.
@ -1203,7 +1203,7 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: fast - name: fast
labels: [integration-test, fast, short] labels: [integration-test, performance, short]
params: params:
# This testcase runs through all code paths without # This testcase runs through all code paths without
# taking too long overall. # taking too long overall.
@ -1275,7 +1275,7 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: fast - name: fast
labels: [integration-test, fast] labels: [integration-test, performance, short]
params: params:
# This testcase runs through all code paths without # This testcase runs through all code paths without
# taking too long overall. # taking too long overall.
@ -1339,13 +1339,13 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 1Node_10GatedPods - name: 1Node_10GatedPods
labels: [integration-test, fast] labels: [integration-test, performance, short]
params: params:
gatedPods: 10 gatedPods: 10
deletingPods: 10 deletingPods: 10
measurePods: 10 measurePods: 10
- name: 1Node_10000GatedPods - name: 1Node_10000GatedPods
labels: [performance, fast] labels: [performance, short]
threshold: 130 threshold: 130
params: params:
gatedPods: 10000 gatedPods: 10000
@ -1373,12 +1373,12 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 1Node_10GatedPods - name: 1Node_10GatedPods
labels: [fast] labels: [performance, short]
params: params:
gatedPods: 10 gatedPods: 10
measurePods: 10 measurePods: 10
- name: 1Node_10000GatedPods - name: 1Node_10000GatedPods
labels: [performance, fast] labels: [performance, short]
threshold: 110 threshold: 110
params: params:
gatedPods: 10000 gatedPods: 10000
@ -1408,13 +1408,13 @@
collectMetrics: true collectMetrics: true
workloads: workloads:
- name: 10Node_100DeletingPods - name: 10Node_100DeletingPods
labels: [integration-test, fast] labels: [integration-test, performance, short]
params: params:
initNodes: 10 initNodes: 10
deletingPods: 10 deletingPods: 10
measurePods: 10 measurePods: 10
- name: 1000Node_1000DeletingPods - name: 1000Node_1000DeletingPods
labels: [performance, fast] labels: [performance, short]
params: params:
initNodes: 1000 initNodes: 1000
deletingPods: 1000 deletingPods: 1000

View File

@ -16,15 +16,13 @@ limitations under the License.
package benchmark package benchmark
import "strings"
// enabled checks a a label filter that works as in GitHub: // enabled checks a a label filter that works as in GitHub:
// - empty string means enabled // - empty string means enabled
// - individual labels are comma-separated // - individual labels are comma-separated
// - [+]<label> means the workload must have that label // - [+]<label> means the workload must have that label
// - -<label> means the workload must not have that label // - -<label> means the workload must not have that label
func enabled(labelFilter string, labels ...string) bool { func enabled(labelFilters []string, labels ...string) bool {
for _, label := range strings.Split(labelFilter, ",") { for _, label := range labelFilters {
if label == "" { if label == "" {
continue continue
} }

View File

@ -60,7 +60,7 @@ func TestLabelFilter(t *testing.T) {
t.Run(labelFilter, func(t *testing.T) { t.Run(labelFilter, func(t *testing.T) {
for labels, expected := range labelResults { for labels, expected := range labelResults {
t.Run(labels, func(t *testing.T) { t.Run(labels, func(t *testing.T) {
actual := enabled(labelFilter, strings.Split(labels, ",")...) actual := enabled(strings.Split(labelFilter, ","), strings.Split(labels, ",")...)
if actual != expected { if actual != expected {
t.Errorf("expected enabled to be %v, got %v", expected, actual) t.Errorf("expected enabled to be %v, got %v", expected, actual)
} }

View File

@ -812,8 +812,6 @@ func initTestOutput(tb testing.TB) io.Writer {
return output 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 (-), used by BenchmarkPerfScheduling")
var specialFilenameChars = regexp.MustCompile(`[^a-zA-Z0-9-_]`) var specialFilenameChars = regexp.MustCompile(`[^a-zA-Z0-9-_]`)
func setupTestCase(t testing.TB, tc *testCase, output io.Writer, outOfTreePluginRegistry frameworkruntime.Registry) (informers.SharedInformerFactory, ktesting.TContext) { func setupTestCase(t testing.TB, tc *testCase, output io.Writer, outOfTreePluginRegistry frameworkruntime.Registry) (informers.SharedInformerFactory, ktesting.TContext) {
@ -898,8 +896,10 @@ func setupTestCase(t testing.TB, tc *testCase, output io.Writer, outOfTreePlugin
// RunBenchmarkPerfScheduling runs the scheduler performance tests. // RunBenchmarkPerfScheduling runs the scheduler performance tests.
// //
// You can pass your own scheduler plugins via outOfTreePluginRegistry. // You can pass your own scheduler plugins via outOfTreePluginRegistry.
// Also, you may want to put your plugins in PluginNames variable in this package. // Also, you may want to put your plugins in PluginNames variable in this package
func RunBenchmarkPerfScheduling(b *testing.B, outOfTreePluginRegistry frameworkruntime.Registry) { // to collect metrics for them.
// testcaseLabelSelectors is available to select specific test cases to run with labels on them.
func RunBenchmarkPerfScheduling(b *testing.B, outOfTreePluginRegistry frameworkruntime.Registry, testcaseLabelSelectors []string) {
testCases, err := getTestCases(configFile) testCases, err := getTestCases(configFile)
if err != nil { if err != nil {
b.Fatal(err) b.Fatal(err)
@ -923,8 +923,8 @@ func RunBenchmarkPerfScheduling(b *testing.B, outOfTreePluginRegistry frameworkr
b.Run(tc.Name, func(b *testing.B) { b.Run(tc.Name, func(b *testing.B) {
for _, w := range tc.Workloads { for _, w := range tc.Workloads {
b.Run(w.Name, func(b *testing.B) { b.Run(w.Name, func(b *testing.B) {
if !enabled(*perfSchedulingLabelFilter, append(tc.Labels, w.Labels...)...) { if !enabled(testcaseLabelSelectors, append(tc.Labels, w.Labels...)...) {
b.Skipf("disabled by label filter %q", *perfSchedulingLabelFilter) b.Skipf("disabled by label filter %v", testcaseLabelSelectors)
} }
informerFactory, tCtx := setupTestCase(b, tc, output, outOfTreePluginRegistry) informerFactory, tCtx := setupTestCase(b, tc, output, outOfTreePluginRegistry)
@ -974,8 +974,6 @@ func RunBenchmarkPerfScheduling(b *testing.B, outOfTreePluginRegistry frameworkr
} }
} }
var testSchedulingLabelFilter = flag.String("test-scheduling-label-filter", "integration-test", "comma-separated list of labels which a testcase must have (no prefix or +) or must not have (-), used by TestScheduling")
func loadSchedulerConfig(file string) (*config.KubeSchedulerConfiguration, error) { func loadSchedulerConfig(file string) (*config.KubeSchedulerConfiguration, error) {
data, err := os.ReadFile(file) data, err := os.ReadFile(file)
if err != nil { if err != nil {

View File

@ -19,11 +19,19 @@ limitations under the License.
package benchmark_test package benchmark_test
import ( import (
"flag"
"strings"
"testing" "testing"
benchmark "k8s.io/kubernetes/test/integration/scheduler_perf" benchmark "k8s.io/kubernetes/test/integration/scheduler_perf"
) )
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 (-), used by BenchmarkPerfScheduling")
func BenchmarkPerfScheduling(b *testing.B) { func BenchmarkPerfScheduling(b *testing.B) {
benchmark.RunBenchmarkPerfScheduling(b, nil) if testing.Short() {
*perfSchedulingLabelFilter += ",+short"
}
benchmark.RunBenchmarkPerfScheduling(b, nil, strings.Split(*perfSchedulingLabelFilter, ","))
} }

View File

@ -17,12 +17,16 @@ limitations under the License.
package benchmark package benchmark
import ( import (
"flag"
"strings"
"testing" "testing"
"k8s.io/component-base/metrics/legacyregistry" "k8s.io/component-base/metrics/legacyregistry"
"k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/features"
) )
var testSchedulingLabelFilter = flag.String("test-scheduling-label-filter", "integration-test,-performance", "comma-separated list of labels which a testcase must have (no prefix or +) or must not have (-), used by TestScheduling")
func TestScheduling(t *testing.T) { func TestScheduling(t *testing.T) {
testCases, err := getTestCases(configFile) testCases, err := getTestCases(configFile)
if err != nil { if err != nil {
@ -40,7 +44,7 @@ func TestScheduling(t *testing.T) {
t.Run(tc.Name, func(t *testing.T) { t.Run(tc.Name, func(t *testing.T) {
for _, w := range tc.Workloads { for _, w := range tc.Workloads {
t.Run(w.Name, func(t *testing.T) { t.Run(w.Name, func(t *testing.T) {
if !enabled(*testSchedulingLabelFilter, append(tc.Labels, w.Labels...)...) { if !enabled(strings.Split(*testSchedulingLabelFilter, ","), append(tc.Labels, w.Labels...)...) {
t.Skipf("disabled by label filter %q", *testSchedulingLabelFilter) t.Skipf("disabled by label filter %q", *testSchedulingLabelFilter)
} }
informerFactory, tCtx := setupTestCase(t, tc, nil, nil) informerFactory, tCtx := setupTestCase(t, tc, nil, nil)