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

Function TestReconcileNetworks_CreateMissing

pkg/compose/reconcile_test.go:45–68  ·  view source on GitHub ↗

--- Network tests ---

(t *testing.T)

Source from the content-addressed store, hash-verified

43// --- Network tests ---
44
45func TestReconcileNetworks_CreateMissing(t *testing.T) {
46 project := &types.Project{
47 Name: "myproject",
48 Networks: types.Networks{
49 "frontend": {Name: "myproject_frontend"},
50 "backend": {Name: "myproject_backend"},
51 },
52 }
53 observed := &ObservedState{
54 ProjectName: "myproject",
55 Containers: map[string][]ObservedContainer{},
56 Networks: map[string]ObservedNetwork{},
57 Volumes: map[string]ObservedVolume{},
58 }
59
60 plan, err := reconcile(t.Context(), project, observed, defaultReconcileOptions(), noPrompt)
61 assert.NilError(t, err)
62
63 // Sorted alphabetically: backend before frontend
64 assert.Equal(t, plan.String(), strings.TrimSpace(`
65[] -> #1 network:backend, CreateNetwork, not found
66[] -> #2 network:frontend, CreateNetwork, not found
67`)+"\n")
68}
69
70func TestReconcileNetworks_ExistingMatch(t *testing.T) {
71 nw := types.NetworkConfig{Name: "myproject_frontend"}

Callers

nothing calls this directly

Calls 3

reconcileFunction · 0.85
defaultReconcileOptionsFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected