Commit a4aaaf69 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

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 ```
parents 278b1e56 260e2aa8
......@@ -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{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment