Skip to content

Commit d308378

Browse files
Fixed column validation with KeyifyHeader (#1525)
Signed-off-by: rcmadhankumar <[email protected]>
1 parent 395574c commit d308378

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

cli/pkg/kctrl/cmd/core/print_table.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func validateColumns(headers *[]uitable.Header, cols *[]string) error {
1616
for _, col := range *cols {
1717
found := false
1818
for _, head := range *headers {
19-
if col == head.Key || col == head.Title {
19+
if uitable.KeyifyHeader(col) == head.Key || col == head.Title {
2020
found = true
2121
break
2222
}

cli/test/e2e/package_available_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,16 @@ spec:
140140
require.Exactly(t, expectedOutputRows, output.Tables[0].Rows)
141141
})
142142

143+
logger.Section("listing packages with column names in mixed cases", func() {
144+
out := kappCtrl.Run([]string{"package", "available", "list", "--json", "--column=nAMe,NameSpace"})
145+
output := uitest.JSONUIFromBytes(t, []byte(out))
146+
expectedOutputRows := []map[string]string{{
147+
"name": packageName,
148+
"namespace": env.Namespace,
149+
}}
150+
require.Exactly(t, expectedOutputRows, output.Tables[0].Rows)
151+
})
152+
143153
logger.Section("listing packages with non existing column names", func() {
144154
_, err := kappCtrl.RunWithOpts([]string{"package", "available", "list", "--json", "--column=name,invalid,namespace,ns"}, RunOpts{
145155
AllowError: true,

0 commit comments

Comments
 (0)