From 709c35685eaaf261ebbb7d3420e3376a4ee8e7f2 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 7 May 2020 19:02:50 -0500 Subject: [PATCH] archiver: tests: fix test by calling NewContext() The mutex is otherwise uninitialized, so we need to ensure that we're actually initializing it if we plan to test it. --- services/archiver/archiver_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/archiver/archiver_test.go b/services/archiver/archiver_test.go index 54ea6f1f1f..77f9199788 100644 --- a/services/archiver/archiver_test.go +++ b/services/archiver/archiver_test.go @@ -75,6 +75,9 @@ func releaseOneEntry(t *testing.T, inFlight []*ArchiveRequest) { func TestArchive_Basic(t *testing.T) { assert.NoError(t, models.PrepareTestDatabase()) + // Create a new context here, because we may want to use locks or need other + // initial state here. + NewContext() archiveQueueMutex = &queueMutex archiveQueueStartCond = sync.NewCond(&queueMutex) archiveQueueReleaseCond = sync.NewCond(&queueMutex)