(t *testing.T)
| 237 | } |
| 238 | |
| 239 | func TestDownRemoveVolumes(t *testing.T) { |
| 240 | mockCtrl := gomock.NewController(t) |
| 241 | defer mockCtrl.Finish() |
| 242 | |
| 243 | api, cli := prepareMocks(mockCtrl) |
| 244 | tested, err := NewComposeService(cli) |
| 245 | assert.NilError(t, err) |
| 246 | |
| 247 | api.EXPECT().ContainerList(gomock.Any(), projectFilterListOpt(false)).Return( |
| 248 | client.ContainerListResult{ |
| 249 | Items: []container.Summary{testContainer("service1", "123", false)}, |
| 250 | }, nil) |
| 251 | api.EXPECT().VolumeList( |
| 252 | gomock.Any(), |
| 253 | client.VolumeListOptions{ |
| 254 | Filters: projectFilter(strings.ToLower(testProject)), |
| 255 | }). |
| 256 | Return(client.VolumeListResult{ |
| 257 | Items: []volume.Volume{{Name: "myProject_volume"}}, |
| 258 | }, nil) |
| 259 | api.EXPECT().VolumeInspect(gomock.Any(), "myProject_volume", gomock.Any()). |
| 260 | Return(client.VolumeInspectResult{}, nil) |
| 261 | api.EXPECT().NetworkList(gomock.Any(), client.NetworkListOptions{Filters: projectFilter(strings.ToLower(testProject))}). |
| 262 | Return(client.NetworkListResult{}, nil) |
| 263 | |
| 264 | api.EXPECT().ContainerStop(gomock.Any(), "123", client.ContainerStopOptions{}).Return(client.ContainerStopResult{}, nil) |
| 265 | api.EXPECT().ContainerRemove(gomock.Any(), "123", client.ContainerRemoveOptions{Force: true, RemoveVolumes: true}).Return(client.ContainerRemoveResult{}, nil) |
| 266 | |
| 267 | api.EXPECT().VolumeRemove(gomock.Any(), "myProject_volume", client.VolumeRemoveOptions{Force: true}).Return(client.VolumeRemoveResult{}, nil) |
| 268 | |
| 269 | err = tested.Down(t.Context(), strings.ToLower(testProject), compose.DownOptions{Volumes: true}) |
| 270 | assert.NilError(t, err) |
| 271 | } |
| 272 | |
| 273 | func TestDownRemoveImages(t *testing.T) { |
| 274 | mockCtrl := gomock.NewController(t) |
nothing calls this directly
no test coverage detected