Files
dockwatch/internal/config/config_test.go
T
jbergner 56170ccde9
release-tag / release-image (push) Failing after 1m15s
v9.3.1
2026-08-31 22:17:18 +02:00

45 lines
1.3 KiB
Go

package config
import "testing"
func TestStrictEnvironmentParsing(t *testing.T) {
t.Setenv("CHECK_CONCURRENCY", "not-a-number")
if _, err := Load(); err == nil {
t.Fatal("expected invalid CHECK_CONCURRENCY to fail instead of silently using a default")
}
}
func TestStrictBooleanParsing(t *testing.T) {
t.Setenv("CHECK_CONCURRENCY", "8")
t.Setenv("AUTH_DISABLED", "sometimes")
if _, err := Load(); err == nil {
t.Fatal("expected invalid AUTH_DISABLED to fail")
}
}
func TestHostUserManagementRequiresHostRoot(t *testing.T) {
t.Setenv("APP_MODE", "agent")
t.Setenv("AGENT_TOKEN", "123456789012345678901234")
t.Setenv("ALLOW_HOST_USER_MANAGEMENT", "true")
t.Setenv("HOST_ROOT", "")
if _, err := Load(); err == nil {
t.Fatal("expected host user management without HOST_ROOT to fail")
}
}
func TestCleanOptionalHostRootPreservesFilesystemRoot(t *testing.T) {
if got := cleanOptionalPath("/"); got != "/" {
t.Fatalf("cleanOptionalPath(/) = %q", got)
}
}
func TestHostPermissionManagementRequiresHostRoot(t *testing.T) {
t.Setenv("AUTH_DISABLED", "true")
t.Setenv("APP_SECRET", "01234567890123456789012345678901")
t.Setenv("ALLOW_HOST_PERMISSION_MANAGEMENT", "true")
t.Setenv("HOST_ROOT", "")
if _, err := Load(); err == nil {
t.Fatal("expected host permission management without HOST_ROOT to fail")
}
}