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
129d37bd
Commit
129d37bd
authored
Dec 02, 2016
by
Kubernetes Submit Queue
Committed by
GitHub
Dec 02, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #34775 from ivan4th/remove-copies-of-objectdiff
Automatic merge from submit-queue Remove copies of ObjectDiff function
parents
53b27ef1
a4597c2d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
45 deletions
+4
-45
converter_test.go
pkg/conversion/converter_test.go
+3
-24
codec_test.go
pkg/runtime/serializer/codec_test.go
+1
-21
No files found.
pkg/conversion/converter_test.go
View file @
129d37bd
...
...
@@ -17,7 +17,6 @@ limitations under the License.
package
conversion
import
(
"encoding/json"
"fmt"
"reflect"
"strconv"
...
...
@@ -522,7 +521,7 @@ func TestConverter_fuzz(t *testing.T) {
continue
}
if
e
,
a
:=
item
.
from
,
item
.
check
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
t
.
Errorf
(
"(%v, %v): unexpected diff: %v"
,
i
,
j
,
obj
Diff
(
e
,
a
))
t
.
Errorf
(
"(%v, %v): unexpected diff: %v"
,
i
,
j
,
diff
.
Object
Diff
(
e
,
a
))
}
}
}
...
...
@@ -570,7 +569,7 @@ func TestConverter_MapElemAddr(t *testing.T) {
third
:=
Foo
{}
err
=
c
.
Convert
(
&
second
,
&
third
,
AllowDifferentFieldTypeNames
,
nil
)
if
e
,
a
:=
first
,
third
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
t
.
Errorf
(
"Unexpected diff: %v"
,
obj
Diff
(
e
,
a
))
t
.
Errorf
(
"Unexpected diff: %v"
,
diff
.
Object
Diff
(
e
,
a
))
}
}
...
...
@@ -821,27 +820,7 @@ func TestConverter_FieldRename(t *testing.T) {
continue
}
if
e
,
a
:=
item
.
expect
,
item
.
to
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
t
.
Errorf
(
"%v: unexpected diff: %v"
,
name
,
obj
Diff
(
e
,
a
))
t
.
Errorf
(
"%v: unexpected diff: %v"
,
name
,
diff
.
Object
Diff
(
e
,
a
))
}
}
}
func
objDiff
(
a
,
b
interface
{})
string
{
ab
,
err
:=
json
.
Marshal
(
a
)
if
err
!=
nil
{
panic
(
"a"
)
}
bb
,
err
:=
json
.
Marshal
(
b
)
if
err
!=
nil
{
panic
(
"b"
)
}
return
diff
.
StringDiff
(
string
(
ab
),
string
(
bb
))
// An alternate diff attempt, in case json isn't showing you
// the difference. (reflect.DeepEqual makes a distinction between
// nil and empty slices, for example.)
//return diff.StringDiff(
// fmt.Sprintf("%#v", a),
// fmt.Sprintf("%#v", b),
//)
}
pkg/runtime/serializer/codec_test.go
View file @
129d37bd
...
...
@@ -179,26 +179,6 @@ func GetTestScheme() (*runtime.Scheme, runtime.Codec) {
return
s
,
codec
}
func
objDiff
(
a
,
b
interface
{})
string
{
ab
,
err
:=
json
.
Marshal
(
a
)
if
err
!=
nil
{
panic
(
"a"
)
}
bb
,
err
:=
json
.
Marshal
(
b
)
if
err
!=
nil
{
panic
(
"b"
)
}
return
diff
.
StringDiff
(
string
(
ab
),
string
(
bb
))
// An alternate diff attempt, in case json isn't showing you
// the difference. (reflect.DeepEqual makes a distinction between
// nil and empty slices, for example.)
//return diff.StringDiff(
// fmt.Sprintf("%#v", a),
// fmt.Sprintf("%#v", b),
//)
}
var
semantic
=
conversion
.
EqualitiesOrDie
(
func
(
a
,
b
MyWeirdCustomEmbeddedVersionKindField
)
bool
{
a
.
APIVersion
,
a
.
ObjectKind
=
""
,
""
...
...
@@ -232,7 +212,7 @@ func runTest(t *testing.T, source interface{}) {
return
}
if
!
semantic
.
DeepEqual
(
source
,
obj3
)
{
t
.
Errorf
(
"3: %v: diff: %v"
,
name
,
obj
Diff
(
source
,
obj3
))
t
.
Errorf
(
"3: %v: diff: %v"
,
name
,
diff
.
Object
Diff
(
source
,
obj3
))
return
}
}
...
...
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