Skip to content

Commit

Permalink
Fix the failure message for canceled tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
gcapizzi committed Jul 13, 2022
1 parent f23d373 commit 77c5e7e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion api/repositories/task_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func taskToRecord(task *korifiv1alpha1.CFTask) TaskRecord {
if failedCond != nil && failedCond.Status == metav1.ConditionTrue {
taskRecord.FailureReason = failedCond.Message

if failedCond.Message == workloads.TaskCanceledReason {
if failedCond.Reason == workloads.TaskCanceledReason {
taskRecord.FailureReason = "task was canceled"
}
}
Expand Down
7 changes: 3 additions & 4 deletions api/repositories/task_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,9 @@ var _ = Describe("TaskRepository", func() {
BeforeEach(func() {
setStatusAndUpdate(cfTask, korifiv1alpha1.TaskInitializedConditionType, korifiv1alpha1.TaskStartedConditionType)
meta.SetStatusCondition(&(cfTask.Status.Conditions), metav1.Condition{
Type: korifiv1alpha1.TaskFailedConditionType,
Status: metav1.ConditionTrue,
Reason: "Error",
Message: "taskCanceled",
Type: korifiv1alpha1.TaskFailedConditionType,
Status: metav1.ConditionTrue,
Reason: "taskCanceled",
})
Expect(k8sClient.Status().Update(ctx, cfTask)).To(Succeed())
})
Expand Down

0 comments on commit 77c5e7e

Please sign in to comment.