Drop the never-ran reading: a start timestamp of 0 does not mean a one-shot never ran (issue 1126)
mesh/delivery merged: source.main moved to novox/mesh-host@b4fd2cc210bf
mesh/check being carried to 1a021052fe07 on b4fd2cc210bf | from 7a2af2376405
mesh/delivery merged: source.main moved to novox/mesh-host@b4fd2cc210bf
mesh/check being carried to 1a021052fe07 on b4fd2cc210bf | from 7a2af2376405
Review round 1 measured it on systemd 262.1: a finished one-shot nothing references is unloaded, and loaded again it reads inactive, ExecMainStatus=0 and a start timestamp of 0, as one that never ran does. The previous commit's rule read such a unit stopped, so a one-shot declared running would be started, read stopped and fail on every apply, and the hold, the take-over and the giving back would judge it wrongly. ServiceState keeps main's reading. ServiceAtRest and declaredState stay: they alone satisfy a stopped declaration for a one-shot at rest, which is the kernel cleanup's case. A one-shot declared running that must be seen to have run lingers (RemainAfterExit) or is enabled at boot. Unit tests: the arch table has 5 rows, the apply test 1; 1262 in all.
This commit is contained in:
@@ -351,14 +351,12 @@ func TestAnUnknownServiceStateIsRefusedNotGuessed(t *testing.T) {
|
||||
}
|
||||
|
||||
// A boot-time one-shot a package ships, declared stopped and enabled at boot, is satisfied while
|
||||
// nothing of it runs: before its first boot run and after it (novox/hq issue 1126). The kernel
|
||||
// module's linux-modules-cleanup.service failed on ace with "was asked to be stopped and is
|
||||
// running" for a unit that had never run, and every apply after a reboot would have failed the
|
||||
// same way for one that had.
|
||||
// nothing of it runs, whatever its last run did (novox/hq issue 1126). The kernel module's
|
||||
// linux-modules-cleanup.service failed on ace with "was asked to be stopped and is running": an
|
||||
// inactive one-shot with ExecMainStatus=0 reads "running", and stopping it changes nothing.
|
||||
func TestABootOneShotDeclaredStoppedIsSatisfiedAtRest(t *testing.T) {
|
||||
for _, c := range []struct{ name, started, status string }{
|
||||
{"never ran", "0", "0"},
|
||||
{"ran at boot", "5123456", "0"},
|
||||
for _, c := range []struct{ name, status string }{
|
||||
{"exited 0: never ran, ran at boot, or unloaded", "0"},
|
||||
} {
|
||||
t.Run(c.name, func(t *testing.T) {
|
||||
var asked []string
|
||||
@@ -367,7 +365,7 @@ func TestABootOneShotDeclaredStoppedIsSatisfiedAtRest(t *testing.T) {
|
||||
switch args[0] {
|
||||
case "show":
|
||||
return "LoadState=loaded\nActiveState=inactive\nType=oneshot\nRemainAfterExit=no\n" +
|
||||
"ExecMainStatus=" + c.status + "\nExecMainStartTimestampMonotonic=" + c.started + "\n", nil
|
||||
"ExecMainStatus=" + c.status + "\n", nil
|
||||
case "is-enabled":
|
||||
return "enabled\n", nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user