Skip to content

Commit e8c41b8

Browse files
author
Kenichi Omichi
committed
Remove printOnce() on e2e tests
Originally, printOnce() was implemented for printing debugging message once for checking actual value is the same as expected value. However even if an error doesn't happen in ExpectEqual(), printOnce() is called internally. Then the second ExpectEqual() doesn't output the debugging message if an error happens. This makes debugging difficult, let's just remove it for debugging.
1 parent 072528e commit e8c41b8

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

test/e2e/scheduling/predicates.go

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -745,35 +745,17 @@ func verifyResult(c clientset.Interface, expectedScheduled int, expectedNotSched
745745
framework.ExpectNoError(err)
746746
scheduledPods, notScheduledPods := e2epod.GetPodsScheduled(masterNodes, allPods)
747747

748-
printed := false
749-
printOnce := func(msg string) string {
750-
if !printed {
751-
printed = true
752-
return msg
753-
}
754-
return ""
755-
}
756-
757-
framework.ExpectEqual(len(notScheduledPods), expectedNotScheduled, printOnce(fmt.Sprintf("Not scheduled Pods: %#v", notScheduledPods)))
758-
framework.ExpectEqual(len(scheduledPods), expectedScheduled, printOnce(fmt.Sprintf("Scheduled Pods: %#v", scheduledPods)))
748+
framework.ExpectEqual(len(notScheduledPods), expectedNotScheduled, fmt.Sprintf("Not scheduled Pods: %#v", notScheduledPods))
749+
framework.ExpectEqual(len(scheduledPods), expectedScheduled, fmt.Sprintf("Scheduled Pods: %#v", scheduledPods))
759750
}
760751

761752
// verifyReplicasResult is wrapper of verifyResult for a group pods with same "name: labelName" label, which means they belong to same RC
762753
func verifyReplicasResult(c clientset.Interface, expectedScheduled int, expectedNotScheduled int, ns string, labelName string) {
763754
allPods := getPodsByLabels(c, ns, map[string]string{"name": labelName})
764755
scheduledPods, notScheduledPods := e2epod.GetPodsScheduled(masterNodes, allPods)
765756

766-
printed := false
767-
printOnce := func(msg string) string {
768-
if !printed {
769-
printed = true
770-
return msg
771-
}
772-
return ""
773-
}
774-
775-
framework.ExpectEqual(len(notScheduledPods), expectedNotScheduled, printOnce(fmt.Sprintf("Not scheduled Pods: %#v", notScheduledPods)))
776-
framework.ExpectEqual(len(scheduledPods), expectedScheduled, printOnce(fmt.Sprintf("Scheduled Pods: %#v", scheduledPods)))
757+
framework.ExpectEqual(len(notScheduledPods), expectedNotScheduled, fmt.Sprintf("Not scheduled Pods: %#v", notScheduledPods))
758+
framework.ExpectEqual(len(scheduledPods), expectedScheduled, fmt.Sprintf("Scheduled Pods: %#v", scheduledPods))
777759
}
778760

779761
func getPodsByLabels(c clientset.Interface, ns string, labelsMap map[string]string) *v1.PodList {

0 commit comments

Comments
 (0)