panel-redesign: an idle one-shot helper is "on demand", not "stopped"
The owner's choice (2026-10-10) for the last line of the Processes table on Server > Health: postfix-reload runs when the configuration is reloaded and exits, so between runs supervisord calls it STOPPED - a word that reads as a fault beside six running programs, in a box that rightly says ok. Its row now has the neutral tag "on demand" and says when it last ran (or that it has not run since the container started). A one-shot in trouble keeps supervisord's word and level, and a daemon that is stopped is still an error. go test -count=1 ./internal/web/...: ok Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/mixeme/selfpost/internal/dnscheck"
|
||||
@@ -105,3 +106,24 @@ func TestProcessesCardLeavesOutTheIdleOneShot(t *testing.T) {
|
||||
t.Errorf("card = %q / %q, want 1 of 1 running / postfix-reload", card.Value, card.Sub)
|
||||
}
|
||||
}
|
||||
|
||||
// An idle one-shot helper is "on demand", not "stopped"; a daemon keeps its
|
||||
// state word, and a one-shot in trouble keeps its own.
|
||||
func TestProcessRowOfAnIdleOneShotSaysOnDemand(t *testing.T) {
|
||||
idle := processRow(health.Process{Name: "postfix-reload", State: "STOPPED", Detail: "Not started", Status: health.StatusOK, OneShot: true})
|
||||
if idle.State.Label != "on demand" || idle.State.Status != "off" || !strings.Contains(idle.Detail, "not run since the container started") {
|
||||
t.Errorf("idle one-shot = %+v", idle)
|
||||
}
|
||||
ran := processRow(health.Process{Name: "postfix-reload", State: "EXITED", Detail: "Oct 10 08:42 PM", Status: health.StatusOK, OneShot: true})
|
||||
if ran.State.Label != "on demand" || !strings.HasSuffix(ran.Detail, "last run: Oct 10 08:42 PM") {
|
||||
t.Errorf("one-shot that ran = %+v", ran)
|
||||
}
|
||||
bad := processRow(health.Process{Name: "postfix-reload", State: "FATAL", Detail: "Exited too quickly", Status: health.StatusError, OneShot: true})
|
||||
if bad.State.Label != "fatal" || bad.State.Status != "error" || bad.Detail != "Exited too quickly" {
|
||||
t.Errorf("one-shot in trouble = %+v", bad)
|
||||
}
|
||||
daemon := processRow(health.Process{Name: "postfix", State: "STOPPED", Detail: "Oct 10 08:42 PM", Status: health.StatusError})
|
||||
if daemon.State.Label != "stopped" || daemon.State.Status != "error" {
|
||||
t.Errorf("stopped daemon = %+v", daemon)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user