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:
authorStan Hu <stanhu@gmail.com>2022-07-26 02:04:05 +0300
committerStan Hu <stanhu@gmail.com>2022-07-26 07:35:27 +0300
commit6827d12ae6e613295ce788365c08d7cab44d1f80 (patch)
treea7897c9d6eabdbc8a3126c6795ef074f1d0d6984 /internal/testhelpers
parent4d2b5871703931acb597b414d26b2e7835bad5b5 (diff)
Refactor: move test cache config into testhelpers
This reduces some code duplication. Closes https://gitlab.com/gitlab-org/gitlab-pages/-/issues/799
Diffstat (limited to 'internal/testhelpers')
-rw-r--r--internal/testhelpers/testhelpers.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/testhelpers/testhelpers.go b/internal/testhelpers/testhelpers.go
index fdd3e7d4..35fe1afa 100644
--- a/internal/testhelpers/testhelpers.go
+++ b/internal/testhelpers/testhelpers.go
@@ -8,11 +8,23 @@ import (
"net/url"
"os"
"testing"
+ "time"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/require"
+
+ "gitlab.com/gitlab-org/gitlab-pages/internal/config"
)
+var CacheConfig = config.Cache{
+ CacheExpiry: time.Second,
+ CacheCleanupInterval: time.Second / 2,
+ EntryRefreshTimeout: time.Second / 2,
+ RetrievalTimeout: time.Second,
+ MaxRetrievalInterval: time.Second / 3,
+ MaxRetrievalRetries: 3,
+}
+
// AssertRedirectTo asserts that handler redirects to particular URL
func AssertRedirectTo(t *testing.T, handler http.HandlerFunc, method string,
url string, values url.Values, expectedURL string) {