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:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2019-11-13 15:40:18 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2019-11-13 15:40:18 +0300
commit9eb34511cf84be3caf4972d40b115d3bd1f2e295 (patch)
tree24286f74d3d30cf7037319010873ecb7f9292078 /internal/source/gitlab/cache/cache_test.go
parent66473aec0d138a013963936ae293f1484630c0de (diff)
Add more tests and fix cache entry refresh
Diffstat (limited to 'internal/source/gitlab/cache/cache_test.go')
-rw-r--r--internal/source/gitlab/cache/cache_test.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/source/gitlab/cache/cache_test.go b/internal/source/gitlab/cache/cache_test.go
index 5a885279..71212ef2 100644
--- a/internal/source/gitlab/cache/cache_test.go
+++ b/internal/source/gitlab/cache/cache_test.go
@@ -64,7 +64,7 @@ func (cache *Cache) withTestEntry(config entryConfig, block func(*Entry)) {
domain = config.domain
}
- entry := cache.store.ReplaceOrCreate(context.Background(), domain)
+ entry := cache.store.LoadOrCreate(context.Background(), domain)
if config.retrieved {
newResponse := make(chan Lookup, 1)
@@ -229,10 +229,11 @@ func TestResolve(t *testing.T) {
t.Run("when cache entry is evicted from cache", func(t *testing.T) {
withTestCache(resolverConfig{}, func(cache *Cache, resolver *client) {
cache.withTestEntry(entryConfig{expired: false, retrieved: false}, func(entry *Entry) {
+ ctx := context.Background()
lookup := make(chan *Lookup, 1)
- go func() { lookup <- cache.Resolve(context.Background(), "my.gitlab.com") }()
+ go func() { lookup <- cache.Resolve(ctx, "my.gitlab.com") }()
- cache.store.ReplaceOrCreate(context.Background(), "my.gitlab.com")
+ cache.store.ReplaceOrCreate(ctx, "my.gitlab.com", newCacheEntry(ctx, "my.gitlab.com"))
resolver.domain <- "my.gitlab.com"
<-lookup