Always returns items sorted by Name

Keeps tests deterministic, seems to be an assumption in the k8s API
also.
This commit is contained in:
Justin Santa Barbara 2016-12-18 14:00:43 -05:00
parent 9e546d7fe0
commit fca2bccd49
1 changed files with 5 additions and 0 deletions

View File

@ -27,6 +27,7 @@ import (
"k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/runtime"
"os" "os"
"reflect" "reflect"
"sort"
"time" "time"
) )
@ -196,6 +197,10 @@ func (c *commonVFS) listNames() ([]string, error) {
if err != nil { if err != nil {
return nil, fmt.Errorf("error listing %s in state store: %v", c.kind, err) return nil, fmt.Errorf("error listing %s in state store: %v", c.kind, err)
} }
// Seems to be an assumption in k8s APIs that items are always returned sorted
sort.Strings(keys)
return keys, nil return keys, nil
} }