(t *testing.T)
| 57 | } |
| 58 | |
| 59 | func 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 | |
| 89 | func TestExecutePlanStopRemoveContainer(t *testing.T) { |
| 90 | svc, apiClient := newTestService(t) |
nothing calls this directly
no test coverage detected