(view func() (string, error), expected string, sleep func(time.Duration))
| 198 | } |
| 199 | |
| 200 | func waitForWorkflowRunStatus(view func() (string, error), expected string, sleep func(time.Duration)) error { |
| 201 | for attempt := 0; attempt < workflowRunStatusPollAttempts; attempt++ { |
| 202 | status, err := view() |
| 203 | if err != nil { |
| 204 | return err |
| 205 | } |
| 206 | if status == expected { |
| 207 | return nil |
| 208 | } |
| 209 | if status == "completed" { |
| 210 | return fmt.Errorf("workflow run completed before reaching status %q", expected) |
| 211 | } |
| 212 | if attempt < workflowRunStatusPollAttempts-1 { |
| 213 | sleep(workflowRunStatusPollInterval) |
| 214 | } |
| 215 | } |
| 216 | return fmt.Errorf("workflow run did not reach status %q within 60 seconds", expected) |
| 217 | } |
| 218 | |
| 219 | func outputForEnvironment(output string) (string, error) { |
| 220 | if strings.TrimSpace(output) == "" { |
no test coverage detected