summary refs log tree commit diff stats
path: root/svc/cache_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'svc/cache_test.go')
-rw-r--r--svc/cache_test.go28
1 files changed, 10 insertions, 18 deletions
diff --git a/svc/cache_test.go b/svc/cache_test.go
index 28e5c0b..2177917 100644
--- a/svc/cache_test.go
+++ b/svc/cache_test.go
@@ -4,26 +4,9 @@ import (
 	"testing"
 )
 
-func Test_cacheUpdate(t *testing.T) {
-	initTestConf()
-	confObj.Mu.RLock()
-	prevtime := confObj.LastCache
-	confObj.Mu.RUnlock()
-
-	t.Run("Cache Time Check", func(t *testing.T) {
-		cacheUpdate()
-		confObj.Mu.RLock()
-		newtime := confObj.LastCache
-		confObj.Mu.RUnlock()
-
-		if !newtime.After(prevtime) || newtime == prevtime {
-			t.Errorf("Cache time did not update, check cacheUpdate() logic\n")
-		}
-	})
-}
-
 func Benchmark_cacheUpdate(b *testing.B) {
 	initTestConf()
+	mockRegistry()
 	b.ResetTimer()
 
 	for i := 0; i < b.N; i++ {
@@ -37,5 +20,14 @@ func Benchmark_pingAssets(b *testing.B) {
 
 	for i := 0; i < b.N; i++ {
 		pingAssets()
+
+		// We'll only have to reload the cache occasionally,
+		// so only start with an empty staticCache 25% of
+		// the time.
+		if float64(i) > (float64(b.N) * .75) {
+			b.StopTimer()
+			staticCache = &staticAssets{}
+			b.StartTimer()
+		}
 	}
 }