From aa2fec4a1fda6244c22967313197a5e3b438aa6a Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Thu, 4 Feb 2021 09:19:51 -0500 Subject: [PATCH] More useful store test helper functions --- store/store_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/store/store_test.go b/store/store_test.go index c4e8a49a..053ab9b0 100644 --- a/store/store_test.go +++ b/store/store_test.go @@ -1261,10 +1261,7 @@ func Test_State(t *testing.T) { } } -func mustNewStore(inmem bool) *Store { - path := mustTempDir() - defer os.RemoveAll(path) - +func mustNewStoreAtPath(path string, inmem bool) *Store { cfg := NewDBConfig("", inmem) s := New(mustMockLister("localhost:0"), &StoreConfig{ DBConf: cfg, @@ -1277,6 +1274,10 @@ func mustNewStore(inmem bool) *Store { return s } +func mustNewStore(inmem bool) *Store { + return mustNewStoreAtPath(mustTempDir(), inmem) +} + type mockSnapshotSink struct { *os.File }