From 2ca7cd228c4cf57327025b7f6ce4d476813aee17 Mon Sep 17 00:00:00 2001 From: pengli Date: Tue, 4 Feb 2020 15:04:19 +0800 Subject: [PATCH] Correct the number of expected pods created in e2e test case of 'retry' --- test/retry_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/retry_test.go b/test/retry_test.go index 886380e1b72..25a5e07d592 100644 --- a/test/retry_test.go +++ b/test/retry_test.go @@ -99,17 +99,21 @@ func TestTaskRunRetry(t *testing.T) { } podNames[r.PodName] = struct{}{} } + podNames[tr.Status.PodName] = struct{}{} if len(tr.Status.RetriesStatus) != numRetries { t.Errorf("TaskRun %q had %d retriesStatuses, want %d", tr.Name, len(tr.Status.RetriesStatus), numRetries) } // There should be N Pods created, all failed, all owned by the TaskRun. pods, err := c.KubeClient.Kube.CoreV1().Pods(namespace).List(metav1.ListOptions{}) + // We expect N+1 Pods total, one for each failed and retried attempt, and one for the final attempt. + wantPods := numRetries + 1 + if err != nil { t.Fatalf("Failed to list Pods: %v", err) - } else if len(pods.Items) != numRetries { + } else if len(pods.Items) != wantPods { // TODO: Make this an error. - t.Logf("BUG: Found %d Pods, want %d", len(pods.Items), numRetries) + t.Logf("BUG: Found %d Pods, want %d", len(pods.Items), wantPods) } for _, p := range pods.Items { if _, found := podNames[p.Name]; !found {