mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
return error with non-unique workload name in scheduler_perf_test
This commit is contained in:
parent
338b06fb69
commit
0e994e9481
@ -111,15 +111,15 @@ func (tc *testCase) collectsMetrics() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (tc *testCase) workloadNamesUnique() bool {
|
||||
func (tc *testCase) workloadNamesUnique() error {
|
||||
workloadUniqueNames := map[string]bool{}
|
||||
for _, w := range tc.Workloads {
|
||||
if workloadUniqueNames[w.Name] {
|
||||
return false
|
||||
return fmt.Errorf("%s: workload name %s is not unique", tc.Name, w.Name)
|
||||
}
|
||||
workloadUniqueNames[w.Name] = true
|
||||
}
|
||||
return true
|
||||
return nil
|
||||
}
|
||||
|
||||
// workload is a subtest under a testCase that tests the scheduler performance
|
||||
@ -786,8 +786,8 @@ func validateTestCases(testCases []*testCase) error {
|
||||
if len(tc.Workloads) == 0 {
|
||||
return fmt.Errorf("%s: no workloads defined", tc.Name)
|
||||
}
|
||||
if !tc.workloadNamesUnique() {
|
||||
return fmt.Errorf("%s: workload names are not unique", tc.Name)
|
||||
if err := tc.workloadNamesUnique(); err != nil {
|
||||
return err
|
||||
}
|
||||
if len(tc.WorkloadTemplate) == 0 {
|
||||
return fmt.Errorf("%s: no ops defined", tc.Name)
|
||||
|
Loading…
Reference in New Issue
Block a user