(t *testing.T)
| 442 | } |
| 443 | |
| 444 | func TestWaitForWorkflow(t *testing.T) { |
| 445 | // Given a workflow definition that appears after GitHub processes the pushed file |
| 446 | var attempts int |
| 447 | var sleeps []time.Duration |
| 448 | |
| 449 | // When waiting for the workflow by name |
| 450 | err := waitForWorkflow(func() ([]string, error) { |
| 451 | attempts++ |
| 452 | if attempts == 3 { |
| 453 | return []string{"Other Workflow", "Test Workflow Name"}, nil |
| 454 | } |
| 455 | return []string{"Other Workflow"}, nil |
| 456 | }, "Test Workflow Name", func(duration time.Duration) { |
| 457 | sleeps = append(sleeps, duration) |
| 458 | }) |
| 459 | |
| 460 | // Then polling continues until that exact workflow is registered |
| 461 | require.NoError(t, err) |
| 462 | assert.Equal(t, []time.Duration{workflowPollInterval, workflowPollInterval}, sleeps) |
| 463 | } |
| 464 | |
| 465 | func TestWaitForWorkflowTimesOut(t *testing.T) { |
| 466 | // Given a pushed workflow definition that never appears |
nothing calls this directly
no test coverage detected