Skip to content

Commit

Permalink
fix TestGithubSecondCancelInProgress test conditio
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
chmouel committed Jan 28, 2025
1 parent e03c04f commit 4a0d7a8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/github_pullrequest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4a0d7a8

Please sign in to comment.