Merge pull request 'the spec names the resolver and the address' (#27) from fix/the-spec-names-the-resolver-and-address into main

This commit was merged in pull request #27.
This commit is contained in:
2026-09-25 21:51:42 +00:00
2 changed files with 25 additions and 0 deletions
+9
View File
@@ -1314,6 +1314,15 @@ func containerSpecReading(r *declaration.Container, declares, reads map[string]s
for _, a := range r.Args {
b.WriteString("arg " + a + "\n")
}
// The resolver and address are part of what was declared: a container whose dns or ip moved
// is a different container, or the fields could never reach one that already ran — which is
// exactly how their first deployment silently changed nothing.
for _, d := range r.Dns {
b.WriteString("dns " + d + "\n")
}
if r.IP != "" {
b.WriteString("ip " + r.IP + "\n")
}
// The cadence is part of what was declared, so a changed schedule is a changed spec — the marker
// moves and the install is reported "updated" and re-established. Added only when present, so no
// ordinary container's or run-once step's digest moves for a field it does not set.
+16
View File
@@ -435,3 +435,19 @@ func TestAContainerIsGivenItsResolverAndItsAddress(t *testing.T) {
}
}
}
// The resolver and address are part of the spec — a container whose dns or ip moved is a
// different container, or the fields can never reach one that already runs. That is not
// hypothetical: their first deployment compared equal and changed nothing.
func TestAChangedResolverOrAddressIsAChangedContainer(t *testing.T) {
base := &declaration.Container{ID: "c", Name: "x", Image: "a@sha256:00"}
withDns := &declaration.Container{ID: "c", Name: "x", Image: "a@sha256:00", Dns: []string{"192.168.203.254"}}
withIP := &declaration.Container{ID: "c", Name: "x", Image: "a@sha256:00", IP: "192.168.203.254"}
plain := containerSpecReading(base, nil, nil)
if containerSpecReading(withDns, nil, nil) == plain {
t.Error("adding a resolver did not change the spec, so it can never reach a running container")
}
if containerSpecReading(withIP, nil, nil) == plain {
t.Error("adding an address did not change the spec, so it can never reach a running container")
}
}