-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3074 from ipfs/feat/test-cover-blockstore
test: 81% coverage on blockstore
- Loading branch information
Showing
4 changed files
with
208 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package blockstore | ||
|
||
import "testing" | ||
|
||
func TestCachingOptsLessThanZero(t *testing.T) { | ||
opts := DefaultCacheOpts() | ||
opts.HasARCCacheSize = -1 | ||
|
||
if _, err := CachedBlockstore(nil, nil, opts); err == nil { | ||
t.Error("wrong ARC setting was not detected") | ||
} | ||
|
||
opts = DefaultCacheOpts() | ||
opts.HasBloomFilterSize = -1 | ||
|
||
if _, err := CachedBlockstore(nil, nil, opts); err == nil { | ||
t.Error("negative bloom size was not detected") | ||
} | ||
|
||
opts = DefaultCacheOpts() | ||
opts.HasBloomFilterHashes = -1 | ||
|
||
if _, err := CachedBlockstore(nil, nil, opts); err == nil { | ||
t.Error("negative hashes setting was not detected") | ||
} | ||
} | ||
|
||
func TestBloomHashesAtZero(t *testing.T) { | ||
opts := DefaultCacheOpts() | ||
opts.HasBloomFilterHashes = 0 | ||
|
||
if _, err := CachedBlockstore(nil, nil, opts); err == nil { | ||
t.Error("zero hashes setting with positive size was not detected") | ||
} | ||
} |