Reverting #7266 from the 3.0 release branch and 3.0.3

This fix is dependent on #6842 which is enough of a change to be
considered a feature. Due to the dependency order reverting. The
change will be part of 3.1.0.

Signed-off-by: Matt Farina <matt@mattfarina.com>
release-3.0
Matt Farina 6 years ago
parent cde43f8d9e
commit 140cf9d223
No known key found for this signature in database
GPG Key ID: 9436E80BFBA46909

@ -134,13 +134,12 @@ func (k *kindSorter) Less(i, j int) bool {
b := k.manifests[j] b := k.manifests[j]
first, aok := k.ordering[a.Head.Kind] first, aok := k.ordering[a.Head.Kind]
second, bok := k.ordering[b.Head.Kind] second, bok := k.ordering[b.Head.Kind]
if first == second {
if !aok && !bok { // if both are unknown and of different kind sort by kind alphabetically
// if both are unknown then sort alphabetically by kind, keep original order if same kind if !aok && !bok && a.Head.Kind != b.Head.Kind {
if a.Head.Kind != b.Head.Kind {
return a.Head.Kind < b.Head.Kind return a.Head.Kind < b.Head.Kind
} }
return first < second return a.Name < b.Name
} }
// unknown kind is last // unknown kind is last
if !aok { if !aok {

@ -245,24 +245,3 @@ func TestKindSorterSubSort(t *testing.T) {
}) })
} }
} }
func TestKindSorterNamespaceAgainstUnknown(t *testing.T) {
unknown := Manifest{
Name: "a",
Head: &SimpleHead{Kind: "Unknown"},
}
namespace := Manifest{
Name: "b",
Head: &SimpleHead{Kind: "Namespace"},
}
manifests := []Manifest{unknown, namespace}
sortByKind(manifests, InstallOrder)
expectedOrder := []Manifest{namespace, unknown}
for i, manifest := range manifests {
if expectedOrder[i].Name != manifest.Name {
t.Errorf("Expected %s, got %s", expectedOrder[i].Name, manifest.Name)
}
}
}

Loading…
Cancel
Save