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