Skip to content

Commit

Permalink
Fix missing NAMESPACE column header (knative#951)
Browse files Browse the repository at this point in the history
* Fix missing NAMESPACE column header

* Fix missing namespace column header for 'kn source list -A'
  • Loading branch information
Kaustubh-pande authored and navidshaikh committed Aug 18, 2020
1 parent fa1183e commit e0df5f1
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@
| https://github.com/knative/client/pull/[#]
////

## Unreleased

[cols="1,10,3", options="header", width="100%"]
|===
| | Description | PR

| 🎁
| Add support to combine service create --filename with other options
| https://github.com/knative/client/pull/937[#937]

| 🎁
| Fix Missing NAMESPACE column header for 'kn source list -A'
| https://github.com/knative/client/pull/951[#951]

|===

## v0.16.0 (2020-07-14)

[cols="1,10,3", options="header", width="100%"]
Expand Down
1 change: 1 addition & 0 deletions pkg/kn/commands/source/human_readable_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func ListTypesHandlers(h printers.PrintHandler) {
// ListHandlers handles printing human readable table for `kn source list`
func ListHandlers(h printers.PrintHandler) {
sourceListColumnDefinitions := []metav1beta1.TableColumnDefinition{
{Name: "Namespace", Type: "string", Description: "Namespace of the source", Priority: 0},
{Name: "Name", Type: "string", Description: "Name of the created source", Priority: 1},
{Name: "Type", Type: "string", Description: "Type of the source", Priority: 1},
{Name: "Resource", Type: "string", Description: "Source type name", Priority: 1},
Expand Down
16 changes: 16 additions & 0 deletions pkg/kn/commands/source/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,19 @@ func newSourceUnstructuredObj(name, apiVersion, kind string) *unstructured.Unstr
},
}
}

func TestSourceListAllNamespace(t *testing.T) {
output, err := sourceFakeCmd([]string{"source", "list", "--all-namespaces"},
newSourceCRDObjWithSpec("pingsources", "sources.knative.dev", "v1alpha1", "PingSource"),
newSourceCRDObjWithSpec("sinkbindings", "sources.knative.dev", "v1alpha1", "SinkBinding"),
newSourceCRDObjWithSpec("apiserversources", "sources.knative.dev", "v1alpha1", "ApiServerSource"),
newSourceUnstructuredObj("p1", "sources.knative.dev/v1alpha1", "PingSource"),
newSourceUnstructuredObj("s1", "sources.knative.dev/v1alpha1", "SinkBinding"),
newSourceUnstructuredObj("a1", "sources.knative.dev/v1alpha1", "ApiServerSource"),
)
assert.NilError(t, err)
assert.Check(t, util.ContainsAll(output[0], "NAMESPACE", "NAME", "TYPE", "RESOURCE", "SINK", "READY"))
assert.Check(t, util.ContainsAll(output[1], "current", "a1", "ApiServerSource", "apiserversources.sources.knative.dev", "ksvc:foo", "True"))
assert.Check(t, util.ContainsAll(output[2], "current", "p1", "PingSource", "pingsources.sources.knative.dev", "ksvc:foo", "True"))
assert.Check(t, util.ContainsAll(output[3], "current", "s1", "SinkBinding", "sinkbindings.sources.knative.dev", "ksvc:foo", "True"))
}

0 comments on commit e0df5f1

Please sign in to comment.