A one-shot service that finished is not stopped, and a container is what it reads
Two faults that both reported success while being wrong, found while proving the firewall module actually delivers. A unit whose job is to apply something and exit — load a rule set, set a sysctl — is inactive the instant it succeeds. Reading that as stopped made it permanently unsatisfiable: the host started it, it worked, the host read back stopped and reported the machine as not doing what it was told, on every apply, for ever, with the rules correctly in place the whole time. That is what the firewall has been doing on every machine it was assigned to, and why the four-machine bed was red. And a container took its identity from its own fields, not from the files it reads. A file written in an earlier apply — or before the container declared it as a dependency — left a process holding a credential the mesh had already replaced, with everything reporting success (novox/hq 04-ISSUES/045). What a container reads is now part of what it is, so the comparison is a standing one rather than a tripwire that fires during one apply and never again.
This commit is contained in:
@@ -68,7 +68,7 @@ func TestARunOnceStepIsRunToCompletionNotLeftRunning(t *testing.T) {
|
||||
if !ok {
|
||||
t.Fatal("a completed run-once step was not recorded")
|
||||
}
|
||||
if applied.Wrote != containerSpec(d.Resources[0].(*declaration.Container)) {
|
||||
if applied.Wrote != containerSpec(d.Resources[0].(*declaration.Container), nil) {
|
||||
t.Errorf("the run-once record is not the declaration's digest: %q", applied.Wrote)
|
||||
}
|
||||
}
|
||||
@@ -154,7 +154,7 @@ func TestARunOnceStepAlreadyCompletedIsNotReRun(t *testing.T) {
|
||||
d := parseTrusted(t, `{"declaration":1,"resources":[
|
||||
{"id":"seed","type":"container","name":"seed","image":"`+pinned+`","run-once":true}
|
||||
]}`)
|
||||
want := containerSpec(d.Resources[0].(*declaration.Container))
|
||||
want := containerSpec(d.Resources[0].(*declaration.Container), nil)
|
||||
|
||||
var ran bool
|
||||
run := func(ctx context.Context, name string, args ...string) (string, error) {
|
||||
@@ -222,7 +222,7 @@ func TestARunOnceContainerCannotAlsoDeclareRestartOn(t *testing.T) {
|
||||
// silently resolving to one.
|
||||
_, err := declaration.Parse([]byte(`{"declaration":1,"resources":[
|
||||
{"id":"f","type":"file","path":"/tmp/x","content":"y"},
|
||||
{"id":"seed","type":"container","name":"seed","image":"`+pinned+`","run-once":true,"restart-on":["f"]}
|
||||
{"id":"seed","type":"container","name":"seed","image":"` + pinned + `","run-once":true,"restart-on":["f"]}
|
||||
]}`))
|
||||
if err == nil {
|
||||
t.Fatal("a run-once container that also declared restart-on was accepted")
|
||||
|
||||
Reference in New Issue
Block a user