Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
02099f44
Unverified
Commit
02099f44
authored
Aug 28, 2018
by
Clayton Coleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce the minwidth of the cli table printer
For a few columns we want to have a smaller width and 10 is excessive.
parent
2548fb08
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
85 deletions
+85
-85
get_contexts_test.go
pkg/kubectl/cmd/config/get_contexts_test.go
+2
-2
get_test.go
pkg/kubectl/cmd/get/get_test.go
+75
-75
customcolumn_test.go
pkg/printers/customcolumn_test.go
+7
-7
tabwriter.go
pkg/printers/tabwriter.go
+1
-1
No files found.
pkg/kubectl/cmd/config/get_contexts_test.go
View file @
02099f44
...
@@ -61,7 +61,7 @@ func TestGetContextsAllNoHeader(t *testing.T) {
...
@@ -61,7 +61,7 @@ func TestGetContextsAllNoHeader(t *testing.T) {
names
:
[]
string
{},
names
:
[]
string
{},
noHeader
:
true
,
noHeader
:
true
,
nameOnly
:
false
,
nameOnly
:
false
,
expectedOut
:
"*
shaker-context big-cluster blue-user saw-ns
\n
"
,
expectedOut
:
"* shaker-context big-cluster blue-user saw-ns
\n
"
,
}
}
test
.
run
(
t
)
test
.
run
(
t
)
}
}
...
@@ -171,7 +171,7 @@ func (test getContextsTest) run(t *testing.T) {
...
@@ -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
\n
got
\n
%s
"
,
test
.
expectedOut
,
buf
.
String
())
}
}
return
return
}
}
...
...
pkg/kubectl/cmd/get/get_test.go
View file @
02099f44
...
@@ -260,11 +260,11 @@ func TestGetObjectsWithOpenAPIOutputFormatPresent(t *testing.T) {
...
@@ -260,11 +260,11 @@ func TestGetObjectsWithOpenAPIOutputFormatPresent(t *testing.T) {
cmd
.
Flags
()
.
Set
(
useOpenAPIPrintColumnFlagLabel
,
"true"
)
cmd
.
Flags
()
.
Set
(
useOpenAPIPrintColumnFlagLabel
,
"true"
)
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
,
"foo"
})
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
,
"foo"
})
expected
:=
`NAME
RSRC
expected
:=
`NAME RSRC
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
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
@@ -312,11 +312,11 @@ func TestGetObjects(t *testing.T) {
...
@@ -312,11 +312,11 @@ func TestGetObjects(t *testing.T) {
cmd
.
SetOutput
(
buf
)
cmd
.
SetOutput
(
buf
)
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
,
"foo"
})
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
,
"foo"
})
expected
:=
`NAME
READY STATUS
RESTARTS AGE
expected
:=
`NAME
READY STATUS
RESTARTS AGE
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
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
@@ -338,11 +338,11 @@ func TestGetObjectsShowKind(t *testing.T) {
...
@@ -338,11 +338,11 @@ func TestGetObjectsShowKind(t *testing.T) {
cmd
.
Flags
()
.
Set
(
"show-kind"
,
"true"
)
cmd
.
Flags
()
.
Set
(
"show-kind"
,
"true"
)
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
,
"foo"
})
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
,
"foo"
})
expected
:=
`NAME READY
STATUS
RESTARTS AGE
expected
:=
`NAME READY
STATUS
RESTARTS AGE
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
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
@@ -394,14 +394,14 @@ func TestGetMultipleResourceTypesShowKinds(t *testing.T) {
...
@@ -394,14 +394,14 @@ func TestGetMultipleResourceTypesShowKinds(t *testing.T) {
cmd
.
SetOutput
(
buf
)
cmd
.
SetOutput
(
buf
)
cmd
.
Run
(
cmd
,
[]
string
{
"all"
})
cmd
.
Run
(
cmd
,
[]
string
{
"all"
})
expected
:=
`NAME READY
STATUS
RESTARTS AGE
expected
:=
`NAME READY
STATUS
RESTARTS AGE
pod/foo 0/0
0 <unknown>
pod/foo 0/0 0 <unknown>
pod/bar 0/0
0 <unknown>
pod/bar 0/0 0 <unknown>
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
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
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
@@ -423,11 +423,11 @@ func TestGetObjectsShowLabels(t *testing.T) {
...
@@ -423,11 +423,11 @@ func TestGetObjectsShowLabels(t *testing.T) {
cmd
.
Flags
()
.
Set
(
"show-labels"
,
"true"
)
cmd
.
Flags
()
.
Set
(
"show-labels"
,
"true"
)
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
,
"foo"
})
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
,
"foo"
})
expected
:=
`NAME
READY STATUS
RESTARTS AGE LABELS
expected
:=
`NAME
READY STATUS
RESTARTS AGE LABELS
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
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
@@ -516,13 +516,13 @@ func TestGetSortedObjects(t *testing.T) {
...
@@ -516,13 +516,13 @@ func TestGetSortedObjects(t *testing.T) {
cmd
.
Flags
()
.
Set
(
"sort-by"
,
".metadata.name"
)
cmd
.
Flags
()
.
Set
(
"sort-by"
,
".metadata.name"
)
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
})
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
})
expected
:=
`NAME
READY STATUS
RESTARTS AGE
expected
:=
`NAME
READY STATUS
RESTARTS AGE
a
0/0
0 <unknown>
a
0/0
0 <unknown>
b
0/0
0 <unknown>
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
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
@@ -544,11 +544,11 @@ func TestGetObjectsIdentifiedByFile(t *testing.T) {
...
@@ -544,11 +544,11 @@ func TestGetObjectsIdentifiedByFile(t *testing.T) {
cmd
.
Flags
()
.
Set
(
"filename"
,
"../../../../test/e2e/testing-manifests/statefulset/cassandra/controller.yaml"
)
cmd
.
Flags
()
.
Set
(
"filename"
,
"../../../../test/e2e/testing-manifests/statefulset/cassandra/controller.yaml"
)
cmd
.
Run
(
cmd
,
[]
string
{})
cmd
.
Run
(
cmd
,
[]
string
{})
expected
:=
`NAME
READY STATUS
RESTARTS AGE
expected
:=
`NAME
READY STATUS
RESTARTS AGE
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
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
@@ -569,12 +569,12 @@ func TestGetListObjects(t *testing.T) {
...
@@ -569,12 +569,12 @@ func TestGetListObjects(t *testing.T) {
cmd
.
SetOutput
(
buf
)
cmd
.
SetOutput
(
buf
)
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
})
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
})
expected
:=
`NAME
READY STATUS
RESTARTS AGE
expected
:=
`NAME
READY STATUS
RESTARTS AGE
foo
0/0
0 <unknown>
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
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
@@ -601,7 +601,7 @@ serverbad Unhealthy bad status: 500
...
@@ -601,7 +601,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
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
@@ -663,7 +663,7 @@ func TestGetMixedGenericObjects(t *testing.T) {
...
@@ -663,7 +663,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
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
@@ -694,14 +694,14 @@ func TestGetMultipleTypeObjects(t *testing.T) {
...
@@ -694,14 +694,14 @@ func TestGetMultipleTypeObjects(t *testing.T) {
cmd
.
SetOutput
(
buf
)
cmd
.
SetOutput
(
buf
)
cmd
.
Run
(
cmd
,
[]
string
{
"pods,services"
})
cmd
.
Run
(
cmd
,
[]
string
{
"pods,services"
})
expected
:=
`NAME READY
STATUS
RESTARTS AGE
expected
:=
`NAME READY
STATUS
RESTARTS AGE
pod/foo 0/0
0 <unknown>
pod/foo 0/0 0 <unknown>
pod/bar 0/0
0 <unknown>
pod/bar 0/0 0 <unknown>
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
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
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
@@ -836,14 +836,14 @@ func TestGetMultipleTypeObjectsWithLabelSelector(t *testing.T) {
...
@@ -836,14 +836,14 @@ func TestGetMultipleTypeObjectsWithLabelSelector(t *testing.T) {
cmd
.
Flags
()
.
Set
(
"selector"
,
"a=b"
)
cmd
.
Flags
()
.
Set
(
"selector"
,
"a=b"
)
cmd
.
Run
(
cmd
,
[]
string
{
"pods,services"
})
cmd
.
Run
(
cmd
,
[]
string
{
"pods,services"
})
expected
:=
`NAME READY
STATUS
RESTARTS AGE
expected
:=
`NAME READY
STATUS
RESTARTS AGE
pod/foo 0/0
0 <unknown>
pod/foo 0/0 0 <unknown>
pod/bar 0/0
0 <unknown>
pod/bar 0/0 0 <unknown>
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
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
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
@@ -879,14 +879,14 @@ func TestGetMultipleTypeObjectsWithFieldSelector(t *testing.T) {
...
@@ -879,14 +879,14 @@ func TestGetMultipleTypeObjectsWithFieldSelector(t *testing.T) {
cmd
.
Flags
()
.
Set
(
"field-selector"
,
"a=b"
)
cmd
.
Flags
()
.
Set
(
"field-selector"
,
"a=b"
)
cmd
.
Run
(
cmd
,
[]
string
{
"pods,services"
})
cmd
.
Run
(
cmd
,
[]
string
{
"pods,services"
})
expected
:=
`NAME READY
STATUS
RESTARTS AGE
expected
:=
`NAME READY
STATUS
RESTARTS AGE
pod/foo 0/0
0 <unknown>
pod/foo 0/0 0 <unknown>
pod/bar 0/0
0 <unknown>
pod/bar 0/0 0 <unknown>
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
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
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
@@ -925,11 +925,11 @@ func TestGetMultipleTypeObjectsWithDirectReference(t *testing.T) {
...
@@ -925,11 +925,11 @@ func TestGetMultipleTypeObjectsWithDirectReference(t *testing.T) {
expected
:=
`NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
expected
:=
`NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/baz ClusterIP <none> <none> <none> <unknown>
service/baz ClusterIP <none> <none> <none> <unknown>
NAME STATUS ROLES
AGE VERSION
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
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
@@ -1043,14 +1043,14 @@ func TestWatchLabelSelector(t *testing.T) {
...
@@ -1043,14 +1043,14 @@ func TestWatchLabelSelector(t *testing.T) {
cmd
.
Flags
()
.
Set
(
"selector"
,
"a=b"
)
cmd
.
Flags
()
.
Set
(
"selector"
,
"a=b"
)
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
})
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
})
expected
:=
`NAME
READY STATUS
RESTARTS AGE
expected
:=
`NAME
READY STATUS
RESTARTS AGE
bar
0/0
0 <unknown>
bar
0/0
0 <unknown>
foo
0/0
0 <unknown>
foo
0/0
0 <unknown>
foo
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
{
if
e
,
a
:=
expected
,
buf
.
String
();
e
!=
a
{
t
.
Errorf
(
"expected
%v, got
%v"
,
e
,
a
)
t
.
Errorf
(
"expected
\n
%v
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
@@ -1094,14 +1094,14 @@ func TestWatchFieldSelector(t *testing.T) {
...
@@ -1094,14 +1094,14 @@ func TestWatchFieldSelector(t *testing.T) {
cmd
.
Flags
()
.
Set
(
"field-selector"
,
"a=b"
)
cmd
.
Flags
()
.
Set
(
"field-selector"
,
"a=b"
)
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
})
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
})
expected
:=
`NAME
READY STATUS
RESTARTS AGE
expected
:=
`NAME
READY STATUS
RESTARTS AGE
bar
0/0
0 <unknown>
bar
0/0
0 <unknown>
foo
0/0
0 <unknown>
foo
0/0
0 <unknown>
foo
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
{
if
e
,
a
:=
expected
,
buf
.
String
();
e
!=
a
{
t
.
Errorf
(
"expected
%v, got
%v"
,
e
,
a
)
t
.
Errorf
(
"expected
\n
%v
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
@@ -1138,13 +1138,13 @@ func TestWatchResource(t *testing.T) {
...
@@ -1138,13 +1138,13 @@ func TestWatchResource(t *testing.T) {
cmd
.
Flags
()
.
Set
(
"watch"
,
"true"
)
cmd
.
Flags
()
.
Set
(
"watch"
,
"true"
)
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
,
"foo"
})
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
,
"foo"
})
expected
:=
`NAME
READY STATUS
RESTARTS AGE
expected
:=
`NAME
READY STATUS
RESTARTS AGE
foo
0/0
0 <unknown>
foo
0/0
0 <unknown>
foo
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
{
if
e
,
a
:=
expected
,
buf
.
String
();
e
!=
a
{
t
.
Errorf
(
"expected
%v, got
%v"
,
e
,
a
)
t
.
Errorf
(
"expected
\n
%v
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
@@ -1182,13 +1182,13 @@ func TestWatchResourceIdentifiedByFile(t *testing.T) {
...
@@ -1182,13 +1182,13 @@ func TestWatchResourceIdentifiedByFile(t *testing.T) {
cmd
.
Flags
()
.
Set
(
"filename"
,
"../../../../test/e2e/testing-manifests/statefulset/cassandra/controller.yaml"
)
cmd
.
Flags
()
.
Set
(
"filename"
,
"../../../../test/e2e/testing-manifests/statefulset/cassandra/controller.yaml"
)
cmd
.
Run
(
cmd
,
[]
string
{})
cmd
.
Run
(
cmd
,
[]
string
{})
expected
:=
`NAME
READY STATUS
RESTARTS AGE
expected
:=
`NAME
READY STATUS
RESTARTS AGE
foo
0/0
0 <unknown>
foo
0/0
0 <unknown>
foo
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
{
if
e
,
a
:=
expected
,
buf
.
String
();
e
!=
a
{
t
.
Errorf
(
"expected
%v, got
%v"
,
e
,
a
)
t
.
Errorf
(
"expected
\n
%v
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
@@ -1225,12 +1225,12 @@ func TestWatchOnlyResource(t *testing.T) {
...
@@ -1225,12 +1225,12 @@ func TestWatchOnlyResource(t *testing.T) {
cmd
.
Flags
()
.
Set
(
"watch-only"
,
"true"
)
cmd
.
Flags
()
.
Set
(
"watch-only"
,
"true"
)
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
,
"foo"
})
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
,
"foo"
})
expected
:=
`NAME
READY STATUS
RESTARTS AGE
expected
:=
`NAME
READY STATUS
RESTARTS AGE
foo
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
{
if
e
,
a
:=
expected
,
buf
.
String
();
e
!=
a
{
t
.
Errorf
(
"expected
%v, got
%v"
,
e
,
a
)
t
.
Errorf
(
"expected
\n
%v
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
@@ -1270,12 +1270,12 @@ func TestWatchOnlyList(t *testing.T) {
...
@@ -1270,12 +1270,12 @@ func TestWatchOnlyList(t *testing.T) {
cmd
.
Flags
()
.
Set
(
"watch-only"
,
"true"
)
cmd
.
Flags
()
.
Set
(
"watch-only"
,
"true"
)
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
})
cmd
.
Run
(
cmd
,
[]
string
{
"pods"
})
expected
:=
`NAME
READY STATUS
RESTARTS AGE
expected
:=
`NAME
READY STATUS
RESTARTS AGE
foo
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
{
if
e
,
a
:=
expected
,
buf
.
String
();
e
!=
a
{
t
.
Errorf
(
"expected
%v, got
%v"
,
e
,
a
)
t
.
Errorf
(
"expected
\n
%v
\n
got
\n
%v"
,
e
,
a
)
}
}
}
}
...
...
pkg/printers/customcolumn_test.go
View file @
02099f44
...
@@ -286,8 +286,8 @@ bar
...
@@ -286,8 +286,8 @@ bar
},
},
},
},
obj
:
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"foo"
},
TypeMeta
:
metav1
.
TypeMeta
{
APIVersion
:
"baz"
}},
obj
:
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"foo"
},
TypeMeta
:
metav1
.
TypeMeta
{
APIVersion
:
"baz"
}},
expectedOutput
:
`NAME
API_VERSION
expectedOutput
:
`NAME API_VERSION
foo
baz
foo baz
`
,
`
,
},
},
{
{
...
@@ -306,8 +306,8 @@ foo baz
...
@@ -306,8 +306,8 @@ foo baz
},
},
},
},
obj
:
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"foo"
},
TypeMeta
:
metav1
.
TypeMeta
{
APIVersion
:
"baz"
}},
obj
:
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"foo"
},
TypeMeta
:
metav1
.
TypeMeta
{
APIVersion
:
"baz"
}},
expectedOutput
:
`NAME
API_VERSION NOT_FOUND
expectedOutput
:
`NAME API_VERSION NOT_FOUND
foo
baz <none>
foo baz <none>
`
,
`
,
},
},
}
}
...
@@ -349,9 +349,9 @@ func TestIndividualPrintObjOnExistingTabWriter(t *testing.T) {
...
@@ -349,9 +349,9 @@ func TestIndividualPrintObjOnExistingTabWriter(t *testing.T) {
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"foo"
,
Labels
:
map
[
string
]
string
{
"label1"
:
"foo"
,
"label2"
:
"foo"
}}},
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"foo"
,
Labels
:
map
[
string
]
string
{
"label1"
:
"foo"
,
"label2"
:
"foo"
}}},
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"bar"
,
Labels
:
map
[
string
]
string
{
"label1"
:
"bar"
,
"label2"
:
"bar"
}}},
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"bar"
,
Labels
:
map
[
string
]
string
{
"label1"
:
"bar"
,
"label2"
:
"bar"
}}},
}
}
expectedOutput
:=
`NAME
LONG COLUMN NAME LABEL 2
expectedOutput
:=
`NAME LONG COLUMN NAME LABEL 2
foo
foo foo
foo foo foo
bar
bar bar
bar bar bar
`
`
buffer
:=
&
bytes
.
Buffer
{}
buffer
:=
&
bytes
.
Buffer
{}
...
...
pkg/printers/tabwriter.go
View file @
02099f44
...
@@ -22,7 +22,7 @@ import (
...
@@ -22,7 +22,7 @@ import (
)
)
const
(
const
(
tabwriterMinWidth
=
10
tabwriterMinWidth
=
6
tabwriterWidth
=
4
tabwriterWidth
=
4
tabwriterPadding
=
3
tabwriterPadding
=
3
tabwriterPadChar
=
' '
tabwriterPadChar
=
' '
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment