Merge pull request #30953 from m1093782566/m109-node_status_test

Automatic merge from submit-queue

[kubelet test] Improve node status test debug info

I find the output format `%v` of glog couldn't output useful information of an `api.Node` object. The output of this line https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/kubelet_node_status_test.go#L492
is

```
kubelet_node_status_test.go:491: expected
                &TypeMeta{Kind:,APIVersion:,}
                , got
                &TypeMeta{Kind:,APIVersion:,}
```

- It's difficult for me to tell the difference between expected and got.

- I prefer to use `diff.ObjectDiff(expectedNode, updatedNode)` to output the debug information as it will point out the starting character of the different objects.

I think this line https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/kubelet_node_status_test.go#L647 can use `diff.ObjectDiff()` as well.

The related issus is #30952
pull/6/head
Kubernetes Submit Queue 2016-08-23 00:19:20 -07:00 committed by GitHub
commit f977752243
1 changed files with 3 additions and 2 deletions

View File

@ -489,7 +489,7 @@ func TestUpdateExistingNodeStatus(t *testing.T) {
}
if !api.Semantic.DeepEqual(expectedNode, updatedNode) {
t.Errorf("expected \n%v\n, got \n%v", expectedNode, updatedNode)
t.Errorf("unexpected objects: %s", diff.ObjectDiff(expectedNode, updatedNode))
}
}
@ -644,7 +644,8 @@ func TestUpdateExistingNodeOutOfDiskStatusWithTransitionFrequency(t *testing.T)
}
if !reflect.DeepEqual(tc.expected, oodCondition) {
t.Errorf("%d.\nwant \n%v\n, got \n%v", tcIdx, tc.expected, oodCondition)
t.Errorf("%d.\nunexpected objects: %s", tcIdx, diff.ObjectDiff(tc.expected, oodCondition))
}
}
}