Commit a85c37f2 authored by Matt Butcher's avatar Matt Butcher

fix(tiller): correct sort manifests by type

Closes #1313
parent 31d51a79
...@@ -165,5 +165,5 @@ func sortManifests(files map[string]string, apis versionSet, sort SortOrder) ([] ...@@ -165,5 +165,5 @@ func sortManifests(files map[string]string, apis versionSet, sort SortOrder) ([]
} }
hs = append(hs, h) hs = append(hs, h)
} }
return hs, generic, nil return hs, sortByKind(generic, sort), nil
} }
...@@ -19,6 +19,8 @@ package main ...@@ -19,6 +19,8 @@ package main
import ( import (
"testing" "testing"
"github.com/ghodss/yaml"
"k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/proto/hapi/release"
) )
...@@ -156,6 +158,28 @@ metadata: ...@@ -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) { func TestVersionSet(t *testing.T) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment