--- Network tests ---
(t *testing.T)
| 43 | // --- Network tests --- |
| 44 | |
| 45 | func 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 | |
| 70 | func TestReconcileNetworks_ExistingMatch(t *testing.T) { |
| 71 | nw := types.NetworkConfig{Name: "myproject_frontend"} |
nothing calls this directly
no test coverage detected