Compare against expected values (300s, 20s, 5s) instead of self-comparison
This commit is contained in:
@@ -3,6 +3,7 @@ package config
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestLoad(t *testing.T) {
|
||||
@@ -57,18 +58,20 @@ func TestLlamaServerURL(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDurationHelpers(t *testing.T) {
|
||||
t.Setenv("LLAMA_SERVER_STARTUP_TIMEOUT", "300")
|
||||
t.Setenv("LLAMA_SERVER_STOP_TIMEOUT", "20")
|
||||
t.Setenv("MODEL_SWAP_COOLDOWN", "5")
|
||||
|
||||
cfg := Load()
|
||||
|
||||
if cfg.LlamaServerStartupTimeoutDuration() != cfg.LlamaServerStartupTimeoutDuration() {
|
||||
t.Error("startup timeout duration mismatch")
|
||||
if got := cfg.LlamaServerStartupTimeoutDuration(); got != 300*time.Second {
|
||||
t.Errorf("startup: got %v, want 300s", got)
|
||||
}
|
||||
|
||||
if cfg.LlamaServerStopTimeoutDuration() != cfg.LlamaServerStopTimeoutDuration() {
|
||||
t.Error("stop timeout duration mismatch")
|
||||
if got := cfg.LlamaServerStopTimeoutDuration(); got != 20*time.Second {
|
||||
t.Errorf("stop: got %v, want 20s", got)
|
||||
}
|
||||
|
||||
if cfg.ModelSwapCooldownDuration() != cfg.ModelSwapCooldownDuration() {
|
||||
t.Error("model swap cooldown duration mismatch")
|
||||
if got := cfg.ModelSwapCooldownDuration(); got != 5*time.Second {
|
||||
t.Errorf("cooldown: got %v, want 5s", got)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user