diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-12-09 11:41:04 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-12-10 18:04:03 +0300 |
commit | d5c97bec598ba8f5bee409e691279a50224f371c (patch) | |
tree | 2be7002f8b746364657db732635b4a5943d16093 /internal | |
parent | 647d47c0ab8733e3695862882af428944021da01 (diff) |
backup: Replace use of standard contexts with testhelper ones
Tests should always use the testhelper package to create contexts such
that we can benefit from the feature flag sanity checks. Convert backup
tests to do so.
Diffstat (limited to 'internal')
-rw-r--r-- | internal/backup/backup_test.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/internal/backup/backup_test.go b/internal/backup/backup_test.go index 1cbd7addb..9031cf83e 100644 --- a/internal/backup/backup_test.go +++ b/internal/backup/backup_test.go @@ -594,12 +594,15 @@ func testManagerRestoreWithContext(t *testing.T, ctx context.Context, cfg config func TestResolveSink(t *testing.T) { t.Parallel() + ctx, cancel := testhelper.Context() + defer cancel() + isStorageServiceSink := func(expErrMsg string) func(t *testing.T, sink Sink) { return func(t *testing.T, sink Sink) { t.Helper() sssink, ok := sink.(*StorageServiceSink) require.True(t, ok) - _, err := sssink.bucket.List(nil).Next(context.TODO()) + _, err := sssink.bucket.List(nil).Next(ctx) ierr, ok := err.(interface{ Unwrap() error }) require.True(t, ok) terr := ierr.Unwrap() @@ -675,7 +678,7 @@ func TestResolveSink(t *testing.T) { for k, v := range tc.envs { t.Cleanup(testhelper.ModifyEnvironment(t, k, v)) } - sink, err := ResolveSink(context.TODO(), tc.path) + sink, err := ResolveSink(ctx, tc.path) if tc.errMsg != "" { require.EqualError(t, err, tc.errMsg) return |