From 083d2120f3acf71d83b0cbe7989a425f5c620087 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 12 Oct 2017 16:06:14 +1100 Subject: [PATCH] Avoid race condition in test --- client_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client_test.go b/client_test.go index d420a78f..fc008b99 100644 --- a/client_test.go +++ b/client_test.go @@ -112,7 +112,9 @@ func TestTorrentInitialState(t *testing.T) { tor.storageOpener = storage.NewClient(storage.NewFileWithCompletion("/dev/null", storage.NewMapPieceCompletion())) // Needed to lock for asynchronous piece verification. tor.cl = new(Client) + tor.cl.mu.Lock() err := tor.setInfoBytes(mi.InfoBytes) + tor.cl.mu.Unlock() require.NoError(t, err) require.Len(t, tor.pieces, 3) tor.pendAllChunkSpecs(0)