Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'internal/source/gitlab/gitlab_test.go')
-rw-r--r--internal/source/gitlab/gitlab_test.go16
1 files changed, 3 insertions, 13 deletions
diff --git a/internal/source/gitlab/gitlab_test.go b/internal/source/gitlab/gitlab_test.go
index 5a63edf2..df8299de 100644
--- a/internal/source/gitlab/gitlab_test.go
+++ b/internal/source/gitlab/gitlab_test.go
@@ -8,27 +8,17 @@ import (
"os"
"sync"
"testing"
- "time"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
- "gitlab.com/gitlab-org/gitlab-pages/internal/config"
"gitlab.com/gitlab-org/gitlab-pages/internal/source/gitlab/api"
"gitlab.com/gitlab-org/gitlab-pages/internal/source/gitlab/cache"
"gitlab.com/gitlab-org/gitlab-pages/internal/source/gitlab/client"
"gitlab.com/gitlab-org/gitlab-pages/internal/source/gitlab/mock"
+ "gitlab.com/gitlab-org/gitlab-pages/internal/testhelpers"
)
-var testCacheConfig = config.Cache{
- CacheExpiry: time.Second,
- CacheCleanupInterval: time.Second / 2,
- EntryRefreshTimeout: time.Second / 2,
- RetrievalTimeout: time.Second,
- MaxRetrievalInterval: time.Second / 3,
- MaxRetrievalRetries: 3,
-}
-
type lookupPathTest struct {
file string
target string
@@ -171,7 +161,7 @@ func TestResolveLookupPathsConcurrentNetRequests(t *testing.T) {
t.Run(name, func(t *testing.T) {
wg := &sync.WaitGroup{}
mockClient := NewMockClient(t, test.file, nil, true)
- cache := cache.NewCache(mockClient, &testCacheConfig)
+ cache := cache.NewCache(mockClient, &testhelpers.CacheConfig)
for i := 0; i < 3; i++ {
go sendResolveRequest(t, wg, cache, test)
@@ -207,7 +197,7 @@ func TestResolveLookupPathsOrderDoesNotMatter(t *testing.T) {
for name, test := range tests {
t.Run(name, func(t *testing.T) {
mockClient := NewMockClient(t, test.file, nil, true)
- cache := cache.NewCache(mockClient, &testCacheConfig)
+ cache := cache.NewCache(mockClient, &testhelpers.CacheConfig)
source := Gitlab{client: cache, enableDisk: true}
request := httptest.NewRequest(http.MethodGet, test.target, nil)