fix(compose): adapt relay/start tests to the container-spec layering

Rebasing onto main pulled in the relay work (added after this branch
was cut), whose tests build ServiceConfig/PreStart literals against
the flat, pre-layering shape: DependsOn/Networks set directly, and
PreStart typed as []ServiceHook. Both are incompatible with the
ContainerSpec/WorkloadSpec split this branch adopts -- the promoted
DependsOn/Networks fields need go1.27 to set via a flat literal (this
module stays on 1.26.3), and PreStart is now []PreStartHook, a full
container specification, not a plain hook.

Signed-off-by: Nicolas De Loof <[email protected]>
This commit is contained in:
Nicolas De Loof
2026-09-21 16:35:20 +02:00
committed by Nicolas De loof
parent 18fdf9832a
commit f9cfe76a59
2 changed files with 9 additions and 9 deletions
+8 -8
View File
@@ -110,18 +110,18 @@ func TestRelayNetworks(t *testing.T) {
Services: types.Services{
"db": db,
"app": {
Name: "app",
DependsOn: types.DependsOnConfig{"db": {}},
Networks: map[string]*types.ServiceNetworkConfig{"backend": nil},
Name: "app",
WorkloadSpec: types.WorkloadSpec{DependsOn: types.DependsOnConfig{"db": {}}},
ContainerSpec: types.ContainerSpec{Networks: map[string]*types.ServiceNetworkConfig{"backend": nil}},
},
"web": {
Name: "web",
DependsOn: types.DependsOnConfig{"db": {}},
Networks: map[string]*types.ServiceNetworkConfig{"frontend": nil, "backend": nil},
Name: "web",
WorkloadSpec: types.WorkloadSpec{DependsOn: types.DependsOnConfig{"db": {}}},
ContainerSpec: types.ContainerSpec{Networks: map[string]*types.ServiceNetworkConfig{"frontend": nil, "backend": nil}},
},
"other": {
Name: "other",
Networks: map[string]*types.ServiceNetworkConfig{"private": nil},
Name: "other",
ContainerSpec: types.ContainerSpec{Networks: map[string]*types.ServiceNetworkConfig{"private": nil}},
},
},
Networks: types.Networks{"default": {}, "backend": {}, "frontend": {}, "private": {}},
+1 -1
View File
@@ -255,7 +255,7 @@ func TestStartService_PreStartSkippedWhenLowestIsRelay(t *testing.T) {
project := &types.Project{Name: "prj"}
service := types.ServiceConfig{
Name: "db",
PreStart: []types.ServiceHook{{Command: types.ShellCommand{"init"}}},
PreStart: []types.PreStartHook{{ContainerSpec: types.ContainerSpec{Command: types.ShellCommand{"init"}}}},
}
relay := serviceContainer("db", 1, container.StateExited)
relay.Labels[api.RelayLabel] = "abc123"