From ab366112d87ec1aeabcb2857ae8a0c60528ccf14 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Thu, 11 Feb 2016 11:09:09 -0800 Subject: [PATCH] fix race conditions in tests License: MIT Signed-off-by: Jeromy --- mock/centralized_server.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mock/centralized_server.go b/mock/centralized_server.go index 8e8d5d0..c05ca94 100644 --- a/mock/centralized_server.go +++ b/mock/centralized_server.go @@ -6,6 +6,7 @@ import ( "time" ds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/ipfs/go-datastore" + dssync "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/ipfs/go-datastore/sync" key "github.com/ipfs/go-ipfs/blocks/key" "github.com/ipfs/go-ipfs/util/testutil" peer "gx/ipfs/QmUBogf4nUefBjmYjn6jfsfPJRkmDGSeMhNj4usRKq69f4/go-libp2p/p2p/peer" @@ -74,7 +75,7 @@ func (rs *s) Providers(k key.Key) []peer.PeerInfo { } func (rs *s) Client(p testutil.Identity) Client { - return rs.ClientWithDatastore(context.Background(), p, ds.NewMapDatastore()) + return rs.ClientWithDatastore(context.Background(), p, dssync.MutexWrap(ds.NewMapDatastore())) } func (rs *s) ClientWithDatastore(_ context.Context, p testutil.Identity, datastore ds.Datastore) Client { -- GitLab