blob: ff549e1c5ec5b300bda04a768b37a0437b542ca2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
package config
import (
"testing"
"time"
)
func TestValidateAcceptsThinMode(t *testing.T) {
cfg := Default()
cfg.Mode = ModeThin
cfg.ThinCacheTTL = 24 * time.Hour
cfg.ThinCacheMaxEntries = 10
if err := cfg.Validate(); err != nil {
t.Fatalf("validate thin mode: %v", err)
}
}
func TestValidateRejectsInvalidThinCacheConfig(t *testing.T) {
cfg := Default()
cfg.Mode = ModeThin
cfg.ThinCacheTTL = 0
if err := cfg.Validate(); err == nil {
t.Fatalf("expected thin_cache_ttl validation error")
}
cfg = Default()
cfg.Mode = ModeThin
cfg.ThinCacheMaxEntries = 0
if err := cfg.Validate(); err == nil {
t.Fatalf("expected thin_cache_max_entries validation error")
}
}
|