MCPcopy
hub / github.com/docker/compose / TestExecutePlanCreateNetwork

Function TestExecutePlanCreateNetwork

pkg/compose/executor_test.go:59–87  ·  pkg/compose/executor_test.go::TestExecutePlanCreateNetwork
(t *testing.T)

Source from the content-addressed store, hash-verified

57}
58
59func TestExecutePlanCreateNetwork(t *testing.T) {
60 svc, apiClient := newTestService(t)
61
62 nw := types.NetworkConfig{Name: "test_default"}
63 project := &types.Project{
64 Name: "test",
65 Networks: types.Networks{"default": nw},
66 }
67
68 // ensureNetwork: inspect → not found, list → empty, create
69 apiClient.EXPECT().NetworkInspect(gomock.Any(), "test_default", gomock.Any()).
70 Return(client.NetworkInspectResult{}, notFoundError{})
71 apiClient.EXPECT().NetworkList(gomock.Any(), gomock.Any()).
72 Return(client.NetworkListResult{}, nil)
73 apiClient.EXPECT().NetworkCreate(gomock.Any(), "test_default", gomock.Any()).
74 Return(client.NetworkCreateResult{ID: "net1"}, nil)
75
76 plan := &Plan{}
77 plan.addNode(Operation{
78 Type: OpCreateNetwork,
79 ResourceID: "network:default",
80 Cause: "not found",
81 Name: nw.Name,
82 Network: &nw,
83 }, "")
84
85 err := svc.executePlan(t.Context(), project, emptyObservedState("test"), plan)
86 assert.NilError(t, err)
87}
88
89func TestExecutePlanStopRemoveContainer(t *testing.T) {
90 svc, apiClient := newTestService(t)

Callers

nothing calls this directly

Calls 8

addNodeMethod · 0.95
newTestServiceFunction · 0.85
emptyObservedStateFunction · 0.85
executePlanMethod · 0.80
NetworkInspectMethod · 0.45
EXPECTMethod · 0.45
NetworkListMethod · 0.45
NetworkCreateMethod · 0.45

Tested by

no test coverage detected