diff --git a/cmd/tiller/hooks.go b/cmd/tiller/hooks.go index 95e24a203..fab903749 100644 --- a/cmd/tiller/hooks.go +++ b/cmd/tiller/hooks.go @@ -165,5 +165,5 @@ func sortManifests(files map[string]string, apis versionSet, sort SortOrder) ([] } hs = append(hs, h) } - return hs, generic, nil + return hs, sortByKind(generic, sort), nil } diff --git a/cmd/tiller/hooks_test.go b/cmd/tiller/hooks_test.go index b43df6391..9ff4bf533 100644 --- a/cmd/tiller/hooks_test.go +++ b/cmd/tiller/hooks_test.go @@ -19,6 +19,8 @@ package main import ( "testing" + "github.com/ghodss/yaml" + "k8s.io/helm/pkg/proto/hapi/release" ) @@ -156,6 +158,28 @@ metadata: } } + // Verify the sort order + sorted := make([]manifest, len(data)) + for i, s := range data { + var sh simpleHead + err := yaml.Unmarshal([]byte(s.manifest), &sh) + if err != nil { + // This is expected for manifests that are corrupt or empty. + t.Log(err) + } + sorted[i] = manifest{ + content: s.manifest, + name: s.name, + head: &sh, + } + } + sorted = sortByKind(sorted, InstallOrder) + for i, m := range generic { + if m.content != sorted[i].content { + t.Errorf("Expected %q, got %q", m.content, sorted[i].content) + } + } + } func TestVersionSet(t *testing.T) {