diff options
| author | Vladimir Buzuev <[email protected]> | 2020-05-04 11:01:38 -0700 |
|---|---|---|
| committer | Vladimir Buzuev <[email protected]> | 2020-05-04 11:01:38 -0700 |
| commit | 862cde393cca25fdf04b883aa331a88a3fec67a7 (patch) | |
| tree | 465f4cf1521541b2bc4a1c46633f2a2462df1896 /settings_test.go | |
| parent | 512f37b369cc8fd6c9594fc06546ad7a4ab423d6 (diff) | |
cache_opts: address PR comments
Diffstat (limited to 'settings_test.go')
| -rw-r--r-- | settings_test.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/settings_test.go b/settings_test.go index 3a4ce0a..4e45567 100644 --- a/settings_test.go +++ b/settings_test.go @@ -48,3 +48,36 @@ func TestMmapSizes(t *testing.T) { t.Fatal("Sizes don't match") } } + +func TestEnableCaching(t *testing.T) { + err := EnableCaching(false) + checkFatal(t, err) + + err = EnableCaching(true) + checkFatal(t, err) +} + +func TestGetCachedMemory(t *testing.T) { + current, allowed, err := GetCachedMemory() + checkFatal(t, err) + + if current < 0 { + t.Fatal("current < 0") + } + + if allowed < 0 { + t.Fatal("allowed < 0") + } +} + +func TestSetCacheMaxSize(t *testing.T) { + err := SetCacheMaxSize(0) + checkFatal(t, err) + + err = SetCacheMaxSize(1024 * 1024) + checkFatal(t, err) + + // revert to default 256MB + err = SetCacheMaxSize(256 * 1024 * 1024) + checkFatal(t, err) +}
\ No newline at end of file |
