return error with non-unique workload name in scheduler_perf_test

This commit is contained in:
Nicolas Mitchell 2021-04-06 10:24:04 -04:00
parent 338b06fb69
commit 0e994e9481

View File

@ -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)