summaryrefslogtreecommitdiff
path: root/settings_test.go
diff options
context:
space:
mode:
authorlhchavez <[email protected]>2020-05-04 17:44:13 -0700
committerGitHub <[email protected]>2020-05-04 17:44:13 -0700
commit8b51d0db8e40e97283b771a5a51b13bea4651f81 (patch)
tree2770e052e312c470a45de6954eed946a807e8b80 /settings_test.go
parent91d08450b68efc8ef5bd5bfee29e813ca5829229 (diff)
parent862cde393cca25fdf04b883aa331a88a3fec67a7 (diff)
expose options related to caching
Diffstat (limited to 'settings_test.go')
-rw-r--r--settings_test.go33
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