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
0f1525ce
Commit
0f1525ce
authored
Sep 08, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13678 from pmorie/serialization-debug
Auto commit by PR queue bot
parents
496296f7
502492f3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
18 deletions
+17
-18
serialization_test.go
pkg/api/serialization_test.go
+17
-18
No files found.
pkg/api/serialization_test.go
View file @
0f1525ce
...
...
@@ -69,7 +69,7 @@ func roundTrip(t *testing.T, codec runtime.Codec, item runtime.Object) {
return
}
if
!
api
.
Semantic
.
DeepEqual
(
item
,
obj2
)
{
t
.
Errorf
(
"1: %v: diff: %v
\n
Codec: %v
\n
Data: %s
\n
Source: %#v
\n
Final: %#v"
,
name
,
util
.
ObjectGoPrintDiff
(
item
,
obj2
),
codec
,
string
(
data
),
printer
.
Sprintf
(
"%#v"
,
item
),
printer
.
Sprintf
(
"%#v"
,
obj2
))
t
.
Errorf
(
"1: %v: diff: %v
\n
Codec: %v
\n
Source:
\n\n
%#v
\n\n
Encoded:
\n\n
%s
\n\n
Final:
\n\n
%#v"
,
name
,
util
.
ObjectGoPrintDiff
(
item
,
obj2
),
codec
,
printer
.
Sprintf
(
"%#v"
,
item
),
string
(
data
),
printer
.
Sprintf
(
"%#v"
,
obj2
))
return
}
...
...
@@ -103,12 +103,7 @@ func TestSpecificKind(t *testing.T) {
defer
api
.
Scheme
.
Log
(
nil
)
kind
:=
"PodList"
item
,
err
:=
api
.
Scheme
.
New
(
""
,
kind
)
if
err
!=
nil
{
t
.
Errorf
(
"Couldn't make a %v? %v"
,
kind
,
err
)
return
}
roundTripSame
(
t
,
item
)
doRoundTripTest
(
kind
,
t
)
}
func
TestList
(
t
*
testing
.
T
)
{
...
...
@@ -138,21 +133,25 @@ func TestRoundTripTypes(t *testing.T) {
}
// Try a few times, since runTest uses random values.
for
i
:=
0
;
i
<
*
fuzzIters
;
i
++
{
item
,
err
:=
api
.
Scheme
.
New
(
""
,
kind
)
if
err
!=
nil
{
t
.
Fatalf
(
"Couldn't make a %v? %v"
,
kind
,
err
)
}
if
_
,
err
:=
meta
.
TypeAccessor
(
item
);
err
!=
nil
{
t
.
Fatalf
(
"%q is not a TypeMeta and cannot be tested - add it to nonRoundTrippableTypes: %v"
,
kind
,
err
)
}
roundTripSame
(
t
,
item
,
nonRoundTrippableTypesByVersion
[
kind
]
...
)
if
!
nonInternalRoundTrippableTypes
.
Has
(
kind
)
{
roundTrip
(
t
,
api
.
Codec
,
fuzzInternalObject
(
t
,
""
,
item
,
rand
.
Int63
()))
}
doRoundTripTest
(
kind
,
t
)
}
}
}
func
doRoundTripTest
(
kind
string
,
t
*
testing
.
T
)
{
item
,
err
:=
api
.
Scheme
.
New
(
""
,
kind
)
if
err
!=
nil
{
t
.
Fatalf
(
"Couldn't make a %v? %v"
,
kind
,
err
)
}
if
_
,
err
:=
meta
.
TypeAccessor
(
item
);
err
!=
nil
{
t
.
Fatalf
(
"%q is not a TypeMeta and cannot be tested - add it to nonRoundTrippableTypes: %v"
,
kind
,
err
)
}
roundTripSame
(
t
,
item
,
nonRoundTrippableTypesByVersion
[
kind
]
...
)
if
!
nonInternalRoundTrippableTypes
.
Has
(
kind
)
{
roundTrip
(
t
,
api
.
Codec
,
fuzzInternalObject
(
t
,
""
,
item
,
rand
.
Int63
()))
}
}
func
TestEncode_Ptr
(
t
*
testing
.
T
)
{
grace
:=
int64
(
30
)
pod
:=
&
api
.
Pod
{
...
...
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