Commit df30c4ab authored by Matt Butcher's avatar Matt Butcher Committed by GitHub

Merge pull request #1315 from technosophos/fix/1313-sort-manifestsw

fix(tiller): correct sort manifests by type
parents 5ed4dd4d a85c37f2
...@@ -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