From 81e944d587622925afd263d7223e1709ce6091c9 Mon Sep 17 00:00:00 2001 From: Philipp Matthes Date: Mon, 29 Apr 2024 10:00:08 +0200 Subject: [PATCH] Cleanup cache in index test before performing testing actions --- histories/index_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/histories/index_test.go b/histories/index_test.go index c022f09..1702f1e 100644 --- a/histories/index_test.go +++ b/histories/index_test.go @@ -11,6 +11,11 @@ import ( ) func TestHistoryIndex(t *testing.T) { + // Cleanup the history + cache.Range(func(key interface{}, value interface{}) bool { + cache.Delete(key) + return true + }) // Write some dummy histories in the cache. tempDir := t.TempDir() exampleCycle := HistoryCycle{ @@ -83,6 +88,6 @@ func TestHistoryIndex(t *testing.T) { // Using deep equals here is fine if !reflect.DeepEqual(unmarshaledIndex, expectedIndex) { - t.Errorf("expected index does not correspond with unmarshaled index") + t.Errorf("expected index does not correspond with unmarshaled index: %v != %v", expectedIndex, unmarshaledIndex) } }