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
b0900bf0
Commit
b0900bf0
authored
Mar 11, 2016
by
harry
Committed by
Harry Zhang
Mar 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor diff into sub pkg
parent
d6e15665
Show whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
92 additions
and
85 deletions
+92
-85
copy_test.go
pkg/api/copy_test.go
+2
-2
help_test.go
pkg/api/meta/help_test.go
+2
-2
serialization_proto_test.go
pkg/api/serialization_proto_test.go
+2
-2
serialization_test.go
pkg/api/serialization_test.go
+4
-4
conversion_test.go
pkg/api/v1/conversion_test.go
+3
-3
apiserver_test.go
pkg/apiserver/apiserver_test.go
+2
-1
resthandler_test.go
pkg/apiserver/resthandler_test.go
+2
-2
events_cache_test.go
pkg/client/record/events_cache_test.go
+2
-1
client_test.go
pkg/client/restclient/client_test.go
+2
-2
nodecontroller_test.go
pkg/controller/node/nodecontroller_test.go
+3
-2
converter_test.go
pkg/conversion/converter_test.go
+3
-3
config_test.go
pkg/kubectl/cmd/config/config_test.go
+2
-2
navigation_step_parser_test.go
pkg/kubectl/cmd/config/navigation_step_parser_test.go
+2
-2
get_test.go
pkg/kubectl/cmd/get_test.go
+2
-2
resource_printer_test.go
pkg/kubectl/resource_printer_test.go
+3
-3
kubelet_test.go
pkg/kubelet/kubelet_test.go
+4
-3
generic_test.go
pkg/kubelet/pleg/generic_test.go
+2
-1
manager.go
pkg/kubelet/status/manager.go
+2
-2
rest_test.go
pkg/registry/componentstatus/rest_test.go
+5
-5
etcd_test.go
pkg/registry/controller/etcd/etcd_test.go
+2
-2
etcd_test.go
pkg/registry/deployment/etcd/etcd_test.go
+2
-2
strategy_test.go
pkg/registry/event/strategy_test.go
+3
-3
etcd_test.go
pkg/registry/persistentvolume/etcd/etcd_test.go
+2
-2
etcd_test.go
pkg/registry/persistentvolumeclaim/etcd/etcd_test.go
+2
-2
etcd_test.go
pkg/registry/pod/etcd/etcd_test.go
+4
-4
etcd_test.go
pkg/registry/replicaset/etcd/etcd_test.go
+2
-2
etcd_test.go
pkg/registry/resourcequota/etcd/etcd_test.go
+2
-2
embedded_test.go
pkg/runtime/embedded_test.go
+2
-2
scheme_test.go
pkg/runtime/scheme_test.go
+3
-3
codec_test.go
pkg/runtime/serializer/codec_test.go
+4
-4
json_test.go
pkg/runtime/serializer/json/json_test.go
+2
-2
versioning_test.go
pkg/runtime/serializer/versioning/versioning_test.go
+3
-3
diff.go
pkg/util/diff/diff.go
+1
-1
util_test.go
pkg/util/util_test.go
+3
-1
webhook_test.go
plugin/pkg/auth/authorizer/webhook/webhook_test.go
+2
-2
scheduler_test.go
plugin/pkg/scheduler/scheduler_test.go
+4
-4
No files found.
pkg/api/copy_test.go
View file @
b0900bf0
...
@@ -25,7 +25,7 @@ import (
...
@@ -25,7 +25,7 @@ import (
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/testapi"
apitesting
"k8s.io/kubernetes/pkg/api/testing"
apitesting
"k8s.io/kubernetes/pkg/api/testing"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
"github.com/google/gofuzz"
"github.com/google/gofuzz"
)
)
...
@@ -54,7 +54,7 @@ func doDeepCopyTest(t *testing.T, kind unversioned.GroupVersionKind, f *fuzz.Fuz
...
@@ -54,7 +54,7 @@ func doDeepCopyTest(t *testing.T, kind unversioned.GroupVersionKind, f *fuzz.Fuz
}
}
if
!
reflect
.
DeepEqual
(
item
,
itemCopy
)
{
if
!
reflect
.
DeepEqual
(
item
,
itemCopy
)
{
t
.
Errorf
(
"
\n
expected: %#v
\n\n
got: %#v
\n\n
diff: %v"
,
item
,
itemCopy
,
util
.
ObjectGoPrintSideBySide
(
item
,
itemCopy
))
t
.
Errorf
(
"
\n
expected: %#v
\n\n
got: %#v
\n\n
diff: %v"
,
item
,
itemCopy
,
diff
.
ObjectGoPrintSideBySide
(
item
,
itemCopy
))
}
}
}
}
...
...
pkg/api/meta/help_test.go
View file @
b0900bf0
...
@@ -25,7 +25,7 @@ import (
...
@@ -25,7 +25,7 @@ import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
"github.com/google/gofuzz"
"github.com/google/gofuzz"
)
)
...
@@ -224,7 +224,7 @@ func TestSetListToRuntimeObjectArray(t *testing.T) {
...
@@ -224,7 +224,7 @@ func TestSetListToRuntimeObjectArray(t *testing.T) {
}
}
for
i
:=
range
list
{
for
i
:=
range
list
{
if
e
,
a
:=
list
[
i
],
pl
.
Items
[
i
];
e
!=
a
{
if
e
,
a
:=
list
[
i
],
pl
.
Items
[
i
];
e
!=
a
{
t
.
Fatalf
(
"%d: unmatched: %s"
,
i
,
util
.
ObjectDiff
(
e
,
a
))
t
.
Fatalf
(
"%d: unmatched: %s"
,
i
,
diff
.
ObjectDiff
(
e
,
a
))
}
}
}
}
}
}
...
...
pkg/api/serialization_proto_test.go
View file @
b0900bf0
...
@@ -31,7 +31,7 @@ import (
...
@@ -31,7 +31,7 @@ import (
_
"k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
_
"k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime/protobuf"
"k8s.io/kubernetes/pkg/runtime/protobuf"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
)
)
func
init
()
{
func
init
()
{
...
@@ -53,7 +53,7 @@ func TestProtobufRoundTrip(t *testing.T) {
...
@@ -53,7 +53,7 @@ func TestProtobufRoundTrip(t *testing.T) {
}
}
if
!
api
.
Semantic
.
Equalities
.
DeepEqual
(
out
,
obj
)
{
if
!
api
.
Semantic
.
Equalities
.
DeepEqual
(
out
,
obj
)
{
t
.
Logf
(
"marshal
\n
%s"
,
hex
.
Dump
(
data
))
t
.
Logf
(
"marshal
\n
%s"
,
hex
.
Dump
(
data
))
t
.
Fatalf
(
"Unmarshal is unequal
\n
%s"
,
util
.
ObjectGoPrintSideBySide
(
out
,
obj
))
t
.
Fatalf
(
"Unmarshal is unequal
\n
%s"
,
diff
.
ObjectGoPrintSideBySide
(
out
,
obj
))
}
}
}
}
...
...
pkg/api/serialization_test.go
View file @
b0900bf0
...
@@ -33,7 +33,7 @@ import (
...
@@ -33,7 +33,7 @@ import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
"k8s.io/kubernetes/pkg/util/sets"
"k8s.io/kubernetes/pkg/util/sets"
)
)
...
@@ -76,7 +76,7 @@ func roundTrip(t *testing.T, codec runtime.Codec, item runtime.Object) {
...
@@ -76,7 +76,7 @@ func roundTrip(t *testing.T, codec runtime.Codec, item runtime.Object) {
return
return
}
}
if
!
api
.
Semantic
.
DeepEqual
(
item
,
obj2
)
{
if
!
api
.
Semantic
.
DeepEqual
(
item
,
obj2
)
{
t
.
Errorf
(
"
\n
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
))
t
.
Errorf
(
"
\n
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
,
diff
.
ObjectGoPrintDiff
(
item
,
obj2
),
codec
,
printer
.
Sprintf
(
"%#v"
,
item
),
string
(
data
),
printer
.
Sprintf
(
"%#v"
,
obj2
))
return
return
}
}
...
@@ -86,7 +86,7 @@ func roundTrip(t *testing.T, codec runtime.Codec, item runtime.Object) {
...
@@ -86,7 +86,7 @@ func roundTrip(t *testing.T, codec runtime.Codec, item runtime.Object) {
return
return
}
}
if
!
api
.
Semantic
.
DeepEqual
(
item
,
obj3
)
{
if
!
api
.
Semantic
.
DeepEqual
(
item
,
obj3
)
{
t
.
Errorf
(
"3: %v: diff: %v
\n
Codec: %v"
,
name
,
util
.
ObjectDiff
(
item
,
obj3
),
codec
)
t
.
Errorf
(
"3: %v: diff: %v
\n
Codec: %v"
,
name
,
diff
.
ObjectDiff
(
item
,
obj3
),
codec
)
return
return
}
}
}
}
...
@@ -210,7 +210,7 @@ func TestEncode_Ptr(t *testing.T) {
...
@@ -210,7 +210,7 @@ func TestEncode_Ptr(t *testing.T) {
t
.
Fatalf
(
"Got wrong type"
)
t
.
Fatalf
(
"Got wrong type"
)
}
}
if
!
api
.
Semantic
.
DeepEqual
(
obj2
,
pod
)
{
if
!
api
.
Semantic
.
DeepEqual
(
obj2
,
pod
)
{
t
.
Errorf
(
"
\n
Expected:
\n\n
%#v,
\n\n
Got:
\n\n
%#vDiff: %v
\n\n
"
,
pod
,
obj2
,
util
.
ObjectDiff
(
obj2
,
pod
))
t
.
Errorf
(
"
\n
Expected:
\n\n
%#v,
\n\n
Got:
\n\n
%#vDiff: %v
\n\n
"
,
pod
,
obj2
,
diff
.
ObjectDiff
(
obj2
,
pod
))
}
}
}
}
...
...
pkg/api/v1/conversion_test.go
View file @
b0900bf0
...
@@ -27,7 +27,7 @@ import (
...
@@ -27,7 +27,7 @@ import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/unversioned"
versioned
"k8s.io/kubernetes/pkg/api/v1"
versioned
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
)
)
func
TestPodLogOptions
(
t
*
testing
.
T
)
{
func
TestPodLogOptions
(
t
*
testing
.
T
)
{
...
@@ -99,7 +99,7 @@ func TestPodLogOptions(t *testing.T) {
...
@@ -99,7 +99,7 @@ func TestPodLogOptions(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
if
!
reflect
.
DeepEqual
(
convertedLogOptions
,
versionedLogOptions
)
{
if
!
reflect
.
DeepEqual
(
convertedLogOptions
,
versionedLogOptions
)
{
t
.
Fatalf
(
"Unexpected deserialization:
\n
%s"
,
util
.
ObjectGoPrintSideBySide
(
versionedLogOptions
,
convertedLogOptions
))
t
.
Fatalf
(
"Unexpected deserialization:
\n
%s"
,
diff
.
ObjectGoPrintSideBySide
(
versionedLogOptions
,
convertedLogOptions
))
}
}
}
}
...
@@ -111,7 +111,7 @@ func TestPodLogOptions(t *testing.T) {
...
@@ -111,7 +111,7 @@ func TestPodLogOptions(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
if
!
reflect
.
DeepEqual
(
convertedLogOptions
,
unversionedLogOptions
)
{
if
!
reflect
.
DeepEqual
(
convertedLogOptions
,
unversionedLogOptions
)
{
t
.
Fatalf
(
"Unexpected deserialization:
\n
%s"
,
util
.
ObjectGoPrintSideBySide
(
unversionedLogOptions
,
convertedLogOptions
))
t
.
Fatalf
(
"Unexpected deserialization:
\n
%s"
,
diff
.
ObjectGoPrintSideBySide
(
unversionedLogOptions
,
convertedLogOptions
))
}
}
}
}
}
}
...
...
pkg/apiserver/apiserver_test.go
View file @
b0900bf0
...
@@ -44,6 +44,7 @@ import (
...
@@ -44,6 +44,7 @@ import (
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util/diff"
"k8s.io/kubernetes/pkg/util/sets"
"k8s.io/kubernetes/pkg/util/sets"
"k8s.io/kubernetes/pkg/version"
"k8s.io/kubernetes/pkg/version"
"k8s.io/kubernetes/pkg/watch"
"k8s.io/kubernetes/pkg/watch"
...
@@ -1892,7 +1893,7 @@ func TestDeleteWithOptions(t *testing.T) {
...
@@ -1892,7 +1893,7 @@ func TestDeleteWithOptions(t *testing.T) {
t
.
Errorf
(
"Unexpected delete: %s, expected %s"
,
simpleStorage
.
deleted
,
ID
)
t
.
Errorf
(
"Unexpected delete: %s, expected %s"
,
simpleStorage
.
deleted
,
ID
)
}
}
if
!
api
.
Semantic
.
DeepEqual
(
simpleStorage
.
deleteOptions
,
item
)
{
if
!
api
.
Semantic
.
DeepEqual
(
simpleStorage
.
deleteOptions
,
item
)
{
t
.
Errorf
(
"unexpected delete options: %s"
,
util
.
ObjectDiff
(
simpleStorage
.
deleteOptions
,
item
))
t
.
Errorf
(
"unexpected delete options: %s"
,
diff
.
ObjectDiff
(
simpleStorage
.
deleteOptions
,
item
))
}
}
}
}
...
...
pkg/apiserver/resthandler_test.go
View file @
b0900bf0
...
@@ -31,7 +31,7 @@ import (
...
@@ -31,7 +31,7 @@ import (
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
"k8s.io/kubernetes/pkg/util/strategicpatch"
"k8s.io/kubernetes/pkg/util/strategicpatch"
)
)
...
@@ -255,7 +255,7 @@ func (tc *patchTestCase) Run(t *testing.T) {
...
@@ -255,7 +255,7 @@ func (tc *patchTestCase) Run(t *testing.T) {
reallyExpectedPod
:=
expectedObj
.
(
*
api
.
Pod
)
reallyExpectedPod
:=
expectedObj
.
(
*
api
.
Pod
)
if
!
reflect
.
DeepEqual
(
*
reallyExpectedPod
,
*
resultPod
)
{
if
!
reflect
.
DeepEqual
(
*
reallyExpectedPod
,
*
resultPod
)
{
t
.
Errorf
(
"%s mismatch: %v
\n
"
,
tc
.
name
,
util
.
ObjectGoPrintDiff
(
reallyExpectedPod
,
resultPod
))
t
.
Errorf
(
"%s mismatch: %v
\n
"
,
tc
.
name
,
diff
.
ObjectGoPrintDiff
(
reallyExpectedPod
,
resultPod
))
return
return
}
}
}
}
...
...
pkg/client/record/events_cache_test.go
View file @
b0900bf0
...
@@ -25,6 +25,7 @@ import (
...
@@ -25,6 +25,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util/diff"
)
)
func
makeObjectReference
(
kind
,
name
,
namespace
string
)
api
.
ObjectReference
{
func
makeObjectReference
(
kind
,
name
,
namespace
string
)
api
.
ObjectReference
{
...
@@ -118,7 +119,7 @@ func validateEvent(messagePrefix string, actualEvent *api.Event, expectedEvent *
...
@@ -118,7 +119,7 @@ func validateEvent(messagePrefix string, actualEvent *api.Event, expectedEvent *
}
}
recvEvent
.
Name
=
expectedEvent
.
Name
recvEvent
.
Name
=
expectedEvent
.
Name
if
e
,
a
:=
expectedEvent
,
&
recvEvent
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
if
e
,
a
:=
expectedEvent
,
&
recvEvent
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
t
.
Errorf
(
"%v - diff: %s"
,
messagePrefix
,
util
.
ObjectGoPrintDiff
(
e
,
a
))
t
.
Errorf
(
"%v - diff: %s"
,
messagePrefix
,
diff
.
ObjectGoPrintDiff
(
e
,
a
))
}
}
recvEvent
.
FirstTimestamp
=
actualFirstTimestamp
recvEvent
.
FirstTimestamp
=
actualFirstTimestamp
recvEvent
.
LastTimestamp
=
actualLastTimestamp
recvEvent
.
LastTimestamp
=
actualLastTimestamp
...
...
pkg/client/restclient/client_test.go
View file @
b0900bf0
...
@@ -29,7 +29,7 @@ import (
...
@@ -29,7 +29,7 @@ import (
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
utiltesting
"k8s.io/kubernetes/pkg/util/testing"
utiltesting
"k8s.io/kubernetes/pkg/util/testing"
)
)
...
@@ -114,7 +114,7 @@ func TestDoRequestFailed(t *testing.T) {
...
@@ -114,7 +114,7 @@ func TestDoRequestFailed(t *testing.T) {
expected
.
APIVersion
=
"v1"
expected
.
APIVersion
=
"v1"
expected
.
Kind
=
"Status"
expected
.
Kind
=
"Status"
if
!
reflect
.
DeepEqual
(
&
expected
,
&
actual
)
{
if
!
reflect
.
DeepEqual
(
&
expected
,
&
actual
)
{
t
.
Errorf
(
"Unexpected mis-match: %s"
,
util
.
ObjectDiff
(
status
,
&
actual
))
t
.
Errorf
(
"Unexpected mis-match: %s"
,
diff
.
ObjectDiff
(
status
,
&
actual
))
}
}
}
}
...
...
pkg/controller/node/nodecontroller_test.go
View file @
b0900bf0
...
@@ -32,6 +32,7 @@ import (
...
@@ -32,6 +32,7 @@ import (
unversionedcore
"k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned"
unversionedcore
"k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned"
fakecloud
"k8s.io/kubernetes/pkg/cloudprovider/providers/fake"
fakecloud
"k8s.io/kubernetes/pkg/cloudprovider/providers/fake"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util/diff"
"k8s.io/kubernetes/pkg/util/wait"
"k8s.io/kubernetes/pkg/util/wait"
"k8s.io/kubernetes/pkg/watch"
"k8s.io/kubernetes/pkg/watch"
)
)
...
@@ -736,10 +737,10 @@ func TestMonitorNodeStatusUpdateStatus(t *testing.T) {
...
@@ -736,10 +737,10 @@ func TestMonitorNodeStatusUpdateStatus(t *testing.T) {
t
.
Errorf
(
"expected %v call, but got %v."
,
item
.
expectedRequestCount
,
item
.
fakeNodeHandler
.
RequestCount
)
t
.
Errorf
(
"expected %v call, but got %v."
,
item
.
expectedRequestCount
,
item
.
fakeNodeHandler
.
RequestCount
)
}
}
if
len
(
item
.
fakeNodeHandler
.
UpdatedNodes
)
>
0
&&
!
api
.
Semantic
.
DeepEqual
(
item
.
expectedNodes
,
item
.
fakeNodeHandler
.
UpdatedNodes
)
{
if
len
(
item
.
fakeNodeHandler
.
UpdatedNodes
)
>
0
&&
!
api
.
Semantic
.
DeepEqual
(
item
.
expectedNodes
,
item
.
fakeNodeHandler
.
UpdatedNodes
)
{
t
.
Errorf
(
"Case[%d] unexpected nodes: %s"
,
i
,
util
.
ObjectDiff
(
item
.
expectedNodes
[
0
],
item
.
fakeNodeHandler
.
UpdatedNodes
[
0
]))
t
.
Errorf
(
"Case[%d] unexpected nodes: %s"
,
i
,
diff
.
ObjectDiff
(
item
.
expectedNodes
[
0
],
item
.
fakeNodeHandler
.
UpdatedNodes
[
0
]))
}
}
if
len
(
item
.
fakeNodeHandler
.
UpdatedNodeStatuses
)
>
0
&&
!
api
.
Semantic
.
DeepEqual
(
item
.
expectedNodes
,
item
.
fakeNodeHandler
.
UpdatedNodeStatuses
)
{
if
len
(
item
.
fakeNodeHandler
.
UpdatedNodeStatuses
)
>
0
&&
!
api
.
Semantic
.
DeepEqual
(
item
.
expectedNodes
,
item
.
fakeNodeHandler
.
UpdatedNodeStatuses
)
{
t
.
Errorf
(
"Case[%d] unexpected nodes: %s"
,
i
,
util
.
ObjectDiff
(
item
.
expectedNodes
[
0
],
item
.
fakeNodeHandler
.
UpdatedNodeStatuses
[
0
]))
t
.
Errorf
(
"Case[%d] unexpected nodes: %s"
,
i
,
diff
.
ObjectDiff
(
item
.
expectedNodes
[
0
],
item
.
fakeNodeHandler
.
UpdatedNodeStatuses
[
0
]))
}
}
}
}
}
}
...
...
pkg/conversion/converter_test.go
View file @
b0900bf0
...
@@ -27,7 +27,7 @@ import (
...
@@ -27,7 +27,7 @@ import (
"github.com/google/gofuzz"
"github.com/google/gofuzz"
flag
"github.com/spf13/pflag"
flag
"github.com/spf13/pflag"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
)
)
var
fuzzIters
=
flag
.
Int
(
"fuzz-iters"
,
50
,
"How many fuzzing iterations to do."
)
var
fuzzIters
=
flag
.
Int
(
"fuzz-iters"
,
50
,
"How many fuzzing iterations to do."
)
...
@@ -835,12 +835,12 @@ func objDiff(a, b interface{}) string {
...
@@ -835,12 +835,12 @@ func objDiff(a, b interface{}) string {
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
"b"
)
panic
(
"b"
)
}
}
return
util
.
StringDiff
(
string
(
ab
),
string
(
bb
))
return
diff
.
StringDiff
(
string
(
ab
),
string
(
bb
))
// An alternate diff attempt, in case json isn't showing you
// An alternate diff attempt, in case json isn't showing you
// the difference. (reflect.DeepEqual makes a distinction between
// the difference. (reflect.DeepEqual makes a distinction between
// nil and empty slices, for example.)
// nil and empty slices, for example.)
//return
util
.StringDiff(
//return
diff
.StringDiff(
// fmt.Sprintf("%#v", a),
// fmt.Sprintf("%#v", a),
// fmt.Sprintf("%#v", b),
// fmt.Sprintf("%#v", b),
//)
//)
...
...
pkg/kubectl/cmd/config/config_test.go
View file @
b0900bf0
...
@@ -29,7 +29,7 @@ import (
...
@@ -29,7 +29,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
clientcmdapi
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
clientcmdapi
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
)
)
func
newRedFederalCowHammerConfig
()
clientcmdapi
.
Config
{
func
newRedFederalCowHammerConfig
()
clientcmdapi
.
Config
{
...
@@ -725,7 +725,7 @@ func (test configCommandTest) run(t *testing.T) string {
...
@@ -725,7 +725,7 @@ func (test configCommandTest) run(t *testing.T) string {
testClearLocationOfOrigin
(
&
actualConfig
)
testClearLocationOfOrigin
(
&
actualConfig
)
if
!
api
.
Semantic
.
DeepEqual
(
test
.
expectedConfig
,
actualConfig
)
{
if
!
api
.
Semantic
.
DeepEqual
(
test
.
expectedConfig
,
actualConfig
)
{
t
.
Errorf
(
"diff: %v"
,
util
.
ObjectDiff
(
test
.
expectedConfig
,
actualConfig
))
t
.
Errorf
(
"diff: %v"
,
diff
.
ObjectDiff
(
test
.
expectedConfig
,
actualConfig
))
t
.
Errorf
(
"expected: %#v
\n
actual: %#v"
,
test
.
expectedConfig
,
actualConfig
)
t
.
Errorf
(
"expected: %#v
\n
actual: %#v"
,
test
.
expectedConfig
,
actualConfig
)
}
}
...
...
pkg/kubectl/cmd/config/navigation_step_parser_test.go
View file @
b0900bf0
...
@@ -22,7 +22,7 @@ import (
...
@@ -22,7 +22,7 @@ import (
"testing"
"testing"
clientcmdapi
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
clientcmdapi
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
)
)
type
stepParserTest
struct
{
type
stepParserTest
struct
{
...
@@ -90,7 +90,7 @@ func (test stepParserTest) run(t *testing.T) {
...
@@ -90,7 +90,7 @@ func (test stepParserTest) run(t *testing.T) {
}
}
if
!
reflect
.
DeepEqual
(
test
.
expectedNavigationSteps
,
*
actualSteps
)
{
if
!
reflect
.
DeepEqual
(
test
.
expectedNavigationSteps
,
*
actualSteps
)
{
t
.
Errorf
(
"diff: %v"
,
util
.
ObjectDiff
(
test
.
expectedNavigationSteps
,
*
actualSteps
))
t
.
Errorf
(
"diff: %v"
,
diff
.
ObjectDiff
(
test
.
expectedNavigationSteps
,
*
actualSteps
))
t
.
Errorf
(
"expected: %#v
\n
actual: %#v"
,
test
.
expectedNavigationSteps
,
*
actualSteps
)
t
.
Errorf
(
"expected: %#v
\n
actual: %#v"
,
test
.
expectedNavigationSteps
,
*
actualSteps
)
}
}
}
}
pkg/kubectl/cmd/get_test.go
View file @
b0900bf0
...
@@ -35,7 +35,7 @@ import (
...
@@ -35,7 +35,7 @@ import (
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/client/unversioned/fake"
"k8s.io/kubernetes/pkg/client/unversioned/fake"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
"k8s.io/kubernetes/pkg/watch"
"k8s.io/kubernetes/pkg/watch"
"k8s.io/kubernetes/pkg/watch/json"
"k8s.io/kubernetes/pkg/watch/json"
)
)
...
@@ -633,7 +633,7 @@ func TestGetMultipleTypeObjectsWithDirectReference(t *testing.T) {
...
@@ -633,7 +633,7 @@ func TestGetMultipleTypeObjectsWithDirectReference(t *testing.T) {
expected
:=
[]
runtime
.
Object
{
&
svc
.
Items
[
0
],
node
}
expected
:=
[]
runtime
.
Object
{
&
svc
.
Items
[
0
],
node
}
actual
:=
tf
.
Printer
.
(
*
testPrinter
)
.
Objects
actual
:=
tf
.
Printer
.
(
*
testPrinter
)
.
Objects
if
!
api
.
Semantic
.
DeepEqual
(
expected
,
actual
)
{
if
!
api
.
Semantic
.
DeepEqual
(
expected
,
actual
)
{
t
.
Errorf
(
"unexpected object: %s"
,
util
.
ObjectDiff
(
expected
,
actual
))
t
.
Errorf
(
"unexpected object: %s"
,
diff
.
ObjectDiff
(
expected
,
actual
))
}
}
if
len
(
buf
.
String
())
==
0
{
if
len
(
buf
.
String
())
==
0
{
t
.
Errorf
(
"unexpected empty output"
)
t
.
Errorf
(
"unexpected empty output"
)
...
...
pkg/kubectl/resource_printer_test.go
View file @
b0900bf0
...
@@ -34,7 +34,7 @@ import (
...
@@ -34,7 +34,7 @@ import (
kubectltesting
"k8s.io/kubernetes/pkg/kubectl/testing"
kubectltesting
"k8s.io/kubernetes/pkg/kubectl/testing"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
yamlserializer
"k8s.io/kubernetes/pkg/runtime/serializer/yaml"
yamlserializer
"k8s.io/kubernetes/pkg/runtime/serializer/yaml"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
"k8s.io/kubernetes/pkg/util/intstr"
"k8s.io/kubernetes/pkg/util/intstr"
"k8s.io/kubernetes/pkg/util/sets"
"k8s.io/kubernetes/pkg/util/sets"
...
@@ -182,7 +182,7 @@ func testPrinter(t *testing.T, printer ResourcePrinter, unmarshalFunc func(data
...
@@ -182,7 +182,7 @@ func testPrinter(t *testing.T, printer ResourcePrinter, unmarshalFunc func(data
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
if
!
reflect
.
DeepEqual
(
testData
,
poutput
)
{
if
!
reflect
.
DeepEqual
(
testData
,
poutput
)
{
t
.
Errorf
(
"Test data and unmarshaled data are not equal: %v"
,
util
.
ObjectDiff
(
poutput
,
testData
))
t
.
Errorf
(
"Test data and unmarshaled data are not equal: %v"
,
diff
.
ObjectDiff
(
poutput
,
testData
))
}
}
obj
:=
&
api
.
Pod
{
obj
:=
&
api
.
Pod
{
...
@@ -202,7 +202,7 @@ func testPrinter(t *testing.T, printer ResourcePrinter, unmarshalFunc func(data
...
@@ -202,7 +202,7 @@ func testPrinter(t *testing.T, printer ResourcePrinter, unmarshalFunc func(data
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
if
!
reflect
.
DeepEqual
(
obj
,
&
objOut
)
{
if
!
reflect
.
DeepEqual
(
obj
,
&
objOut
)
{
t
.
Errorf
(
"Unexpected inequality:
\n
%v"
,
util
.
ObjectDiff
(
obj
,
&
objOut
))
t
.
Errorf
(
"Unexpected inequality:
\n
%v"
,
diff
.
ObjectDiff
(
obj
,
&
objOut
))
}
}
}
}
...
...
pkg/kubelet/kubelet_test.go
View file @
b0900bf0
...
@@ -61,6 +61,7 @@ import (
...
@@ -61,6 +61,7 @@ import (
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util/bandwidth"
"k8s.io/kubernetes/pkg/util/bandwidth"
"k8s.io/kubernetes/pkg/util/diff"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/util/mount"
utilruntime
"k8s.io/kubernetes/pkg/util/runtime"
utilruntime
"k8s.io/kubernetes/pkg/util/runtime"
"k8s.io/kubernetes/pkg/util/sets"
"k8s.io/kubernetes/pkg/util/sets"
...
@@ -2771,7 +2772,7 @@ func TestUpdateNewNodeStatus(t *testing.T) {
...
@@ -2771,7 +2772,7 @@ func TestUpdateNewNodeStatus(t *testing.T) {
}
}
if
!
api
.
Semantic
.
DeepEqual
(
expectedNode
,
updatedNode
)
{
if
!
api
.
Semantic
.
DeepEqual
(
expectedNode
,
updatedNode
)
{
t
.
Errorf
(
"unexpected objects: %s"
,
util
.
ObjectDiff
(
expectedNode
,
updatedNode
))
t
.
Errorf
(
"unexpected objects: %s"
,
diff
.
ObjectDiff
(
expectedNode
,
updatedNode
))
}
}
}
}
...
@@ -2846,7 +2847,7 @@ func TestUpdateNewNodeOutOfDiskStatusWithTransitionFrequency(t *testing.T) {
...
@@ -2846,7 +2847,7 @@ func TestUpdateNewNodeOutOfDiskStatusWithTransitionFrequency(t *testing.T) {
}
}
if
!
reflect
.
DeepEqual
(
expectedNodeOutOfDiskCondition
,
oodCondition
)
{
if
!
reflect
.
DeepEqual
(
expectedNodeOutOfDiskCondition
,
oodCondition
)
{
t
.
Errorf
(
"unexpected objects: %s"
,
util
.
ObjectDiff
(
expectedNodeOutOfDiskCondition
,
oodCondition
))
t
.
Errorf
(
"unexpected objects: %s"
,
diff
.
ObjectDiff
(
expectedNodeOutOfDiskCondition
,
oodCondition
))
}
}
}
}
...
@@ -3282,7 +3283,7 @@ func TestUpdateNodeStatusWithRuntimeStateError(t *testing.T) {
...
@@ -3282,7 +3283,7 @@ func TestUpdateNodeStatusWithRuntimeStateError(t *testing.T) {
LastTransitionTime
:
unversioned
.
Time
{},
LastTransitionTime
:
unversioned
.
Time
{},
}
}
if
!
api
.
Semantic
.
DeepEqual
(
expectedNode
,
updatedNode
)
{
if
!
api
.
Semantic
.
DeepEqual
(
expectedNode
,
updatedNode
)
{
t
.
Errorf
(
"unexpected objects: %s"
,
util
.
ObjectDiff
(
expectedNode
,
updatedNode
))
t
.
Errorf
(
"unexpected objects: %s"
,
diff
.
ObjectDiff
(
expectedNode
,
updatedNode
))
}
}
}
}
...
...
pkg/kubelet/pleg/generic_test.go
View file @
b0900bf0
...
@@ -28,6 +28,7 @@ import (
...
@@ -28,6 +28,7 @@ import (
containertest
"k8s.io/kubernetes/pkg/kubelet/container/testing"
containertest
"k8s.io/kubernetes/pkg/kubelet/container/testing"
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util/diff"
)
)
const
(
const
(
...
@@ -86,7 +87,7 @@ func verifyEvents(t *testing.T, expected, actual []*PodLifecycleEvent) {
...
@@ -86,7 +87,7 @@ func verifyEvents(t *testing.T, expected, actual []*PodLifecycleEvent) {
sort
.
Sort
(
sortableEvents
(
expected
))
sort
.
Sort
(
sortableEvents
(
expected
))
sort
.
Sort
(
sortableEvents
(
actual
))
sort
.
Sort
(
sortableEvents
(
actual
))
if
!
reflect
.
DeepEqual
(
expected
,
actual
)
{
if
!
reflect
.
DeepEqual
(
expected
,
actual
)
{
t
.
Errorf
(
"Actual events differ from the expected; diff:
\n
%v"
,
util
.
ObjectDiff
(
expected
,
actual
))
t
.
Errorf
(
"Actual events differ from the expected; diff:
\n
%v"
,
diff
.
ObjectDiff
(
expected
,
actual
))
}
}
}
}
...
...
pkg/kubelet/status/manager.go
View file @
b0900bf0
...
@@ -32,7 +32,7 @@ import (
...
@@ -32,7 +32,7 @@ import (
kubetypes
"k8s.io/kubernetes/pkg/kubelet/types"
kubetypes
"k8s.io/kubernetes/pkg/kubelet/types"
"k8s.io/kubernetes/pkg/kubelet/util/format"
"k8s.io/kubernetes/pkg/kubelet/util/format"
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
"k8s.io/kubernetes/pkg/util/wait"
"k8s.io/kubernetes/pkg/util/wait"
)
)
...
@@ -453,7 +453,7 @@ func (m *manager) needsReconcile(uid types.UID, status api.PodStatus) bool {
...
@@ -453,7 +453,7 @@ func (m *manager) needsReconcile(uid types.UID, status api.PodStatus) bool {
return
false
return
false
}
}
glog
.
V
(
3
)
.
Infof
(
"Pod status is inconsistent with cached status for pod %q, a reconciliation should be triggered:
\n
%+v"
,
format
.
Pod
(
pod
),
glog
.
V
(
3
)
.
Infof
(
"Pod status is inconsistent with cached status for pod %q, a reconciliation should be triggered:
\n
%+v"
,
format
.
Pod
(
pod
),
util
.
ObjectDiff
(
podStatus
,
status
))
diff
.
ObjectDiff
(
podStatus
,
status
))
return
true
return
true
}
}
...
...
pkg/registry/componentstatus/rest_test.go
View file @
b0900bf0
...
@@ -25,7 +25,7 @@ import (
...
@@ -25,7 +25,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apiserver"
"k8s.io/kubernetes/pkg/apiserver"
"k8s.io/kubernetes/pkg/probe"
"k8s.io/kubernetes/pkg/probe"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
"net/http"
"net/http"
"net/url"
"net/url"
"time"
"time"
...
@@ -82,7 +82,7 @@ func TestList_NoError(t *testing.T) {
...
@@ -82,7 +82,7 @@ func TestList_NoError(t *testing.T) {
Items
:
[]
api
.
ComponentStatus
{
*
(
createTestStatus
(
"test1"
,
api
.
ConditionTrue
,
"ok"
,
""
))},
Items
:
[]
api
.
ComponentStatus
{
*
(
createTestStatus
(
"test1"
,
api
.
ConditionTrue
,
"ok"
,
""
))},
}
}
if
e
,
a
:=
expect
,
got
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
if
e
,
a
:=
expect
,
got
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
t
.
Errorf
(
"Got unexpected object. Diff: %s"
,
util
.
ObjectDiff
(
e
,
a
))
t
.
Errorf
(
"Got unexpected object. Diff: %s"
,
diff
.
ObjectDiff
(
e
,
a
))
}
}
}
}
...
@@ -97,7 +97,7 @@ func TestList_FailedCheck(t *testing.T) {
...
@@ -97,7 +97,7 @@ func TestList_FailedCheck(t *testing.T) {
*
(
createTestStatus
(
"test1"
,
api
.
ConditionFalse
,
""
,
""
))},
*
(
createTestStatus
(
"test1"
,
api
.
ConditionFalse
,
""
,
""
))},
}
}
if
e
,
a
:=
expect
,
got
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
if
e
,
a
:=
expect
,
got
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
t
.
Errorf
(
"Got unexpected object. Diff: %s"
,
util
.
ObjectDiff
(
e
,
a
))
t
.
Errorf
(
"Got unexpected object. Diff: %s"
,
diff
.
ObjectDiff
(
e
,
a
))
}
}
}
}
...
@@ -112,7 +112,7 @@ func TestList_UnknownError(t *testing.T) {
...
@@ -112,7 +112,7 @@ func TestList_UnknownError(t *testing.T) {
*
(
createTestStatus
(
"test1"
,
api
.
ConditionUnknown
,
""
,
"fizzbuzz error"
))},
*
(
createTestStatus
(
"test1"
,
api
.
ConditionUnknown
,
""
,
"fizzbuzz error"
))},
}
}
if
e
,
a
:=
expect
,
got
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
if
e
,
a
:=
expect
,
got
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
t
.
Errorf
(
"Got unexpected object. Diff: %s"
,
util
.
ObjectDiff
(
e
,
a
))
t
.
Errorf
(
"Got unexpected object. Diff: %s"
,
diff
.
ObjectDiff
(
e
,
a
))
}
}
}
}
...
@@ -124,7 +124,7 @@ func TestGet_NoError(t *testing.T) {
...
@@ -124,7 +124,7 @@ func TestGet_NoError(t *testing.T) {
}
}
expect
:=
createTestStatus
(
"test1"
,
api
.
ConditionTrue
,
"ok"
,
""
)
expect
:=
createTestStatus
(
"test1"
,
api
.
ConditionTrue
,
"ok"
,
""
)
if
e
,
a
:=
expect
,
got
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
if
e
,
a
:=
expect
,
got
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
t
.
Errorf
(
"Got unexpected object. Diff: %s"
,
util
.
ObjectDiff
(
e
,
a
))
t
.
Errorf
(
"Got unexpected object. Diff: %s"
,
diff
.
ObjectDiff
(
e
,
a
))
}
}
}
}
...
...
pkg/registry/controller/etcd/etcd_test.go
View file @
b0900bf0
...
@@ -28,7 +28,7 @@ import (
...
@@ -28,7 +28,7 @@ import (
"k8s.io/kubernetes/pkg/registry/registrytest"
"k8s.io/kubernetes/pkg/registry/registrytest"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
etcdtesting
"k8s.io/kubernetes/pkg/storage/etcd/testing"
etcdtesting
"k8s.io/kubernetes/pkg/storage/etcd/testing"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
)
)
const
(
const
(
...
@@ -273,7 +273,7 @@ func TestScaleGet(t *testing.T) {
...
@@ -273,7 +273,7 @@ func TestScaleGet(t *testing.T) {
}
}
got
:=
obj
.
(
*
autoscaling
.
Scale
)
got
:=
obj
.
(
*
autoscaling
.
Scale
)
if
!
api
.
Semantic
.
DeepEqual
(
want
,
got
)
{
if
!
api
.
Semantic
.
DeepEqual
(
want
,
got
)
{
t
.
Errorf
(
"unexpected scale: %s"
,
util
.
ObjectDiff
(
want
,
got
))
t
.
Errorf
(
"unexpected scale: %s"
,
diff
.
ObjectDiff
(
want
,
got
))
}
}
}
}
...
...
pkg/registry/deployment/etcd/etcd_test.go
View file @
b0900bf0
...
@@ -32,7 +32,7 @@ import (
...
@@ -32,7 +32,7 @@ import (
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/storage/etcd/etcdtest"
"k8s.io/kubernetes/pkg/storage/etcd/etcdtest"
etcdtesting
"k8s.io/kubernetes/pkg/storage/etcd/testing"
etcdtesting
"k8s.io/kubernetes/pkg/storage/etcd/testing"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
)
)
const
defaultReplicas
=
100
const
defaultReplicas
=
100
...
@@ -216,7 +216,7 @@ func TestScaleGet(t *testing.T) {
...
@@ -216,7 +216,7 @@ func TestScaleGet(t *testing.T) {
}
}
got
:=
obj
.
(
*
extensions
.
Scale
)
got
:=
obj
.
(
*
extensions
.
Scale
)
if
!
api
.
Semantic
.
DeepEqual
(
want
,
got
)
{
if
!
api
.
Semantic
.
DeepEqual
(
want
,
got
)
{
t
.
Errorf
(
"unexpected scale: %s"
,
util
.
ObjectDiff
(
want
,
got
))
t
.
Errorf
(
"unexpected scale: %s"
,
diff
.
ObjectDiff
(
want
,
got
))
}
}
}
}
...
...
pkg/registry/event/strategy_test.go
View file @
b0900bf0
...
@@ -25,7 +25,7 @@ import (
...
@@ -25,7 +25,7 @@ import (
apitesting
"k8s.io/kubernetes/pkg/api/testing"
apitesting
"k8s.io/kubernetes/pkg/api/testing"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
)
)
func
testEvent
(
name
string
)
*
api
.
Event
{
func
testEvent
(
name
string
)
*
api
.
Event
{
...
@@ -65,7 +65,7 @@ func TestGetAttrs(t *testing.T) {
...
@@ -65,7 +65,7 @@ func TestGetAttrs(t *testing.T) {
t
.
Fatalf
(
"Unexpected error %v"
,
err
)
t
.
Fatalf
(
"Unexpected error %v"
,
err
)
}
}
if
e
,
a
:=
label
,
(
labels
.
Set
{});
!
reflect
.
DeepEqual
(
e
,
a
)
{
if
e
,
a
:=
label
,
(
labels
.
Set
{});
!
reflect
.
DeepEqual
(
e
,
a
)
{
t
.
Errorf
(
"diff: %s"
,
util
.
ObjectDiff
(
e
,
a
))
t
.
Errorf
(
"diff: %s"
,
diff
.
ObjectDiff
(
e
,
a
))
}
}
expect
:=
fields
.
Set
{
expect
:=
fields
.
Set
{
"metadata.name"
:
"f0118"
,
"metadata.name"
:
"f0118"
,
...
@@ -82,7 +82,7 @@ func TestGetAttrs(t *testing.T) {
...
@@ -82,7 +82,7 @@ func TestGetAttrs(t *testing.T) {
"type"
:
api
.
EventTypeNormal
,
"type"
:
api
.
EventTypeNormal
,
}
}
if
e
,
a
:=
expect
,
field
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
if
e
,
a
:=
expect
,
field
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
t
.
Errorf
(
"diff: %s"
,
util
.
ObjectDiff
(
e
,
a
))
t
.
Errorf
(
"diff: %s"
,
diff
.
ObjectDiff
(
e
,
a
))
}
}
}
}
...
...
pkg/registry/persistentvolume/etcd/etcd_test.go
View file @
b0900bf0
...
@@ -28,7 +28,7 @@ import (
...
@@ -28,7 +28,7 @@ import (
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/storage/etcd/etcdtest"
"k8s.io/kubernetes/pkg/storage/etcd/etcdtest"
etcdtesting
"k8s.io/kubernetes/pkg/storage/etcd/testing"
etcdtesting
"k8s.io/kubernetes/pkg/storage/etcd/testing"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
)
)
func
newStorage
(
t
*
testing
.
T
)
(
*
REST
,
*
StatusREST
,
*
etcdtesting
.
EtcdTestServer
)
{
func
newStorage
(
t
*
testing
.
T
)
(
*
REST
,
*
StatusREST
,
*
etcdtesting
.
EtcdTestServer
)
{
...
@@ -178,6 +178,6 @@ func TestUpdateStatus(t *testing.T) {
...
@@ -178,6 +178,6 @@ func TestUpdateStatus(t *testing.T) {
pvOut
:=
obj
.
(
*
api
.
PersistentVolume
)
pvOut
:=
obj
.
(
*
api
.
PersistentVolume
)
// only compare the relevant change b/c metadata will differ
// only compare the relevant change b/c metadata will differ
if
!
api
.
Semantic
.
DeepEqual
(
pvIn
.
Status
,
pvOut
.
Status
)
{
if
!
api
.
Semantic
.
DeepEqual
(
pvIn
.
Status
,
pvOut
.
Status
)
{
t
.
Errorf
(
"unexpected object: %s"
,
util
.
ObjectDiff
(
pvIn
.
Status
,
pvOut
.
Status
))
t
.
Errorf
(
"unexpected object: %s"
,
diff
.
ObjectDiff
(
pvIn
.
Status
,
pvOut
.
Status
))
}
}
}
}
pkg/registry/persistentvolumeclaim/etcd/etcd_test.go
View file @
b0900bf0
...
@@ -28,7 +28,7 @@ import (
...
@@ -28,7 +28,7 @@ import (
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/storage/etcd/etcdtest"
"k8s.io/kubernetes/pkg/storage/etcd/etcdtest"
etcdtesting
"k8s.io/kubernetes/pkg/storage/etcd/testing"
etcdtesting
"k8s.io/kubernetes/pkg/storage/etcd/testing"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
)
)
func
newStorage
(
t
*
testing
.
T
)
(
*
REST
,
*
StatusREST
,
*
etcdtesting
.
EtcdTestServer
)
{
func
newStorage
(
t
*
testing
.
T
)
(
*
REST
,
*
StatusREST
,
*
etcdtesting
.
EtcdTestServer
)
{
...
@@ -179,6 +179,6 @@ func TestUpdateStatus(t *testing.T) {
...
@@ -179,6 +179,6 @@ func TestUpdateStatus(t *testing.T) {
pvcOut
:=
obj
.
(
*
api
.
PersistentVolumeClaim
)
pvcOut
:=
obj
.
(
*
api
.
PersistentVolumeClaim
)
// only compare relevant changes b/c of difference in metadata
// only compare relevant changes b/c of difference in metadata
if
!
api
.
Semantic
.
DeepEqual
(
pvc
.
Status
,
pvcOut
.
Status
)
{
if
!
api
.
Semantic
.
DeepEqual
(
pvc
.
Status
,
pvcOut
.
Status
)
{
t
.
Errorf
(
"unexpected object: %s"
,
util
.
ObjectDiff
(
pvc
.
Status
,
pvcOut
.
Status
))
t
.
Errorf
(
"unexpected object: %s"
,
diff
.
ObjectDiff
(
pvc
.
Status
,
pvcOut
.
Status
))
}
}
}
}
pkg/registry/pod/etcd/etcd_test.go
View file @
b0900bf0
...
@@ -35,7 +35,7 @@ import (
...
@@ -35,7 +35,7 @@ import (
"k8s.io/kubernetes/pkg/storage"
"k8s.io/kubernetes/pkg/storage"
"k8s.io/kubernetes/pkg/storage/etcd/etcdtest"
"k8s.io/kubernetes/pkg/storage/etcd/etcdtest"
etcdtesting
"k8s.io/kubernetes/pkg/storage/etcd/testing"
etcdtesting
"k8s.io/kubernetes/pkg/storage/etcd/testing"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
)
)
func
newStorage
(
t
*
testing
.
T
)
(
*
REST
,
*
BindingREST
,
*
StatusREST
,
*
etcdtesting
.
EtcdTestServer
)
{
func
newStorage
(
t
*
testing
.
T
)
(
*
REST
,
*
BindingREST
,
*
StatusREST
,
*
etcdtesting
.
EtcdTestServer
)
{
...
@@ -620,7 +620,7 @@ func TestEtcdUpdateNotScheduled(t *testing.T) {
...
@@ -620,7 +620,7 @@ func TestEtcdUpdateNotScheduled(t *testing.T) {
podOut
:=
obj
.
(
*
api
.
Pod
)
podOut
:=
obj
.
(
*
api
.
Pod
)
// validChangedPod only changes the Labels, so were checking the update was valid
// validChangedPod only changes the Labels, so were checking the update was valid
if
!
api
.
Semantic
.
DeepEqual
(
podIn
.
Labels
,
podOut
.
Labels
)
{
if
!
api
.
Semantic
.
DeepEqual
(
podIn
.
Labels
,
podOut
.
Labels
)
{
t
.
Errorf
(
"objects differ: %v"
,
util
.
ObjectDiff
(
podOut
,
podIn
))
t
.
Errorf
(
"objects differ: %v"
,
diff
.
ObjectDiff
(
podOut
,
podIn
))
}
}
}
}
...
@@ -688,7 +688,7 @@ func TestEtcdUpdateScheduled(t *testing.T) {
...
@@ -688,7 +688,7 @@ func TestEtcdUpdateScheduled(t *testing.T) {
podOut
:=
obj
.
(
*
api
.
Pod
)
podOut
:=
obj
.
(
*
api
.
Pod
)
// Check to verify the Spec and Label updates match from change above. Those are the fields changed.
// Check to verify the Spec and Label updates match from change above. Those are the fields changed.
if
!
api
.
Semantic
.
DeepEqual
(
podOut
.
Spec
,
podIn
.
Spec
)
||
!
api
.
Semantic
.
DeepEqual
(
podOut
.
Labels
,
podIn
.
Labels
)
{
if
!
api
.
Semantic
.
DeepEqual
(
podOut
.
Spec
,
podIn
.
Spec
)
||
!
api
.
Semantic
.
DeepEqual
(
podOut
.
Labels
,
podIn
.
Labels
)
{
t
.
Errorf
(
"objects differ: %v"
,
util
.
ObjectDiff
(
podOut
,
podIn
))
t
.
Errorf
(
"objects differ: %v"
,
diff
.
ObjectDiff
(
podOut
,
podIn
))
}
}
}
}
...
@@ -770,6 +770,6 @@ func TestEtcdUpdateStatus(t *testing.T) {
...
@@ -770,6 +770,6 @@ func TestEtcdUpdateStatus(t *testing.T) {
if
!
api
.
Semantic
.
DeepEqual
(
podOut
.
Spec
,
podIn
.
Spec
)
||
if
!
api
.
Semantic
.
DeepEqual
(
podOut
.
Spec
,
podIn
.
Spec
)
||
!
api
.
Semantic
.
DeepEqual
(
podOut
.
Labels
,
podIn
.
Labels
)
||
!
api
.
Semantic
.
DeepEqual
(
podOut
.
Labels
,
podIn
.
Labels
)
||
!
api
.
Semantic
.
DeepEqual
(
podOut
.
Status
,
podIn
.
Status
)
{
!
api
.
Semantic
.
DeepEqual
(
podOut
.
Status
,
podIn
.
Status
)
{
t
.
Errorf
(
"objects differ: %v"
,
util
.
ObjectDiff
(
podOut
,
podIn
))
t
.
Errorf
(
"objects differ: %v"
,
diff
.
ObjectDiff
(
podOut
,
podIn
))
}
}
}
}
pkg/registry/replicaset/etcd/etcd_test.go
View file @
b0900bf0
...
@@ -30,7 +30,7 @@ import (
...
@@ -30,7 +30,7 @@ import (
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/storage/etcd/etcdtest"
"k8s.io/kubernetes/pkg/storage/etcd/etcdtest"
etcdtesting
"k8s.io/kubernetes/pkg/storage/etcd/testing"
etcdtesting
"k8s.io/kubernetes/pkg/storage/etcd/testing"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
)
)
const
defaultReplicas
=
100
const
defaultReplicas
=
100
...
@@ -277,7 +277,7 @@ func TestScaleGet(t *testing.T) {
...
@@ -277,7 +277,7 @@ func TestScaleGet(t *testing.T) {
t
.
Fatalf
(
"error fetching scale for %s: %v"
,
name
,
err
)
t
.
Fatalf
(
"error fetching scale for %s: %v"
,
name
,
err
)
}
}
if
!
api
.
Semantic
.
DeepEqual
(
got
,
want
)
{
if
!
api
.
Semantic
.
DeepEqual
(
got
,
want
)
{
t
.
Errorf
(
"unexpected scale: %s"
,
util
.
ObjectDiff
(
got
,
want
))
t
.
Errorf
(
"unexpected scale: %s"
,
diff
.
ObjectDiff
(
got
,
want
))
}
}
}
}
...
...
pkg/registry/resourcequota/etcd/etcd_test.go
View file @
b0900bf0
...
@@ -27,7 +27,7 @@ import (
...
@@ -27,7 +27,7 @@ import (
"k8s.io/kubernetes/pkg/registry/registrytest"
"k8s.io/kubernetes/pkg/registry/registrytest"
"k8s.io/kubernetes/pkg/storage/etcd/etcdtest"
"k8s.io/kubernetes/pkg/storage/etcd/etcdtest"
etcdtesting
"k8s.io/kubernetes/pkg/storage/etcd/testing"
etcdtesting
"k8s.io/kubernetes/pkg/storage/etcd/testing"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
)
)
func
newStorage
(
t
*
testing
.
T
)
(
*
REST
,
*
StatusREST
,
*
etcdtesting
.
EtcdTestServer
)
{
func
newStorage
(
t
*
testing
.
T
)
(
*
REST
,
*
StatusREST
,
*
etcdtesting
.
EtcdTestServer
)
{
...
@@ -185,6 +185,6 @@ func TestUpdateStatus(t *testing.T) {
...
@@ -185,6 +185,6 @@ func TestUpdateStatus(t *testing.T) {
rqOut
:=
obj
.
(
*
api
.
ResourceQuota
)
rqOut
:=
obj
.
(
*
api
.
ResourceQuota
)
// only compare the meaningful update b/c we can't compare due to metadata
// only compare the meaningful update b/c we can't compare due to metadata
if
!
api
.
Semantic
.
DeepEqual
(
resourcequotaIn
.
Status
,
rqOut
.
Status
)
{
if
!
api
.
Semantic
.
DeepEqual
(
resourcequotaIn
.
Status
,
rqOut
.
Status
)
{
t
.
Errorf
(
"unexpected object: %s"
,
util
.
ObjectDiff
(
resourcequotaIn
,
rqOut
))
t
.
Errorf
(
"unexpected object: %s"
,
diff
.
ObjectDiff
(
resourcequotaIn
,
rqOut
))
}
}
}
}
pkg/runtime/embedded_test.go
View file @
b0900bf0
...
@@ -26,7 +26,7 @@ import (
...
@@ -26,7 +26,7 @@ import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime/serializer"
"k8s.io/kubernetes/pkg/runtime/serializer"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
)
)
type
EmbeddedTest
struct
{
type
EmbeddedTest
struct
{
...
@@ -169,7 +169,7 @@ func TestArrayOfRuntimeObject(t *testing.T) {
...
@@ -169,7 +169,7 @@ func TestArrayOfRuntimeObject(t *testing.T) {
// we want DecodeList to set type meta if possible, even on runtime.Unknown objects
// we want DecodeList to set type meta if possible, even on runtime.Unknown objects
internal
.
Items
[
2
]
.
(
*
runtime
.
Unknown
)
.
TypeMeta
=
runtime
.
TypeMeta
{
Kind
:
"OtherTest"
,
APIVersion
:
"unknown.group/unknown"
}
internal
.
Items
[
2
]
.
(
*
runtime
.
Unknown
)
.
TypeMeta
=
runtime
.
TypeMeta
{
Kind
:
"OtherTest"
,
APIVersion
:
"unknown.group/unknown"
}
if
e
,
a
:=
internal
.
Items
,
list
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
if
e
,
a
:=
internal
.
Items
,
list
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
t
.
Errorf
(
"mismatched decoded: %s"
,
util
.
ObjectGoPrintSideBySide
(
e
,
a
))
t
.
Errorf
(
"mismatched decoded: %s"
,
diff
.
ObjectGoPrintSideBySide
(
e
,
a
))
}
}
}
}
...
...
pkg/runtime/scheme_test.go
View file @
b0900bf0
...
@@ -27,7 +27,7 @@ import (
...
@@ -27,7 +27,7 @@ import (
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime/serializer"
"k8s.io/kubernetes/pkg/runtime/serializer"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
)
)
var
fuzzIters
=
flag
.
Int
(
"fuzz-iters"
,
50
,
"How many fuzzing iterations to do."
)
var
fuzzIters
=
flag
.
Int
(
"fuzz-iters"
,
50
,
"How many fuzzing iterations to do."
)
...
@@ -239,7 +239,7 @@ func TestExternalToInternalMapping(t *testing.T) {
...
@@ -239,7 +239,7 @@ func TestExternalToInternalMapping(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"unexpected error '%v' (%v)"
,
err
,
item
.
encoded
)
t
.
Errorf
(
"unexpected error '%v' (%v)"
,
err
,
item
.
encoded
)
}
else
if
e
,
a
:=
item
.
obj
,
gotDecoded
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
}
else
if
e
,
a
:=
item
.
obj
,
gotDecoded
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
t
.
Errorf
(
"%d: unexpected objects:
\n
%s"
,
i
,
util
.
ObjectGoPrintSideBySide
(
e
,
a
))
t
.
Errorf
(
"%d: unexpected objects:
\n
%s"
,
i
,
diff
.
ObjectGoPrintSideBySide
(
e
,
a
))
}
}
}
}
}
}
...
@@ -314,7 +314,7 @@ func TestExtensionMapping(t *testing.T) {
...
@@ -314,7 +314,7 @@ func TestExtensionMapping(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"unexpected error '%v' (%v)"
,
err
,
item
.
encoded
)
t
.
Errorf
(
"unexpected error '%v' (%v)"
,
err
,
item
.
encoded
)
}
else
if
e
,
a
:=
item
.
expected
,
gotDecoded
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
}
else
if
e
,
a
:=
item
.
expected
,
gotDecoded
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
t
.
Errorf
(
"%d: unexpected objects:
\n
%s"
,
i
,
util
.
ObjectGoPrintSideBySide
(
e
,
a
))
t
.
Errorf
(
"%d: unexpected objects:
\n
%s"
,
i
,
diff
.
ObjectGoPrintSideBySide
(
e
,
a
))
}
}
}
}
}
}
...
...
pkg/runtime/serializer/codec_test.go
View file @
b0900bf0
...
@@ -28,7 +28,7 @@ import (
...
@@ -28,7 +28,7 @@ import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
"github.com/ghodss/yaml"
"github.com/ghodss/yaml"
"github.com/google/gofuzz"
"github.com/google/gofuzz"
...
@@ -187,12 +187,12 @@ func objDiff(a, b interface{}) string {
...
@@ -187,12 +187,12 @@ func objDiff(a, b interface{}) string {
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
"b"
)
panic
(
"b"
)
}
}
return
util
.
StringDiff
(
string
(
ab
),
string
(
bb
))
return
diff
.
StringDiff
(
string
(
ab
),
string
(
bb
))
// An alternate diff attempt, in case json isn't showing you
// An alternate diff attempt, in case json isn't showing you
// the difference. (reflect.DeepEqual makes a distinction between
// the difference. (reflect.DeepEqual makes a distinction between
// nil and empty slices, for example.)
// nil and empty slices, for example.)
//return
util
.StringDiff(
//return
diff
.StringDiff(
// fmt.Sprintf("%#v", a),
// fmt.Sprintf("%#v", a),
// fmt.Sprintf("%#v", b),
// fmt.Sprintf("%#v", b),
//)
//)
...
@@ -222,7 +222,7 @@ func runTest(t *testing.T, source interface{}) {
...
@@ -222,7 +222,7 @@ func runTest(t *testing.T, source interface{}) {
return
return
}
}
if
!
semantic
.
DeepEqual
(
source
,
obj2
)
{
if
!
semantic
.
DeepEqual
(
source
,
obj2
)
{
t
.
Errorf
(
"1: %v: diff: %v"
,
name
,
util
.
ObjectGoPrintSideBySide
(
source
,
obj2
))
t
.
Errorf
(
"1: %v: diff: %v"
,
name
,
diff
.
ObjectGoPrintSideBySide
(
source
,
obj2
))
return
return
}
}
obj3
:=
reflect
.
New
(
reflect
.
TypeOf
(
source
)
.
Elem
())
.
Interface
()
obj3
:=
reflect
.
New
(
reflect
.
TypeOf
(
source
)
.
Elem
())
.
Interface
()
...
...
pkg/runtime/serializer/json/json_test.go
View file @
b0900bf0
...
@@ -25,7 +25,7 @@ import (
...
@@ -25,7 +25,7 @@ import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime/serializer/json"
"k8s.io/kubernetes/pkg/runtime/serializer/json"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
)
)
type
testDecodable
struct
{
type
testDecodable
struct
{
...
@@ -244,7 +244,7 @@ func TestDecode(t *testing.T) {
...
@@ -244,7 +244,7 @@ func TestDecode(t *testing.T) {
}
}
if
!
reflect
.
DeepEqual
(
test
.
expectedObject
,
obj
)
{
if
!
reflect
.
DeepEqual
(
test
.
expectedObject
,
obj
)
{
t
.
Errorf
(
"%d: unexpected object:
\n
%s"
,
i
,
util
.
ObjectGoPrintSideBySide
(
test
.
expectedObject
,
obj
))
t
.
Errorf
(
"%d: unexpected object:
\n
%s"
,
i
,
diff
.
ObjectGoPrintSideBySide
(
test
.
expectedObject
,
obj
))
}
}
}
}
}
}
...
...
pkg/runtime/serializer/versioning/versioning_test.go
View file @
b0900bf0
...
@@ -24,7 +24,7 @@ import (
...
@@ -24,7 +24,7 @@ import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
)
)
type
testDecodable
struct
{
type
testDecodable
struct
{
...
@@ -201,11 +201,11 @@ func TestDecode(t *testing.T) {
...
@@ -201,11 +201,11 @@ func TestDecode(t *testing.T) {
switch
{
switch
{
case
test
.
expectedObject
!=
nil
:
case
test
.
expectedObject
!=
nil
:
if
!
reflect
.
DeepEqual
(
test
.
expectedObject
,
obj
)
{
if
!
reflect
.
DeepEqual
(
test
.
expectedObject
,
obj
)
{
t
.
Errorf
(
"%d: unexpected object:
\n
%s"
,
i
,
util
.
ObjectGoPrintSideBySide
(
test
.
expectedObject
,
obj
))
t
.
Errorf
(
"%d: unexpected object:
\n
%s"
,
i
,
diff
.
ObjectGoPrintSideBySide
(
test
.
expectedObject
,
obj
))
}
}
case
test
.
sameObject
!=
nil
:
case
test
.
sameObject
!=
nil
:
if
test
.
sameObject
!=
obj
{
if
test
.
sameObject
!=
obj
{
t
.
Errorf
(
"%d: unexpected object:
\n
%s"
,
i
,
util
.
ObjectGoPrintSideBySide
(
test
.
sameObject
,
obj
))
t
.
Errorf
(
"%d: unexpected object:
\n
%s"
,
i
,
diff
.
ObjectGoPrintSideBySide
(
test
.
sameObject
,
obj
))
}
}
case
obj
!=
nil
:
case
obj
!=
nil
:
t
.
Errorf
(
"%d: unexpected object: %#v"
,
i
,
obj
)
t
.
Errorf
(
"%d: unexpected object: %#v"
,
i
,
obj
)
...
...
pkg/util/diff.go
→
pkg/util/diff
/diff
.go
View file @
b0900bf0
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
package
util
package
diff
import
(
import
(
"bytes"
"bytes"
...
...
pkg/util/util_test.go
View file @
b0900bf0
...
@@ -18,10 +18,12 @@ package util
...
@@ -18,10 +18,12 @@ package util
import
(
import
(
"testing"
"testing"
"k8s.io/kubernetes/pkg/util/diff"
)
)
func
TestStringDiff
(
t
*
testing
.
T
)
{
func
TestStringDiff
(
t
*
testing
.
T
)
{
diff
:=
StringDiff
(
"aaabb"
,
"aaacc"
)
diff
:=
diff
.
StringDiff
(
"aaabb"
,
"aaacc"
)
expect
:=
"aaa
\n\n
A: bb
\n\n
B: cc
\n\n
"
expect
:=
"aaa
\n\n
A: bb
\n\n
B: cc
\n\n
"
if
diff
!=
expect
{
if
diff
!=
expect
{
t
.
Errorf
(
"diff returned %v"
,
diff
)
t
.
Errorf
(
"diff returned %v"
,
diff
)
...
...
plugin/pkg/auth/authorizer/webhook/webhook_test.go
View file @
b0900bf0
...
@@ -35,7 +35,7 @@ import (
...
@@ -35,7 +35,7 @@ import (
"k8s.io/kubernetes/pkg/auth/authorizer"
"k8s.io/kubernetes/pkg/auth/authorizer"
"k8s.io/kubernetes/pkg/auth/user"
"k8s.io/kubernetes/pkg/auth/user"
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/v1"
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/v1"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
)
)
func
TestNewFromConfig
(
t
*
testing
.
T
)
{
func
TestNewFromConfig
(
t
*
testing
.
T
)
{
...
@@ -467,7 +467,7 @@ func TestWebhook(t *testing.T) {
...
@@ -467,7 +467,7 @@ func TestWebhook(t *testing.T) {
continue
continue
}
}
if
!
reflect
.
DeepEqual
(
gotAttr
,
tt
.
want
)
{
if
!
reflect
.
DeepEqual
(
gotAttr
,
tt
.
want
)
{
t
.
Errorf
(
"case %d: got != want:
\n
%s"
,
i
,
util
.
ObjectGoPrintDiff
(
gotAttr
,
tt
.
want
))
t
.
Errorf
(
"case %d: got != want:
\n
%s"
,
i
,
diff
.
ObjectGoPrintDiff
(
gotAttr
,
tt
.
want
))
}
}
}
}
}
}
plugin/pkg/scheduler/scheduler_test.go
View file @
b0900bf0
...
@@ -30,7 +30,7 @@ import (
...
@@ -30,7 +30,7 @@ import (
"k8s.io/kubernetes/pkg/client/cache"
"k8s.io/kubernetes/pkg/client/cache"
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/diff
"
"k8s.io/kubernetes/plugin/pkg/scheduler/algorithm"
"k8s.io/kubernetes/plugin/pkg/scheduler/algorithm"
"k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/predicates"
"k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/predicates"
"k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache"
"k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache"
...
@@ -155,7 +155,7 @@ func TestScheduler(t *testing.T) {
...
@@ -155,7 +155,7 @@ func TestScheduler(t *testing.T) {
t
.
Errorf
(
"%v: error: wanted %v, got %v"
,
i
,
e
,
a
)
t
.
Errorf
(
"%v: error: wanted %v, got %v"
,
i
,
e
,
a
)
}
}
if
e
,
a
:=
item
.
expectBind
,
gotBinding
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
if
e
,
a
:=
item
.
expectBind
,
gotBinding
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
t
.
Errorf
(
"%v: error: %s"
,
i
,
util
.
ObjectDiff
(
e
,
a
))
t
.
Errorf
(
"%v: error: %s"
,
i
,
diff
.
ObjectDiff
(
e
,
a
))
}
}
<-
called
<-
called
events
.
Stop
()
events
.
Stop
()
...
@@ -268,7 +268,7 @@ func TestSchedulerForgetAssumedPodAfterDelete(t *testing.T) {
...
@@ -268,7 +268,7 @@ func TestSchedulerForgetAssumedPodAfterDelete(t *testing.T) {
Target
:
api
.
ObjectReference
{
Kind
:
"Node"
,
Name
:
"machine1"
},
Target
:
api
.
ObjectReference
{
Kind
:
"Node"
,
Name
:
"machine1"
},
}
}
if
ex
,
ac
:=
expectBind
,
gotBinding
;
!
reflect
.
DeepEqual
(
ex
,
ac
)
{
if
ex
,
ac
:=
expectBind
,
gotBinding
;
!
reflect
.
DeepEqual
(
ex
,
ac
)
{
t
.
Errorf
(
"Expected exact match on binding: %s"
,
util
.
ObjectDiff
(
ex
,
ac
))
t
.
Errorf
(
"Expected exact match on binding: %s"
,
diff
.
ObjectDiff
(
ex
,
ac
))
}
}
<-
called
<-
called
...
@@ -318,7 +318,7 @@ func TestSchedulerForgetAssumedPodAfterDelete(t *testing.T) {
...
@@ -318,7 +318,7 @@ func TestSchedulerForgetAssumedPodAfterDelete(t *testing.T) {
Target
:
api
.
ObjectReference
{
Kind
:
"Node"
,
Name
:
"machine1"
},
Target
:
api
.
ObjectReference
{
Kind
:
"Node"
,
Name
:
"machine1"
},
}
}
if
ex
,
ac
:=
expectBind
,
gotBinding
;
!
reflect
.
DeepEqual
(
ex
,
ac
)
{
if
ex
,
ac
:=
expectBind
,
gotBinding
;
!
reflect
.
DeepEqual
(
ex
,
ac
)
{
t
.
Errorf
(
"Expected exact match on binding: %s"
,
util
.
ObjectDiff
(
ex
,
ac
))
t
.
Errorf
(
"Expected exact match on binding: %s"
,
diff
.
ObjectDiff
(
ex
,
ac
))
}
}
<-
called
<-
called
events
.
Stop
()
events
.
Stop
()
...
...
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