Skip to content

Commit

Permalink
Fixed nil panic scenerios.
Browse files Browse the repository at this point in the history
Prior to this change, some test failures resulted in nil panic.
With this change, said failures will instead provide helpful error
messages.
  • Loading branch information
bendory authored and tekton-robot committed Mar 29, 2023
1 parent 3d86fa5 commit 34f35ec
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/timeout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,13 @@ spec:
if err != nil {
t.Errorf("Error getting Taskrun: %v", err)
}
if tr == nil {
t.Fatalf("no TaskRun details available")
}
if tr.Status.Steps[0].Terminated == nil {
if tr.Status.Steps[0].Terminated.Reason != "Completed" {
t.Errorf("step-no-timeout should not have been terminated")
}
t.Errorf("step-no-timeout should have Completed.")
} else if tr.Status.Steps[0].Terminated.Reason != "Completed" {
t.Errorf("step-no-timeout should not have been terminated")
}
if tr.Status.Steps[2].Terminated == nil {
t.Errorf("step-canceled should have been canceled after step-timeout timed out")
Expand Down

0 comments on commit 34f35ec

Please sign in to comment.