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) } } }