E7: stop the tool runner alone and wait its drain bound
The service manager's stop signalled the tool runner's whole group, so its bundles died with their calls. The composer carries the runner's drain-bound setting on its process; the unit stops the runner alone and waits the bound and 15 s before it kills what is left, so the new runner starts only after the old one exits or that bound passes. Builds: design 47 H2 §813 (12); H-A-353; H-A-358
This commit is contained in:
@@ -168,6 +168,32 @@ func TestTheMachineRunsOneRuntimeLoadingEveryDeliveredBundle(t *testing.T) {
|
||||
if names[len(names)-1] != "node-tools"+"."+RuntimeProcessID() {
|
||||
t.Errorf("the runtime's process is not last: %v", names)
|
||||
}
|
||||
// Design 47 H2 §813 (12), H-A-358: the runtime's process carries the module's drain bound, 30 s where no layer sets it,
|
||||
// the value a layer sets, and a value that is no number of seconds is refused by name.
|
||||
if process["drain-bound"] != DefaultDrainBound {
|
||||
t.Errorf("the runtime's process drains for %v, not the default 30 s", process["drain-bound"])
|
||||
}
|
||||
for _, row := range []struct {
|
||||
value any
|
||||
want int
|
||||
words string
|
||||
}{{float64(45), 45, ""}, {"60", 60, ""}, {"soon", 0, "whole number of seconds"}, {float64(0), 0, "above zero"}} {
|
||||
set := with
|
||||
set.Settings = mcat.SettingsBy{"node-tools": {{From: "mesh", Values: map[string]any{DrainBoundSetting: row.value}}}}
|
||||
out, err := Declaration(r, set)
|
||||
if row.words != "" {
|
||||
if err == nil || !strings.Contains(err.Error(), row.words) {
|
||||
t.Errorf("drain-bound %v was composed: %v", row.value, err)
|
||||
}
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got := fileNamed(out, "node-tools."+RuntimeProcessID())["drain-bound"]; got != row.want {
|
||||
t.Errorf("drain-bound %v composed the runtime's process with %v", row.value, got)
|
||||
}
|
||||
}
|
||||
|
||||
t.Run("a machine with no account runs it as root without the operator words", func(t *testing.T) {
|
||||
out, err := Declaration(mcat.Resolution{Node: "anchor", Modules: []mcat.Manifest{nftables, theRuntime(t)}}, with)
|
||||
|
||||
Reference in New Issue
Block a user