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
e963e4ad
Commit
e963e4ad
authored
Jan 30, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #19866 from liggitt/export_printoptions
Auto commit by PR queue bot
parents
2d061aa1
5a59dac0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
resource_printer.go
pkg/kubectl/resource_printer.go
+0
-0
resource_printer_test.go
pkg/kubectl/resource_printer_test.go
+7
-7
No files found.
pkg/kubectl/resource_printer.go
View file @
e963e4ad
This diff is collapsed.
Click to expand it.
pkg/kubectl/resource_printer_test.go
View file @
e963e4ad
...
@@ -213,12 +213,12 @@ func TestJSONPrinter(t *testing.T) {
...
@@ -213,12 +213,12 @@ func TestJSONPrinter(t *testing.T) {
testPrinter
(
t
,
&
JSONPrinter
{},
json
.
Unmarshal
)
testPrinter
(
t
,
&
JSONPrinter
{},
json
.
Unmarshal
)
}
}
func
PrintCustomType
(
obj
*
TestPrintType
,
w
io
.
Writer
,
options
p
rintOptions
)
error
{
func
PrintCustomType
(
obj
*
TestPrintType
,
w
io
.
Writer
,
options
P
rintOptions
)
error
{
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s"
,
obj
.
Data
)
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s"
,
obj
.
Data
)
return
err
return
err
}
}
func
ErrorPrintHandler
(
obj
*
TestPrintType
,
w
io
.
Writer
,
options
p
rintOptions
)
error
{
func
ErrorPrintHandler
(
obj
*
TestPrintType
,
w
io
.
Writer
,
options
P
rintOptions
)
error
{
return
fmt
.
Errorf
(
"ErrorPrintHandler error"
)
return
fmt
.
Errorf
(
"ErrorPrintHandler error"
)
}
}
...
@@ -755,7 +755,7 @@ func TestPrintHumanReadableService(t *testing.T) {
...
@@ -755,7 +755,7 @@ func TestPrintHumanReadableService(t *testing.T) {
for
_
,
svc
:=
range
tests
{
for
_
,
svc
:=
range
tests
{
buff
:=
bytes
.
Buffer
{}
buff
:=
bytes
.
Buffer
{}
printService
(
&
svc
,
&
buff
,
p
rintOptions
{
false
,
false
,
false
,
false
,
false
,
[]
string
{}})
printService
(
&
svc
,
&
buff
,
P
rintOptions
{
false
,
false
,
false
,
false
,
false
,
[]
string
{}})
output
:=
string
(
buff
.
Bytes
())
output
:=
string
(
buff
.
Bytes
())
ip
:=
svc
.
Spec
.
ClusterIP
ip
:=
svc
.
Spec
.
ClusterIP
if
!
strings
.
Contains
(
output
,
ip
)
{
if
!
strings
.
Contains
(
output
,
ip
)
{
...
@@ -1044,7 +1044,7 @@ func TestPrintPod(t *testing.T) {
...
@@ -1044,7 +1044,7 @@ func TestPrintPod(t *testing.T) {
buf
:=
bytes
.
NewBuffer
([]
byte
{})
buf
:=
bytes
.
NewBuffer
([]
byte
{})
for
_
,
test
:=
range
tests
{
for
_
,
test
:=
range
tests
{
printPod
(
&
test
.
pod
,
buf
,
p
rintOptions
{
false
,
false
,
false
,
true
,
false
,
[]
string
{}})
printPod
(
&
test
.
pod
,
buf
,
P
rintOptions
{
false
,
false
,
false
,
true
,
false
,
[]
string
{}})
// We ignore time
// We ignore time
if
!
strings
.
HasPrefix
(
buf
.
String
(),
test
.
expect
)
{
if
!
strings
.
HasPrefix
(
buf
.
String
(),
test
.
expect
)
{
t
.
Fatalf
(
"Expected: %s, got: %s"
,
test
.
expect
,
buf
.
String
())
t
.
Fatalf
(
"Expected: %s, got: %s"
,
test
.
expect
,
buf
.
String
())
...
@@ -1137,7 +1137,7 @@ func TestPrintNonTerminatedPod(t *testing.T) {
...
@@ -1137,7 +1137,7 @@ func TestPrintNonTerminatedPod(t *testing.T) {
buf
:=
bytes
.
NewBuffer
([]
byte
{})
buf
:=
bytes
.
NewBuffer
([]
byte
{})
for
_
,
test
:=
range
tests
{
for
_
,
test
:=
range
tests
{
printPod
(
&
test
.
pod
,
buf
,
p
rintOptions
{
false
,
false
,
false
,
false
,
false
,
[]
string
{}})
printPod
(
&
test
.
pod
,
buf
,
P
rintOptions
{
false
,
false
,
false
,
false
,
false
,
[]
string
{}})
// We ignore time
// We ignore time
if
!
strings
.
HasPrefix
(
buf
.
String
(),
test
.
expect
)
{
if
!
strings
.
HasPrefix
(
buf
.
String
(),
test
.
expect
)
{
t
.
Fatalf
(
"Expected: %s, got: %s"
,
test
.
expect
,
buf
.
String
())
t
.
Fatalf
(
"Expected: %s, got: %s"
,
test
.
expect
,
buf
.
String
())
...
@@ -1197,7 +1197,7 @@ func TestPrintPodWithLabels(t *testing.T) {
...
@@ -1197,7 +1197,7 @@ func TestPrintPodWithLabels(t *testing.T) {
buf
:=
bytes
.
NewBuffer
([]
byte
{})
buf
:=
bytes
.
NewBuffer
([]
byte
{})
for
_
,
test
:=
range
tests
{
for
_
,
test
:=
range
tests
{
printPod
(
&
test
.
pod
,
buf
,
p
rintOptions
{
false
,
false
,
false
,
false
,
false
,
test
.
labelColumns
})
printPod
(
&
test
.
pod
,
buf
,
P
rintOptions
{
false
,
false
,
false
,
false
,
false
,
test
.
labelColumns
})
// We ignore time
// We ignore time
if
!
strings
.
HasPrefix
(
buf
.
String
(),
test
.
startsWith
)
||
!
strings
.
HasSuffix
(
buf
.
String
(),
test
.
endsWith
)
{
if
!
strings
.
HasPrefix
(
buf
.
String
(),
test
.
startsWith
)
||
!
strings
.
HasSuffix
(
buf
.
String
(),
test
.
endsWith
)
{
t
.
Fatalf
(
"Expected to start with: %s and end with: %s, but got: %s"
,
test
.
startsWith
,
test
.
endsWith
,
buf
.
String
())
t
.
Fatalf
(
"Expected to start with: %s and end with: %s, but got: %s"
,
test
.
startsWith
,
test
.
endsWith
,
buf
.
String
())
...
@@ -1259,7 +1259,7 @@ func TestPrintDeployment(t *testing.T) {
...
@@ -1259,7 +1259,7 @@ func TestPrintDeployment(t *testing.T) {
buf
:=
bytes
.
NewBuffer
([]
byte
{})
buf
:=
bytes
.
NewBuffer
([]
byte
{})
for
_
,
test
:=
range
tests
{
for
_
,
test
:=
range
tests
{
printDeployment
(
&
test
.
deployment
,
buf
,
p
rintOptions
{
false
,
false
,
false
,
true
,
false
,
[]
string
{}})
printDeployment
(
&
test
.
deployment
,
buf
,
P
rintOptions
{
false
,
false
,
false
,
true
,
false
,
[]
string
{}})
if
buf
.
String
()
!=
test
.
expect
{
if
buf
.
String
()
!=
test
.
expect
{
t
.
Fatalf
(
"Expected: %s, got: %s"
,
test
.
expect
,
buf
.
String
())
t
.
Fatalf
(
"Expected: %s, got: %s"
,
test
.
expect
,
buf
.
String
())
}
}
...
...
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