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
commit 10b1b83893
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 85 additions and 85 deletions

View File

@ -171,7 +171,7 @@ func (test getContextsTest) run(t *testing.T) {
cmd.Run(cmd, test.names) cmd.Run(cmd, test.names)
if len(test.expectedOut) != 0 { if len(test.expectedOut) != 0 {
if buf.String() != test.expectedOut { if buf.String() != test.expectedOut {
t.Errorf("Expected %v, but got %v", test.expectedOut, buf.String()) t.Errorf("Expected\n%s\ngot\n%s", test.expectedOut, buf.String())
} }
return return
} }

View File

@ -266,7 +266,7 @@ func TestGetObjectsWithOpenAPIOutputFormatPresent(t *testing.T) {
foo 10 foo 10
` `
if e, a := expected, buf.String(); e != a { 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)
} }
} }
@ -318,7 +318,7 @@ func TestGetObjects(t *testing.T) {
foo 0/0 0 <unknown> foo 0/0 0 <unknown>
` `
if e, a := expected, buf.String(); e != a { 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)
} }
} }
@ -344,7 +344,7 @@ func TestGetObjectsShowKind(t *testing.T) {
pod/foo 0/0 0 <unknown> pod/foo 0/0 0 <unknown>
` `
if e, a := expected, buf.String(); e != a { 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)
} }
} }
@ -403,7 +403,7 @@ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/baz ClusterIP <none> <none> <none> <unknown> service/baz ClusterIP <none> <none> <none> <unknown>
` `
if e, a := expected, buf.String(); e != a { 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)
} }
} }
@ -429,7 +429,7 @@ func TestGetObjectsShowLabels(t *testing.T) {
foo 0/0 0 <unknown> <none> foo 0/0 0 <unknown> <none>
` `
if e, a := expected, buf.String(); e != a { 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)
} }
} }
@ -524,7 +524,7 @@ b 0/0 0 <unknown>
c 0/0 0 <unknown> c 0/0 0 <unknown>
` `
if e, a := expected, buf.String(); e != a { 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)
} }
} }
@ -694,7 +694,7 @@ func TestGetObjectsIdentifiedByFile(t *testing.T) {
foo 0/0 0 <unknown> foo 0/0 0 <unknown>
` `
if e, a := expected, buf.String(); e != a { 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)
} }
} }
@ -720,7 +720,7 @@ foo 0/0 0 <unknown>
bar 0/0 0 <unknown> bar 0/0 0 <unknown>
` `
if e, a := expected, buf.String(); e != a { 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 serverunknown Unhealthy fizzbuzz error
` `
if e, a := expected, buf.String(); e != a { 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 { 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)
} }
} }
@ -847,7 +847,7 @@ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/baz ClusterIP <none> <none> <none> <unknown> service/baz ClusterIP <none> <none> <none> <unknown>
` `
if e, a := expected, buf.String(); e != a { 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)
} }
} }
@ -989,7 +989,7 @@ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/baz ClusterIP <none> <none> <none> <unknown> service/baz ClusterIP <none> <none> <none> <unknown>
` `
if e, a := expected, buf.String(); e != a { 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)
} }
} }
@ -1032,7 +1032,7 @@ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/baz ClusterIP <none> <none> <none> <unknown> service/baz ClusterIP <none> <none> <none> <unknown>
` `
if e, a := expected, buf.String(); e != a { 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)
} }
} }
@ -1075,7 +1075,7 @@ NAME STATUS ROLES AGE VERSION
node/foo Unknown <none> <unknown> node/foo Unknown <none> <unknown>
` `
if e, a := expected, buf.String(); e != a { 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)
} }
} }
@ -1196,7 +1196,7 @@ foo 0/0 0 <unknown>
foo 0/0 0 <unknown> foo 0/0 0 <unknown>
` `
if e, a := expected, buf.String(); e != a { 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)
} }
} }
@ -1247,7 +1247,7 @@ foo 0/0 0 <unknown>
foo 0/0 0 <unknown> foo 0/0 0 <unknown>
` `
if e, a := expected, buf.String(); e != a { 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)
} }
} }
@ -1290,7 +1290,7 @@ foo 0/0 0 <unknown>
foo 0/0 0 <unknown> foo 0/0 0 <unknown>
` `
if e, a := expected, buf.String(); e != a { 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)
} }
} }
@ -1334,7 +1334,7 @@ foo 0/0 0 <unknown>
foo 0/0 0 <unknown> foo 0/0 0 <unknown>
` `
if e, a := expected, buf.String(); e != a { 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)
} }
} }
@ -1376,7 +1376,7 @@ foo 0/0 0 <unknown>
foo 0/0 0 <unknown> foo 0/0 0 <unknown>
` `
if e, a := expected, buf.String(); e != a { 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)
} }
} }
@ -1421,7 +1421,7 @@ foo 0/0 0 <unknown>
foo 0/0 0 <unknown> foo 0/0 0 <unknown>
` `
if e, a := expected, buf.String(); e != a { 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)
} }
} }

View File

@ -22,7 +22,7 @@ import (
) )
const ( const (
tabwriterMinWidth = 10 tabwriterMinWidth = 6
tabwriterWidth = 4 tabwriterWidth = 4
tabwriterPadding = 3 tabwriterPadding = 3
tabwriterPadChar = ' ' tabwriterPadChar = ' '