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:
Kubernetes Prow Robot 2021-04-10 19:03:30 -07:00 committed by GitHub
commit 24b40c4d6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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