Skip to content

Commit

Permalink
fix: friendly error
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Sukhin <vladislav@kubeshop.io>
  • Loading branch information
vsukhin committed Nov 27, 2024
1 parent fff63c0 commit c7bed19
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions cmd/kubectl-testkube/commands/testworkflows/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,25 +345,29 @@ func watchTestWorkflowServiceLogs(id, serviceName string, serviceIndex int,

var (
notifications chan testkube.TestWorkflowExecutionNotification
err error
nErr error
)

for {
notifications, err = client.GetTestWorkflowExecutionServiceNotifications(id, serviceName, serviceIndex)
if err != nil {
execution, err := client.GetTestWorkflowExecution(id)
if err != nil {
return nil, err
notifications, nErr = client.GetTestWorkflowExecutionServiceNotifications(id, serviceName, serviceIndex)
if nErr != nil {
execution, cErr := client.GetTestWorkflowExecution(id)
if cErr != nil {
return nil, cErr
}

if execution.Result != nil && !execution.Result.IsFinished() {
time.Sleep(serviceLogsCheckDelay)
continue
if execution.Result != nil {
if execution.Result.IsFinished() {
nErr = errors.New("test workflow execution is finished")
} else {
time.Sleep(serviceLogsCheckDelay)
continue
}
}
}

if err != nil {
return nil, err
if nErr != nil {
return nil, nErr
}

break
Expand Down

0 comments on commit c7bed19

Please sign in to comment.