(t *testing.T)
| 87 | } |
| 88 | |
| 89 | func TestExecutePlanStopRemoveContainer(t *testing.T) { |
| 90 | svc, apiClient := newTestService(t) |
| 91 | |
| 92 | ctr := container.Summary{ |
| 93 | ID: "c1", |
| 94 | Names: []string{"/test-web-1"}, |
| 95 | Labels: map[string]string{ |
| 96 | api.ServiceLabel: "web", |
| 97 | api.ContainerNumberLabel: "1", |
| 98 | }, |
| 99 | } |
| 100 | |
| 101 | apiClient.EXPECT().ContainerStop(gomock.Any(), "c1", gomock.Any()). |
| 102 | Return(client.ContainerStopResult{}, nil) |
| 103 | apiClient.EXPECT().ContainerRemove(gomock.Any(), "c1", gomock.Any()). |
| 104 | Return(client.ContainerRemoveResult{}, nil) |
| 105 | |
| 106 | plan := &Plan{} |
| 107 | stopNode := plan.addNode(Operation{ |
| 108 | Type: OpStopContainer, |
| 109 | ResourceID: "service:web:1", |
| 110 | Cause: "scale down", |
| 111 | Container: &ctr, |
| 112 | }, "") |
| 113 | plan.addNode(Operation{ |
| 114 | Type: OpRemoveContainer, |
| 115 | ResourceID: "service:web:1", |
| 116 | Cause: "scale down", |
| 117 | Container: &ctr, |
| 118 | }, "", stopNode) |
| 119 | |
| 120 | err := svc.executePlan(t.Context(), &types.Project{Name: "test"}, emptyObservedState("test"), plan) |
| 121 | assert.NilError(t, err) |
| 122 | } |
| 123 | |
| 124 | // emptyObservedState returns an ObservedState with no containers/networks/volumes, |
| 125 | // suitable for executor tests that don't exercise service-reference resolution. |
nothing calls this directly
no test coverage detected