--- Service-reference resolution tests (issue #13878) --- When a service uses network_mode/ipc/pid: service:X or volumes_from: serviceName, the executor mutates the resolved field to "container:<id>" (or bare ID for volumes_from) before computing and persisting the config-hash. The reconciler must
(t *testing.T, parent, dependent types.ServiceConfig)
| 706 | // (running, with its own raw hash) and a "dependent" container whose hash was |
| 707 | // computed on the resolved form of its service. |
| 708 | func parentDependentObserved(t *testing.T, parent, dependent types.ServiceConfig) *ObservedState { |
| 709 | t.Helper() |
| 710 | const parentID = "parent_container_abc123" |
| 711 | parentSummary := container.Summary{ |
| 712 | ID: parentID, State: container.StateRunning, |
| 713 | Labels: map[string]string{ |
| 714 | api.ServiceLabel: "parent", |
| 715 | api.ContainerNumberLabel: "1", |
| 716 | api.ConfigHashLabel: mustServiceHash(t, parent), |
| 717 | }, |
| 718 | } |
| 719 | parentObserved := []ObservedContainer{{ |
| 720 | ID: parentID, Number: 1, State: container.StateRunning, |
| 721 | ConfigHash: mustServiceHash(t, parent), |
| 722 | Summary: parentSummary, |
| 723 | }} |
| 724 | containersByService := map[string]Containers{"parent": {parentSummary}} |
| 725 | dependentHash := mustResolvedServiceHash(t, dependent, containersByService) |
| 726 | return &ObservedState{ |
| 727 | ProjectName: "myproject", |
| 728 | Containers: map[string][]ObservedContainer{ |
| 729 | "parent": parentObserved, |
| 730 | "dependent": {{ |
| 731 | ID: "dependent_container_xyz", Number: 1, State: container.StateRunning, |
| 732 | ConfigHash: dependentHash, |
| 733 | Summary: container.Summary{ |
| 734 | ID: "dependent_container_xyz", State: container.StateRunning, |
| 735 | Labels: map[string]string{ |
| 736 | api.ServiceLabel: "dependent", |
| 737 | api.ContainerNumberLabel: "1", |
| 738 | api.ConfigHashLabel: dependentHash, |
| 739 | }, |
| 740 | }, |
| 741 | }}, |
| 742 | }, |
| 743 | Networks: map[string]ObservedNetwork{}, |
| 744 | Volumes: map[string]ObservedVolume{}, |
| 745 | } |
| 746 | } |
| 747 | |
| 748 | // TestReconcileContainers_ServiceReference_NoRecreate covers every reference |
| 749 | // form mutated by resolveServiceReferences. The volumes_from "container:X" |
no test coverage detected