Merge pull request #67965 from smarterclayton/slim_output

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

Reduce the minwidth of the cli table printer

For a few columns we want to have a smaller width and 10 is excessive. The example is CPU and memory for nodes.
This commit is contained in:
Kubernetes Submit Queue
2018-09-01 00:24:59 -07:00
committed by GitHub
4 changed files with 85 additions and 85 deletions

View File

@@ -262,11 +262,11 @@ func TestGetObjectsWithOpenAPIOutputFormatPresent(t *testing.T) {
cmd.Flags().Set(useOpenAPIPrintColumnFlagLabel, "true")
cmd.Run(cmd, []string{"pods", "foo"})
expected := `NAME RSRC
foo 10
expected := `NAME RSRC
foo 10
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}
@@ -314,11 +314,11 @@ func TestGetObjects(t *testing.T) {
cmd.SetOutput(buf)
cmd.Run(cmd, []string{"pods", "foo"})
expected := `NAME READY STATUS RESTARTS AGE
foo 0/0 0 <unknown>
expected := `NAME READY STATUS RESTARTS AGE
foo 0/0 0 <unknown>
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}
@@ -340,11 +340,11 @@ func TestGetObjectsShowKind(t *testing.T) {
cmd.Flags().Set("show-kind", "true")
cmd.Run(cmd, []string{"pods", "foo"})
expected := `NAME READY STATUS RESTARTS AGE
pod/foo 0/0 0 <unknown>
expected := `NAME READY STATUS RESTARTS AGE
pod/foo 0/0 0 <unknown>
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}
@@ -396,14 +396,14 @@ func TestGetMultipleResourceTypesShowKinds(t *testing.T) {
cmd.SetOutput(buf)
cmd.Run(cmd, []string{"all"})
expected := `NAME READY STATUS RESTARTS AGE
pod/foo 0/0 0 <unknown>
pod/bar 0/0 0 <unknown>
expected := `NAME READY STATUS RESTARTS AGE
pod/foo 0/0 0 <unknown>
pod/bar 0/0 0 <unknown>
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/baz ClusterIP <none> <none> <none> <unknown>
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}
@@ -425,11 +425,11 @@ func TestGetObjectsShowLabels(t *testing.T) {
cmd.Flags().Set("show-labels", "true")
cmd.Run(cmd, []string{"pods", "foo"})
expected := `NAME READY STATUS RESTARTS AGE LABELS
foo 0/0 0 <unknown> <none>
expected := `NAME READY STATUS RESTARTS AGE LABELS
foo 0/0 0 <unknown> <none>
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}
@@ -518,13 +518,13 @@ func TestGetSortedObjects(t *testing.T) {
cmd.Flags().Set("sort-by", ".metadata.name")
cmd.Run(cmd, []string{"pods"})
expected := `NAME READY STATUS RESTARTS AGE
a 0/0 0 <unknown>
b 0/0 0 <unknown>
c 0/0 0 <unknown>
expected := `NAME READY STATUS RESTARTS AGE
a 0/0 0 <unknown>
b 0/0 0 <unknown>
c 0/0 0 <unknown>
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}
@@ -690,11 +690,11 @@ func TestGetObjectsIdentifiedByFile(t *testing.T) {
cmd.Flags().Set("filename", "../../../../test/e2e/testing-manifests/statefulset/cassandra/controller.yaml")
cmd.Run(cmd, []string{})
expected := `NAME READY STATUS RESTARTS AGE
foo 0/0 0 <unknown>
expected := `NAME READY STATUS RESTARTS AGE
foo 0/0 0 <unknown>
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}
@@ -715,12 +715,12 @@ func TestGetListObjects(t *testing.T) {
cmd.SetOutput(buf)
cmd.Run(cmd, []string{"pods"})
expected := `NAME READY STATUS RESTARTS AGE
foo 0/0 0 <unknown>
bar 0/0 0 <unknown>
expected := `NAME READY STATUS RESTARTS AGE
foo 0/0 0 <unknown>
bar 0/0 0 <unknown>
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}
@@ -747,7 +747,7 @@ serverbad Unhealthy bad status: 500
serverunknown Unhealthy fizzbuzz error
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}
@@ -809,7 +809,7 @@ func TestGetMixedGenericObjects(t *testing.T) {
}
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}
@@ -840,14 +840,14 @@ func TestGetMultipleTypeObjects(t *testing.T) {
cmd.SetOutput(buf)
cmd.Run(cmd, []string{"pods,services"})
expected := `NAME READY STATUS RESTARTS AGE
pod/foo 0/0 0 <unknown>
pod/bar 0/0 0 <unknown>
expected := `NAME READY STATUS RESTARTS AGE
pod/foo 0/0 0 <unknown>
pod/bar 0/0 0 <unknown>
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/baz ClusterIP <none> <none> <none> <unknown>
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}
@@ -982,14 +982,14 @@ func TestGetMultipleTypeObjectsWithLabelSelector(t *testing.T) {
cmd.Flags().Set("selector", "a=b")
cmd.Run(cmd, []string{"pods,services"})
expected := `NAME READY STATUS RESTARTS AGE
pod/foo 0/0 0 <unknown>
pod/bar 0/0 0 <unknown>
expected := `NAME READY STATUS RESTARTS AGE
pod/foo 0/0 0 <unknown>
pod/bar 0/0 0 <unknown>
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/baz ClusterIP <none> <none> <none> <unknown>
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}
@@ -1025,14 +1025,14 @@ func TestGetMultipleTypeObjectsWithFieldSelector(t *testing.T) {
cmd.Flags().Set("field-selector", "a=b")
cmd.Run(cmd, []string{"pods,services"})
expected := `NAME READY STATUS RESTARTS AGE
pod/foo 0/0 0 <unknown>
pod/bar 0/0 0 <unknown>
expected := `NAME READY STATUS RESTARTS AGE
pod/foo 0/0 0 <unknown>
pod/bar 0/0 0 <unknown>
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/baz ClusterIP <none> <none> <none> <unknown>
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}
@@ -1071,11 +1071,11 @@ func TestGetMultipleTypeObjectsWithDirectReference(t *testing.T) {
expected := `NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/baz ClusterIP <none> <none> <none> <unknown>
NAME STATUS ROLES AGE VERSION
node/foo Unknown <none> <unknown>
NAME STATUS ROLES AGE VERSION
node/foo Unknown <none> <unknown>
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}
@@ -1189,14 +1189,14 @@ func TestWatchLabelSelector(t *testing.T) {
cmd.Flags().Set("selector", "a=b")
cmd.Run(cmd, []string{"pods"})
expected := `NAME READY STATUS RESTARTS AGE
bar 0/0 0 <unknown>
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
expected := `NAME READY STATUS RESTARTS AGE
bar 0/0 0 <unknown>
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}
@@ -1240,14 +1240,14 @@ func TestWatchFieldSelector(t *testing.T) {
cmd.Flags().Set("field-selector", "a=b")
cmd.Run(cmd, []string{"pods"})
expected := `NAME READY STATUS RESTARTS AGE
bar 0/0 0 <unknown>
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
expected := `NAME READY STATUS RESTARTS AGE
bar 0/0 0 <unknown>
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}
@@ -1284,13 +1284,13 @@ func TestWatchResource(t *testing.T) {
cmd.Flags().Set("watch", "true")
cmd.Run(cmd, []string{"pods", "foo"})
expected := `NAME READY STATUS RESTARTS AGE
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
expected := `NAME READY STATUS RESTARTS AGE
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}
@@ -1328,13 +1328,13 @@ func TestWatchResourceIdentifiedByFile(t *testing.T) {
cmd.Flags().Set("filename", "../../../../test/e2e/testing-manifests/statefulset/cassandra/controller.yaml")
cmd.Run(cmd, []string{})
expected := `NAME READY STATUS RESTARTS AGE
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
expected := `NAME READY STATUS RESTARTS AGE
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}
@@ -1371,12 +1371,12 @@ func TestWatchOnlyResource(t *testing.T) {
cmd.Flags().Set("watch-only", "true")
cmd.Run(cmd, []string{"pods", "foo"})
expected := `NAME READY STATUS RESTARTS AGE
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
expected := `NAME READY STATUS RESTARTS AGE
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}
@@ -1416,12 +1416,12 @@ func TestWatchOnlyList(t *testing.T) {
cmd.Flags().Set("watch-only", "true")
cmd.Run(cmd, []string{"pods"})
expected := `NAME READY STATUS RESTARTS AGE
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
expected := `NAME READY STATUS RESTARTS AGE
foo 0/0 0 <unknown>
foo 0/0 0 <unknown>
`
if e, a := expected, buf.String(); e != a {
t.Errorf("expected %v, got %v", e, a)
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
}