(t *testing.T)
| 463 | } |
| 464 | |
| 465 | func TestWaitForWorkflowTimesOut(t *testing.T) { |
| 466 | // Given a pushed workflow definition that never appears |
| 467 | var attempts int |
| 468 | var sleeps int |
| 469 | |
| 470 | // When waiting for the workflow by name |
| 471 | err := waitForWorkflow(func() ([]string, error) { |
| 472 | attempts++ |
| 473 | return []string{"Other Workflow"}, nil |
| 474 | }, "Test Workflow Name", func(time.Duration) { |
| 475 | sleeps++ |
| 476 | }) |
| 477 | |
| 478 | // Then the wait stops after one minute |
| 479 | require.EqualError(t, err, `workflow "Test Workflow Name" did not register within 60 seconds`) |
| 480 | assert.Equal(t, 13, attempts) |
| 481 | assert.Equal(t, 12, sleeps) |
| 482 | } |
| 483 | |
| 484 | func TestWaitForRepositoryReady(t *testing.T) { |
| 485 | // Given a repository whose initialized default branch appears after creation |
nothing calls this directly
no test coverage detected