From 4a0d7a806ea417cbd3253372d39d8a1e7e84bc5b Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Mon, 27 Jan 2025 09:12:56 +0100 Subject: [PATCH] fix TestGithubSecondCancelInProgress test conditio fixing this crash when running the e2e test, do not occur all the time only when the tetkon is slow to act: --- FAIL: TestGithubSecondCancelInProgress (17.21s) panic: runtime error: index out of range [0] with length 0 [recovered] --- test/github_pullrequest_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/github_pullrequest_test.go b/test/github_pullrequest_test.go index 0aa956f38..f6168ae24 100644 --- a/test/github_pullrequest_test.go +++ b/test/github_pullrequest_test.go @@ -327,6 +327,9 @@ func TestGithubSecondCancelInProgress(t *testing.T) { if pr.GetStatusCondition() == nil { continue } + if len(pr.Status.Conditions) == 0 { + continue + } if pr.Status.Conditions[0].Reason == "Cancelled" { g.Cnx.Clients.Log.Infof("PipelineRun %s has been canceled", pr.Name) foundCancelled = true