Refactor diff into sub pkg

This commit is contained in:
harry
2016-03-11 10:43:55 +08:00
committed by Harry Zhang
parent d6e1566509
commit b0900bf0d4
36 changed files with 92 additions and 85 deletions

View File

@@ -35,7 +35,7 @@ import (
"k8s.io/kubernetes/pkg/auth/authorizer"
"k8s.io/kubernetes/pkg/auth/user"
"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) {
@@ -467,7 +467,7 @@ func TestWebhook(t *testing.T) {
continue
}
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))
}
}
}

View File

@@ -30,7 +30,7 @@ import (
"k8s.io/kubernetes/pkg/client/cache"
"k8s.io/kubernetes/pkg/client/record"
"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/predicates"
"k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache"
@@ -155,7 +155,7 @@ func TestScheduler(t *testing.T) {
t.Errorf("%v: error: wanted %v, got %v", i, 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
events.Stop()
@@ -268,7 +268,7 @@ func TestSchedulerForgetAssumedPodAfterDelete(t *testing.T) {
Target: api.ObjectReference{Kind: "Node", Name: "machine1"},
}
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
@@ -318,7 +318,7 @@ func TestSchedulerForgetAssumedPodAfterDelete(t *testing.T) {
Target: api.ObjectReference{Kind: "Node", Name: "machine1"},
}
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
events.Stop()