From e0df5f1b06ebf638a98372c7d8b29346030e8f20 Mon Sep 17 00:00:00 2001 From: kaustubh Date: Tue, 28 Jul 2020 12:18:59 +0530 Subject: [PATCH] Fix missing NAMESPACE column header (#951) * Fix missing NAMESPACE column header * Fix missing namespace column header for 'kn source list -A' --- CHANGELOG.adoc | 16 ++++++++++++++++ pkg/kn/commands/source/human_readable_flags.go | 1 + pkg/kn/commands/source/list_test.go | 16 ++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 0ec5a95d3b..1c681980a8 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -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%"] diff --git a/pkg/kn/commands/source/human_readable_flags.go b/pkg/kn/commands/source/human_readable_flags.go index 2357c88d17..1e74af0ad3 100644 --- a/pkg/kn/commands/source/human_readable_flags.go +++ b/pkg/kn/commands/source/human_readable_flags.go @@ -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}, diff --git a/pkg/kn/commands/source/list_test.go b/pkg/kn/commands/source/list_test.go index 170be23a36..71541d4d23 100644 --- a/pkg/kn/commands/source/list_test.go +++ b/pkg/kn/commands/source/list_test.go @@ -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")) +}