Commit 58526b25 authored by Jakub Sztandera's avatar Jakub Sztandera

blocks/blockstore: shift insertion of TODO context to tests

License: MIT
Signed-off-by: default avatarJakub Sztandera <kubuxu@protonmail.ch>
parent af777821
......@@ -15,6 +15,9 @@ import (
)
func testBloomCached(bs GCBlockstore, ctx context.Context) (*bloomcache, error) {
if ctx == nil {
ctx = context.TODO()
}
opts := DefaultCacheOpts()
bbs, err := CachedBlockstore(bs, ctx, opts)
if err == nil {
......@@ -26,11 +29,11 @@ func testBloomCached(bs GCBlockstore, ctx context.Context) (*bloomcache, error)
func TestReturnsErrorWhenSizeNegative(t *testing.T) {
bs := NewBlockstore(syncds.MutexWrap(ds.NewMapDatastore()))
_, err := bloomCached(bs, nil, 100, 1, -1)
_, err := bloomCached(bs, context.TODO(), 100, 1, -1)
if err == nil {
t.Fail()
}
_, err = bloomCached(bs, nil, -1, 1, 100)
_, err = bloomCached(bs, context.TODO(), -1, 1, 100)
if err == nil {
t.Fail()
}
......
......@@ -23,9 +23,6 @@ func DefaultCacheOpts() CacheOpts {
func CachedBlockstore(bs GCBlockstore,
ctx context.Context, opts CacheOpts) (cbs GCBlockstore, err error) {
if ctx == nil {
ctx = context.TODO() // For tests
}
cbs = bs
if opts.HasBloomFilterSize < 0 || opts.HasBloomFilterHashes < 0 ||
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment