From fca2bccd49137e589f3980889d9c53f467a0299c Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Sun, 18 Dec 2016 14:00:43 -0500 Subject: [PATCH] Always returns items sorted by Name Keeps tests deterministic, seems to be an assumption in the k8s API also. --- pkg/client/simple/vfsclientset/commonvfs.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/client/simple/vfsclientset/commonvfs.go b/pkg/client/simple/vfsclientset/commonvfs.go index bb548106f3..b62979559f 100644 --- a/pkg/client/simple/vfsclientset/commonvfs.go +++ b/pkg/client/simple/vfsclientset/commonvfs.go @@ -27,6 +27,7 @@ import ( "k8s.io/kubernetes/pkg/runtime" "os" "reflect" + "sort" "time" ) @@ -196,6 +197,10 @@ func (c *commonVFS) listNames() ([]string, error) { if err != nil { 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 }