d8f6069b46
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017CDMFpFx84pfviCTVuGGhf
24 lines
751 B
Go
24 lines
751 B
Go
package stacks
|
|
|
|
import "testing"
|
|
|
|
// fix-3: only stopped/exited count as "down" for a deployed app. starting/unhealthy (running),
|
|
// restarting/deploying (transient), paused (deliberate), unknown (ambiguous) must NOT alert.
|
|
func TestIsDownState(t *testing.T) {
|
|
down := []ContainerState{StateStopped, StateExited}
|
|
for _, s := range down {
|
|
if !IsDownState(s) {
|
|
t.Errorf("IsDownState(%q) = false, want true", s)
|
|
}
|
|
}
|
|
notDown := []ContainerState{
|
|
StateRunning, StateStarting, StateUnhealthy, StateRestarting,
|
|
StateDeploying, StatePaused, StateUnknown, StateNotDeployed, StateOrphaned,
|
|
}
|
|
for _, s := range notDown {
|
|
if IsDownState(s) {
|
|
t.Errorf("IsDownState(%q) = true, want false (must not manufacture a dead-app alert)", s)
|
|
}
|
|
}
|
|
}
|