Repository navigation
ci(e2e): test the latest microsandbox provider release #1802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c204f83
1b557d6
bd836da
4565236
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -708,6 +708,8 @@ func TestIsRetryableProviderDownloadError(t *testing.T) { | |
| retryable := []string{ | ||
| "download: received status code 504 when trying to download https://github.com/o/r/provider.yaml", | ||
| "download failed with status 502", | ||
| "download failed with status 503: checksum service temporarily unavailable", | ||
| "Get \"https://github.com/o/checksum-provider\": net/http: TLS handshake timeout", | ||
| "Get \"https://github.com\": net/http: TLS handshake timeout", | ||
| "read tcp: connection reset by peer", | ||
| "download file: stalled: no progress within timeout", | ||
|
|
@@ -718,6 +720,12 @@ func TestIsRetryableProviderDownloadError(t *testing.T) { | |
| permanent := []string{ | ||
| "download: received status code 404 when trying to download https://github.com/o/r/provider.yaml", | ||
| "download failed with status 403", | ||
| "download failed with status 408", | ||
| "received status code 404: unexpected EOF", | ||
| "download failed with status 403 after status 502", | ||
| "external runtime executable checksum verification failed", | ||
| "checksum verification failed after connection reset by peer", | ||
| "unexpected file checksum abc != def after connection reset by peer", | ||
| "provider microsandbox already exists", | ||
| "validate: exec.command is required", | ||
| } | ||
|
|
@@ -728,21 +736,62 @@ func TestIsRetryableProviderDownloadError(t *testing.T) { | |
|
|
||
| func TestExecWithProviderAddRetryRecoversFromServerErrors(t *testing.T) { | ||
| original := providerAddBackoff | ||
| providerAddBackoff = wait.Backoff{Steps: 4, Duration: time.Millisecond, Factor: 1} | ||
| providerAddBackoff.Duration = time.Millisecond | ||
| providerAddBackoff.Factor = 1 | ||
| providerAddBackoff.Jitter = 0 | ||
| t.Cleanup(func() { providerAddBackoff = original }) | ||
| attempts := 0 | ||
| _, err := execWithProviderAddRetry( | ||
| context.Background(), | ||
| func(context.Context) (string, string, error) { | ||
| attempts++ | ||
| if attempts < 3 { | ||
| if attempts < 6 { | ||
| return "", providerServerFailure, errExitOne | ||
| } | ||
| return "", "", nil | ||
| }, | ||
| ) | ||
| require.NoError(t, err) | ||
| assert.Equal(t, 3, attempts) | ||
| assert.Equal(t, 6, attempts) | ||
| } | ||
|
|
||
| func TestExecWithProviderAddRetryPreservesAttemptDeadline(t *testing.T) { | ||
| ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute) | ||
| defer cancel() | ||
| wantDeadline, ok := ctx.Deadline() | ||
| require.True(t, ok) | ||
| _, err := execWithProviderAddRetry( | ||
| ctx, | ||
| func(ctx context.Context) (string, string, error) { | ||
| deadline, ok := ctx.Deadline() | ||
| require.True(t, ok) | ||
| assert.Equal(t, wantDeadline, deadline) | ||
| return "", "", nil | ||
| }, | ||
| ) | ||
| require.NoError(t, err) | ||
| } | ||
|
|
||
| func TestExecWithProviderAddRetryPropagatesActiveDeadline(t *testing.T) { | ||
| ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| defer cancel() | ||
| attempts := 0 | ||
| _, err := execWithProviderAddRetry( | ||
| ctx, | ||
| func(ctx context.Context) (string, string, error) { | ||
| attempts++ | ||
| timer := time.NewTimer(time.Second) | ||
| defer timer.Stop() | ||
| select { | ||
| case <-ctx.Done(): | ||
| return "", "", ctx.Err() | ||
| case <-timer.C: | ||
| return "", "", errors.New("provider attempt lost caller deadline") | ||
| } | ||
| }, | ||
| ) | ||
| require.ErrorIs(t, err, context.DeadlineExceeded) | ||
| assert.Equal(t, 1, attempts) | ||
| } | ||
|
|
||
| func TestExecWithProviderAddRetrySkipsClientErrors(t *testing.T) { | ||
|
|
@@ -764,7 +813,9 @@ func TestExecWithProviderAddRetrySkipsClientErrors(t *testing.T) { | |
|
|
||
| func TestExecWithProviderAddRetryStopsAtBudget(t *testing.T) { | ||
| original := providerAddBackoff | ||
| providerAddBackoff = wait.Backoff{Steps: 3, Duration: time.Millisecond, Factor: 1} | ||
| providerAddBackoff.Duration = time.Millisecond | ||
| providerAddBackoff.Factor = 1 | ||
| providerAddBackoff.Jitter = 0 | ||
| t.Cleanup(func() { providerAddBackoff = original }) | ||
| attempts := 0 | ||
| _, err := execWithProviderAddRetry( | ||
|
|
@@ -774,8 +825,8 @@ func TestExecWithProviderAddRetryStopsAtBudget(t *testing.T) { | |
| return "", providerServerFailure, errExitOne | ||
| }, | ||
| ) | ||
| require.ErrorContains(t, err, "after 3 attempts") | ||
| assert.Equal(t, 3, attempts) | ||
| require.ErrorContains(t, err, fmt.Sprintf("after %d attempts", original.Steps)) | ||
| assert.Equal(t, original.Steps, attempts) | ||
| } | ||
|
|
||
| func TestSeedProviderDownloadCache(t *testing.T) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.