Prove the untouched environment is the same map, not an equal one

This commit is contained in:
2026-09-22 23:29:28 +02:00
parent 7352c846dd
commit f0049190d7
+3 -1
View File
@@ -162,7 +162,9 @@ func TestAContainerWithNoPortPlaceholderKeepsItsEnvironment(t *testing.T) {
if got := sidecar["env"].(map[string]any)["MESH_GITEA_URL"]; got != "http://gitea:3000" {
t.Fatalf("an address on the runtime's own network was moved to the machine's port: %v", got)
}
if !reflect.DeepEqual(sidecar["env"], env) {
// The same map, not a copy of it: a container that asks for nothing is left alone, and
// comparing the contents would say yes even to a rebuilt map.
if reflect.ValueOf(sidecar["env"]).Pointer() != reflect.ValueOf(env).Pointer() {
t.Fatalf("a container that asked for nothing had its environment rebuilt: %v", sidecar["env"])
}
}