Skip to content

Commit 5f89365

Browse files
committed
network: make test mock consistent throughout
Signed-off-by: Milas Bowman <[email protected]>
1 parent 0f74741 commit 5f89365

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pkg/compose/down_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,14 @@ func TestDown(t *testing.T) {
4949
}, nil)
5050
api.EXPECT().VolumeList(gomock.Any(), filters.NewArgs(projectFilter(strings.ToLower(testProject)))).
5151
Return(volume.VolumeListOKBody{}, nil)
52+
53+
// network names are not guaranteed to be unique, ensure Compose handles
54+
// cleanup properly if duplicates are inadvertently created
5255
api.EXPECT().NetworkList(gomock.Any(), moby.NetworkListOptions{Filters: filters.NewArgs(projectFilter(strings.ToLower(testProject)))}).
53-
Return([]moby.NetworkResource{{Name: "myProject_default"}}, nil)
56+
Return([]moby.NetworkResource{
57+
{ID: "abc123", Name: "myProject_default"},
58+
{ID: "def456", Name: "myProject_default"},
59+
}, nil)
5460

5561
api.EXPECT().ContainerStop(gomock.Any(), "123", nil).Return(nil)
5662
api.EXPECT().ContainerStop(gomock.Any(), "456", nil).Return(nil)
@@ -60,8 +66,6 @@ func TestDown(t *testing.T) {
6066
api.EXPECT().ContainerRemove(gomock.Any(), "456", moby.ContainerRemoveOptions{Force: true}).Return(nil)
6167
api.EXPECT().ContainerRemove(gomock.Any(), "789", moby.ContainerRemoveOptions{Force: true}).Return(nil)
6268

63-
// network names are not guaranteed to be unique, ensure Compose handles
64-
// cleanup properly if duplicates are inadvertently created
6569
api.EXPECT().NetworkList(gomock.Any(), moby.NetworkListOptions{
6670
Filters: filters.NewArgs(filters.Arg("name", "myProject_default")),
6771
}).Return([]moby.NetworkResource{

0 commit comments

Comments
 (0)