mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-27 07:57:30 +08:00
blocks/blockstore: shift insertion of TODO context to tests
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
@ -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 ||
|
||||
|
Reference in New Issue
Block a user