Networkpolicy kind sort (#6266)

* Add NetworkPolicy in kind sorter

Signed-off-by: Christophe GASMI <rekcah78@gmail.com>

* Added NetworkPolicy to sort order test

Signed-off-by: Christophe GASMI <rekcah78@gmail.com>
pull/6309/head
Gasmi Christophe 5 years ago committed by Martin Hickey
parent f8f8b5d076
commit 256765aa74

@ -28,6 +28,7 @@ type SortOrder []string
// Those occurring earlier in the list get installed before those occurring later in the list.
var InstallOrder SortOrder = []string{
"Namespace",
"NetworkPolicy",
"ResourceQuota",
"LimitRange",
"PodSecurityPolicy",
@ -96,6 +97,7 @@ var UninstallOrder SortOrder = []string{
"PodSecurityPolicy",
"LimitRange",
"ResourceQuota",
"NetworkPolicy",
"Namespace",
}

@ -157,6 +157,10 @@ func TestKindSorter(t *testing.T) {
Name: "x",
Head: &util.SimpleHead{Kind: "HorizontalPodAutoscaler"},
},
{
Name: "B",
Head: &util.SimpleHead{Kind: "NetworkPolicy"},
},
}
for _, test := range []struct {
@ -164,8 +168,8 @@ func TestKindSorter(t *testing.T) {
order SortOrder
expected string
}{
{"install", InstallOrder, "abc3zde1fgh2iIjJkKlLmnopqrxstuvw!"},
{"uninstall", UninstallOrder, "wvmutsxrqponLlKkJjIi2hgf1edz3cba!"},
{"install", InstallOrder, "aBbc3zde1fgh2iIjJkKlLmnopqrxstuvw!"},
{"uninstall", UninstallOrder, "wvmutsxrqponLlKkJjIi2hgf1edz3cbBa!"},
} {
var buf bytes.Buffer
t.Run(test.description, func(t *testing.T) {

Loading…
Cancel
Save