Files
Sebastian UnterschützandClaude Opus 5.5 d9891bb050 feat!: let checkers and status page servers reach data only through the api
Only cmd/api connects to Postgres and Redis. Agents authenticate with
tokens created by 'api agent create' and use /agent/v1: checkers long
poll for jobs, which doubles as heartbeat, and report results in
batches. Organizations manage monitors through /api/v1/org/monitors.

BREAKING CHANGE: cmd/checker and cmd/statuspage no longer read
UPTIME_DATABASE_URL or UPTIME_REDIS_*; they need UPTIME_API_URL and
UPTIME_AGENT_TOKEN. UPTIME_CHECKER_REGION is replaced by the region bound
to the agent token.

Closes #10
Closes #11
Closes #12
Closes #13
Closes #49

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
2026-11-22 01:12:53 +01:00

26 lines
758 B
Go

package config
import "testing"
func TestStorageValidateRedisModes(t *testing.T) {
tests := []struct {
name string
modify func(*Storage)
wantErr bool
}{
{"standalone", func(c *Storage) { c.RedisURL = "redis://r" }, false},
{"no redis", func(*Storage) {}, true},
{"sentinel", func(c *Storage) { c.RedisSentinel = Sentinel{Master: "m", Addrs: []string{"s:26379"}} }, false},
{"sentinel without addrs", func(c *Storage) { c.RedisSentinel = Sentinel{Master: "m"} }, true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
c := Storage{DatabaseURL: "postgres://x"}
tt.modify(&c)
if err := c.Validate(); (err != nil) != tt.wantErr {
t.Errorf("Validate() = %v, want error: %t", err, tt.wantErr)
}
})
}
}