(list func() (string, error), sleep func(time.Duration))
| 53 | var errWorkflowRunRegistrationTimeout = errors.New("workflow run did not register within 60 seconds") |
| 54 | |
| 55 | func waitForWorkflowRun(list func() (string, error), sleep func(time.Duration)) (string, error) { |
| 56 | for attempt := 0; attempt < workflowPollAttempts; attempt++ { |
| 57 | runID, err := list() |
| 58 | if err != nil { |
| 59 | return "", err |
| 60 | } |
| 61 | if runID != "" { |
| 62 | return runID, nil |
| 63 | } |
| 64 | if attempt < workflowPollAttempts-1 { |
| 65 | sleep(workflowPollInterval) |
| 66 | } |
| 67 | } |
| 68 | return "", errWorkflowRunRegistrationTimeout |
| 69 | } |
| 70 | |
| 71 | func workflowRunIDFromOutput(output string) string { |
| 72 | runURL, err := url.ParseRequestURI(strings.TrimSpace(output)) |
no test coverage detected