mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-05 19:21:37 +00:00
Merge pull request #100808 from nicomitchell/scheduler_perf_tests_unique_names
test/integration/scheduler_perf: make sure each testCase and workload has a unique name
This commit is contained in:
@@ -111,6 +111,17 @@ func (tc *testCase) collectsMetrics() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (tc *testCase) workloadNamesUnique() error {
|
||||
workloadUniqueNames := map[string]bool{}
|
||||
for _, w := range tc.Workloads {
|
||||
if workloadUniqueNames[w.Name] {
|
||||
return fmt.Errorf("%s: workload name %s is not unique", tc.Name, w.Name)
|
||||
}
|
||||
workloadUniqueNames[w.Name] = true
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// workload is a subtest under a testCase that tests the scheduler performance
|
||||
// for a certain ordering of ops. The set of nodes created and pods scheduled
|
||||
// in a workload may be heterogeneous.
|
||||
@@ -766,10 +777,18 @@ func validateTestCases(testCases []*testCase) error {
|
||||
if len(testCases) == 0 {
|
||||
return fmt.Errorf("no test cases defined")
|
||||
}
|
||||
testCaseUniqueNames := map[string]bool{}
|
||||
for _, tc := range testCases {
|
||||
if testCaseUniqueNames[tc.Name] {
|
||||
return fmt.Errorf("%s: name is not unique", tc.Name)
|
||||
}
|
||||
testCaseUniqueNames[tc.Name] = true
|
||||
if len(tc.Workloads) == 0 {
|
||||
return fmt.Errorf("%s: no workloads defined", tc.Name)
|
||||
}
|
||||
if err := tc.workloadNamesUnique(); err != nil {
|
||||
return err
|
||||
}
|
||||
if len(tc.WorkloadTemplate) == 0 {
|
||||
return fmt.Errorf("%s: no ops defined", tc.Name)
|
||||
}
|
||||
|
Reference in New Issue
Block a user