diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2020-03-27 13:40:12 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2020-03-27 13:40:12 +0300 |
commit | 021adce4fff183aa62441fd4e155e376a1cd8e78 (patch) | |
tree | 90e05c3fbbff091a918a7404a043c72b429b61a5 /internal | |
parent | 68ba5c768ba8374be11cff13c0815d4eb3bd4571 (diff) |
Fix gitlab source cache tests duration
This reduces tests duration from 30sec to milliseconds.
Diffstat (limited to 'internal')
-rw-r--r-- | internal/source/gitlab/cache/cache_test.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/source/gitlab/cache/cache_test.go b/internal/source/gitlab/cache/cache_test.go index c3e03dec..97f0c339 100644 --- a/internal/source/gitlab/cache/cache_test.go +++ b/internal/source/gitlab/cache/cache_test.go @@ -233,14 +233,14 @@ func TestResolve(t *testing.T) { }) t.Run("when retrieval failed because of an external context being canceled", func(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - cancel() + cc := defaultCacheConfig + cc.retrievalTimeout = 0 - withTestCache(resolverConfig{}, nil, func(cache *Cache, resolver *client) { - lookup := cache.Resolve(ctx, "my.gitlab.com") + withTestCache(resolverConfig{}, &cc, func(cache *Cache, resolver *client) { + lookup := cache.Resolve(context.Background(), "my.gitlab.com") require.Equal(t, uint64(0), resolver.stats.getLookups()) - require.EqualError(t, lookup.Error, "context done") + require.EqualError(t, lookup.Error, "retrieval context done") }) }) |