mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
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:
commit
a4aaaf69e8
@ -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{
|
||||
|
Loading…
Reference in New Issue
Block a user