the spec names the resolver and the address #27
@@ -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.
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user