From 98880edbf36b274614f141d0e4072956cfa6000f Mon Sep 17 00:00:00 2001 From: tanshanshan Date: Fri, 10 Aug 2018 11:31:09 +0800 Subject: [PATCH] add ns for pod in integration test --- test/integration/scheduler/preemption_test.go | 22 +++++++++---------- test/integration/scheduler/util.go | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/test/integration/scheduler/preemption_test.go b/test/integration/scheduler/preemption_test.go index d5832a0bd8..2c85fd7513 100644 --- a/test/integration/scheduler/preemption_test.go +++ b/test/integration/scheduler/preemption_test.go @@ -52,7 +52,7 @@ func waitForNominatedNodeNameWithTimeout(cs clientset.Interface, pod *v1.Pod, ti } return false, err }); err != nil { - return fmt.Errorf("Pod %v annotation did not get set: %v", pod.Name, err) + return fmt.Errorf("Pod %v/%v annotation did not get set: %v", pod.Namespace, pod.Name, err) } return nil } @@ -268,7 +268,7 @@ func TestPreemption(t *testing.T) { for i, p := range pods { if _, found := test.preemptedPodIndexes[i]; found { if err = wait.Poll(time.Second, wait.ForeverTestTimeout, podIsGettingEvicted(cs, p.Namespace, p.Name)); err != nil { - t.Errorf("Test [%v]: Pod %v is not getting evicted.", test.description, p.Name) + t.Errorf("Test [%v]: Pod %v/%v is not getting evicted.", test.description, p.Namespace, p.Name) } } else { if p.DeletionTimestamp != nil { @@ -450,7 +450,7 @@ func TestPreemptionStarvation(t *testing.T) { // make sure that runningPods are all scheduled. for _, p := range runningPods { if err := waitForPodToSchedule(cs, p); err != nil { - t.Fatalf("Pod %v didn't get scheduled: %v", p.Name, err) + t.Fatalf("Pod %v/%v didn't get scheduled: %v", p.Namespace, p.Name, err) } } // Create pending pods. @@ -464,7 +464,7 @@ func TestPreemptionStarvation(t *testing.T) { for _, p := range pendingPods { if err := wait.Poll(100*time.Millisecond, wait.ForeverTestTimeout, podUnschedulable(cs, p.Namespace, p.Name)); err != nil { - t.Errorf("Pod %v didn't get marked unschedulable: %v", p.Name, err) + t.Errorf("Pod %v/%v didn't get marked unschedulable: %v", p.Namespace, p.Name, err) } } // Create the preemptor. @@ -474,7 +474,7 @@ func TestPreemptionStarvation(t *testing.T) { } // Check that the preemptor pod gets the annotation for nominated node name. if err := waitForNominatedNodeName(cs, preemptor); err != nil { - t.Errorf("Test [%v]: NominatedNodeName annotation was not set for pod %v: %v", test.description, preemptor.Name, err) + t.Errorf("Test [%v]: NominatedNodeName annotation was not set for pod %v/%v: %v", test.description, preemptor.Namespace, preemptor.Name, err) } // Make sure that preemptor is scheduled after preemptions. if err := waitForPodToScheduleWithTimeout(cs, preemptor, 60*time.Second); err != nil { @@ -532,7 +532,7 @@ func TestNominatedNodeCleanUp(t *testing.T) { // make sure that the pods are all scheduled. for _, p := range lowPriPods { if err := waitForPodToSchedule(cs, p); err != nil { - t.Fatalf("Pod %v didn't get scheduled: %v", p.Name, err) + t.Fatalf("Pod %v/%v didn't get scheduled: %v", p.Namespace, p.Name, err) } } // Step 2. Create a medium priority pod. @@ -551,7 +551,7 @@ func TestNominatedNodeCleanUp(t *testing.T) { } // Step 3. Check that nominated node name of the medium priority pod is set. if err := waitForNominatedNodeName(cs, medPriPod); err != nil { - t.Errorf("NominatedNodeName annotation was not set for pod %v: %v", medPriPod.Name, err) + t.Errorf("NominatedNodeName annotation was not set for pod %v/%v: %v", medPriPod.Namespace, medPriPod.Name, err) } // Step 4. Create a high priority pod. podConf = initPausePod(cs, &pausePodConfig{ @@ -569,7 +569,7 @@ func TestNominatedNodeCleanUp(t *testing.T) { } // Step 5. Check that nominated node name of the high priority pod is set. if err := waitForNominatedNodeName(cs, highPriPod); err != nil { - t.Errorf("NominatedNodeName annotation was not set for pod %v: %v", medPriPod.Name, err) + t.Errorf("NominatedNodeName annotation was not set for pod %v/%v: %v", medPriPod.Namespace, medPriPod.Name, err) } // And the nominated node name of the medium priority pod is cleared. if err := wait.Poll(100*time.Millisecond, wait.ForeverTestTimeout, func() (bool, error) { @@ -856,18 +856,18 @@ func TestPDBInPreemption(t *testing.T) { for i, p := range pods { if _, found := test.preemptedPodIndexes[i]; found { if err = wait.Poll(time.Second, wait.ForeverTestTimeout, podIsGettingEvicted(cs, p.Namespace, p.Name)); err != nil { - t.Errorf("Test [%v]: Pod %v is not getting evicted.", test.description, p.Name) + t.Errorf("Test [%v]: Pod %v/%v is not getting evicted.", test.description, p.Namespace, p.Name) } } else { if p.DeletionTimestamp != nil { - t.Errorf("Test [%v]: Didn't expect pod %v to get preempted.", test.description, p.Name) + t.Errorf("Test [%v]: Didn't expect pod %v/%v to get preempted.", test.description, p.Namespace, p.Name) } } } // Also check that the preemptor pod gets the annotation for nominated node name. if len(test.preemptedPodIndexes) > 0 { if err := waitForNominatedNodeName(cs, preemptor); err != nil { - t.Errorf("Test [%v]: NominatedNodeName annotation was not set for pod %v: %v", test.description, preemptor.Name, err) + t.Errorf("Test [%v]: NominatedNodeName annotation was not set for pod %v/%v: %v", test.description, preemptor.Namespace, preemptor.Name, err) } } diff --git a/test/integration/scheduler/util.go b/test/integration/scheduler/util.go index a2f954109f..1c431fbb8f 100644 --- a/test/integration/scheduler/util.go +++ b/test/integration/scheduler/util.go @@ -483,10 +483,10 @@ func runPausePod(cs clientset.Interface, pod *v1.Pod) (*v1.Pod, error) { return nil, fmt.Errorf("Error creating pause pod: %v", err) } if err = waitForPodToSchedule(cs, pod); err != nil { - return pod, fmt.Errorf("Pod %v didn't schedule successfully. Error: %v", pod.Name, err) + return pod, fmt.Errorf("Pod %v/%v didn't schedule successfully. Error: %v", pod.Namespace, pod.Name, err) } if pod, err = cs.CoreV1().Pods(pod.Namespace).Get(pod.Name, metav1.GetOptions{}); err != nil { - return pod, fmt.Errorf("Error getting pod %v info: %v", pod.Name, err) + return pod, fmt.Errorf("Error getting pod %v/%v info: %v", pod.Namespace, pod.Name, err) } return pod, nil }