config: add server.cache_priority for configurable /nix-cache-info Priority
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ibe9c357ea2c56a967c75be04c2099f536a6a6964
This commit is contained in:
parent
a45ee57da7
commit
a35b3216ec
3 changed files with 30 additions and 7 deletions
|
|
@ -178,6 +178,24 @@ func TestValidateUpstreamBadPublicKey(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestCachePriorityDefault(t *testing.T) {
|
||||
cfg, err := config.Load("")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if cfg.Server.CachePriority != 30 {
|
||||
t.Errorf("default CachePriority = %d, want 30", cfg.Server.CachePriority)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCachePriorityValidation(t *testing.T) {
|
||||
cfg, _ := config.Load("")
|
||||
cfg.Server.CachePriority = 0
|
||||
if err := cfg.Validate(); err == nil {
|
||||
t.Error("expected error for CachePriority = 0")
|
||||
}
|
||||
}
|
||||
|
||||
func TestInvalidDuration(t *testing.T) {
|
||||
yamlContent := `
|
||||
server:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue