Skip to content

Commit

Permalink
fix: nil pointer in compose slack message (#5011)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicufk authored Feb 14, 2024
1 parent 74e2526 commit c997b88
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pkg/slack/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,17 +221,25 @@ func (s *Notifier) composeTestMessage(execution *testkube.Execution, eventType t
Labels: testkube.MapToString(execution.Labels),
TestName: execution.TestName,
TestType: execution.TestType,
Status: string(*execution.ExecutionResult.Status),
Status: string(testkube.QUEUED_ExecutionStatus),
StartTime: execution.StartTime.String(),
EndTime: execution.EndTime.String(),
Duration: execution.Duration,
TotalSteps: len(execution.ExecutionResult.Steps),
FailedSteps: execution.ExecutionResult.FailedStepsCount(),
TotalSteps: 0,
FailedSteps: 0,
ClusterName: s.clusterName,
DashboardURI: s.dashboardURI,
Envs: s.envs,
}

if execution.ExecutionResult != nil {
if execution.ExecutionResult.Status != nil {
args.Status = string(*execution.ExecutionResult.Status)
}
args.TotalSteps = len(execution.ExecutionResult.Steps)
args.FailedSteps = execution.ExecutionResult.FailedStepsCount()
}

log.DefaultLogger.Infow("Execution changed", "status", execution.ExecutionResult.Status)

var message bytes.Buffer
Expand Down

0 comments on commit c997b88

Please sign in to comment.