Merge pull request #45769 from zhangxiaoyu-zidif/add-describe-pod-node

Automatic merge from submit-queue

describe pod: add unit test for Node

**What this PR does / why we need it**:

Add unit test for "describe pod" in order to get node info.

**Release note**:

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2017-05-16 08:17:17 -07:00 committed by GitHub
commit a4aaaf69e8

View File

@ -70,6 +70,30 @@ func TestDescribePod(t *testing.T) {
}
}
func TestDescribePodNode(t *testing.T) {
fake := fake.NewSimpleClientset(&api.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "bar",
Namespace: "foo",
},
Spec: api.PodSpec{
NodeName: "all-in-one",
},
Status: api.PodStatus{
HostIP: "127.0.0.1",
},
})
c := &describeClient{T: t, Namespace: "foo", Interface: fake}
d := PodDescriber{c}
out, err := d.Describe("foo", "bar", printers.DescriberSettings{ShowEvents: true})
if err != nil {
t.Errorf("unexpected error: %v", err)
}
if !strings.Contains(out, "all-in-one/127.0.0.1") {
t.Errorf("unexpected out: %s", out)
}
}
func TestDescribePodTolerations(t *testing.T) {
fake := fake.NewSimpleClientset(&api.Pod{
ObjectMeta: metav1.ObjectMeta{