diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/source/gitlab/cache/cache_test.go | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/internal/source/gitlab/cache/cache_test.go b/internal/source/gitlab/cache/cache_test.go index b92aa617..aad357ae 100644 --- a/internal/source/gitlab/cache/cache_test.go +++ b/internal/source/gitlab/cache/cache_test.go @@ -107,17 +107,10 @@ func TestResolve(t *testing.T) { withTestCache(resolverConfig{bufferSize: 1}, cc, func(cache *Cache, resolver *clientMock) { require.Equal(t, 0, len(resolver.lookups)) - go func() { - lookup := cache.Resolve(context.Background(), "foo.gitlab.com") - require.ErrorIs(t, lookup.Error, context.DeadlineExceeded) - require.Equal(t, "foo.gitlab.com", lookup.Name) - }() - - // wait for retrieval timeout to expire, then send a response to the retriever - time.Sleep(2 * time.Second) - - // the ctx should be expired and the goroutine should receive an error - resolver.domain <- "foo.gitlab.com" + // wait for retrieval timeout to expire + lookup := cache.Resolve(context.Background(), "foo.gitlab.com") + require.ErrorIs(t, lookup.Error, context.DeadlineExceeded) + require.Equal(t, "foo.gitlab.com", lookup.Name) // future lookups should succeed once the entry has been refreshed. // refresh happens in a separate goroutine so the first few requests might still fail |