(list func() ([]string, error), expected string, sleep func(time.Duration))
| 164 | } |
| 165 | |
| 166 | func waitForWorkflow(list func() ([]string, error), expected string, sleep func(time.Duration)) error { |
| 167 | for attempt := 0; attempt < workflowPollAttempts; attempt++ { |
| 168 | workflows, err := list() |
| 169 | if err != nil { |
| 170 | return err |
| 171 | } |
| 172 | for _, workflow := range workflows { |
| 173 | if workflow == expected { |
| 174 | return nil |
| 175 | } |
| 176 | } |
| 177 | if attempt < workflowPollAttempts-1 { |
| 178 | sleep(workflowPollInterval) |
| 179 | } |
| 180 | } |
| 181 | return fmt.Errorf("workflow %q did not register within 60 seconds", expected) |
| 182 | } |
| 183 | |
| 184 | func waitForRepositoryReady(check func() (bool, error), sleep func(time.Duration)) error { |
| 185 | for attempt := 0; attempt < repositoryReadyPollAttempts; attempt++ { |
no test coverage detected