diff --git a/epictest/addcat_test.go b/epictest/addcat_test.go index e85dbfd312de..298c252cc2fa 100644 --- a/epictest/addcat_test.go +++ b/epictest/addcat_test.go @@ -106,7 +106,7 @@ func AddCatBytes(conf Config) error { ) local := sesgen.Next() - local.Configure(bitswap.BlockstoreLatency(0)) // set latency to zero during local add + local.SetBlockstoreLatency(0) // set latency to zero during local add node, err := importer.BuildDagFromReader( bytes.NewReader(data.Bytes()), merkledag.NewDAGService(&blockservice.BlockService{local.Blockstore(), local.Exchange}), @@ -120,10 +120,10 @@ func AddCatBytes(conf Config) error { if err != nil { return err } - local.Configure(bitswap.BlockstoreLatency(conf.BlockstoreLatency)) // add some blockstore delay to make the requestor wait + local.SetBlockstoreLatency(conf.BlockstoreLatency) // add some blockstore delay to make the requestor wait remote := sesgen.Next() - remote.Configure(bitswap.BlockstoreLatency(conf.BlockstoreLatency)) + remote.SetBlockstoreLatency(conf.BlockstoreLatency) remotedag := merkledag.NewDAGService(&blockservice.BlockService{remote.Blockstore(), remote.Exchange}) dagnode, err := (&path.Resolver{remotedag}).ResolvePath(k.String()) if err != nil { diff --git a/exchange/bitswap/testutils.go b/exchange/bitswap/testutils.go index a1d48554afd5..fdb7bdd5260b 100644 --- a/exchange/bitswap/testutils.go +++ b/exchange/bitswap/testutils.go @@ -58,19 +58,8 @@ func (i *Instance) Blockstore() blockstore.Blockstore { return i.blockstore } -type IOption func(*Instance) IOption - -func (i *Instance) Configure(opt IOption) IOption { - prev := opt(i) - return prev -} - -// TODO move all of this to a mock package -func BlockstoreLatency(d time.Duration) IOption { - return func(i *Instance) IOption { - prev := i.blockstoreDelay.Set(d) - return BlockstoreLatency(prev) - } +func (i *Instance) SetBlockstoreLatency(t time.Duration) time.Duration { + return i.blockstoreDelay.Set(t) } // session creates a test bitswap session.