From 906661a0685f7600c6b7fcfc3c0b89bda626b561 Mon Sep 17 00:00:00 2001 From: Steve Azzopardi <steveazz@outlook.com> Date: Mon, 21 Jan 2019 10:35:01 +0100 Subject: [PATCH] Remove `ContainerWait` from docker client `ContainerWait` is not being used anywhere at this point, there are plans to use it as a replacement for gitlab-runner `waitForContainer` func over at https://gitlab.com/gitlab-org/gitlab-runner/issues/3918, but in the mean time it should be removed since it's dead code. --- helpers/docker/client.go | 1 - helpers/docker/mock_Client.go | 21 --------------------- helpers/docker/official_docker_client.go | 6 ------ 3 files changed, 28 deletions(-) diff --git a/helpers/docker/client.go b/helpers/docker/client.go index 357c291e1..2de1bb612 100644 --- a/helpers/docker/client.go +++ b/helpers/docker/client.go @@ -17,7 +17,6 @@ type Client interface { ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error - ContainerWait(ctx context.Context, containerID string) (int64, error) ContainerKill(ctx context.Context, containerID, signal string) error ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error) ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error) diff --git a/helpers/docker/mock_Client.go b/helpers/docker/mock_Client.go index b944d4263..2d6840cc9 100644 --- a/helpers/docker/mock_Client.go +++ b/helpers/docker/mock_Client.go @@ -200,27 +200,6 @@ func (_m *MockClient) ContainerStart(ctx context.Context, containerID string, op return r0 } -// ContainerWait provides a mock function with given fields: ctx, containerID -func (_m *MockClient) ContainerWait(ctx context.Context, containerID string) (int64, error) { - ret := _m.Called(ctx, containerID) - - var r0 int64 - if rf, ok := ret.Get(0).(func(context.Context, string) int64); ok { - r0 = rf(ctx, containerID) - } else { - r0 = ret.Get(0).(int64) - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, containerID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - // ImageImportBlocking provides a mock function with given fields: ctx, source, ref, options func (_m *MockClient) ImageImportBlocking(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) error { ret := _m.Called(ctx, source, ref, options) diff --git a/helpers/docker/official_docker_client.go b/helpers/docker/official_docker_client.go index 0e172354d..ced9be76f 100644 --- a/helpers/docker/official_docker_client.go +++ b/helpers/docker/official_docker_client.go @@ -86,12 +86,6 @@ func (c *officialDockerClient) ContainerStart(ctx context.Context, containerID s return wrapError("ContainerCreate", err, started) } -func (c *officialDockerClient) ContainerWait(ctx context.Context, containerID string) (int64, error) { - started := time.Now() - result, err := c.client.ContainerWait(ctx, containerID) - return result, wrapError("ContainerWait", err, started) -} - func (c *officialDockerClient) ContainerKill(ctx context.Context, containerID string, signal string) error { started := time.Now() err := c.client.ContainerKill(ctx, containerID, signal) -- GitLab