From b6edff4865082160d6a31a15dc0e8f2379918faa Mon Sep 17 00:00:00 2001 From: Sebastian Borza Date: Thu, 1 Feb 2018 12:54:04 -0600 Subject: [PATCH] updating based on feedback --- container.go | 6 +++--- container_test.go | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/container.go b/container.go index e884811b..94014d66 100644 --- a/container.go +++ b/container.go @@ -547,7 +547,7 @@ func (c *Client) InspectContainer(id string) (*Container, error) { // The context object can be used to cancel the inspect request. // // See https://goo.gl/FaI5JT for more details. -func (c *Client) InspectContainerWithContext(ctx context.Context, id string) (*Container, error) { +func (c *Client) InspectContainerWithContext(id string, ctx context.Context) (*Container, error) { return c.inspectContainer(id, doOptions{context: ctx}) } @@ -817,7 +817,7 @@ func (c *Client) StartContainer(id string, hostConfig *HostConfig) error { // API 1.24 or greater. // // See https://goo.gl/fbOSZy for more details. -func (c *Client) StartContainerWithContext(ctx context.Context, id string, hostConfig *HostConfig) error { +func (c *Client) StartContainerWithContext(id string, hostConfig *HostConfig, ctx context.Context) error { return c.startContainer(id, hostConfig, doOptions{context: ctx}) } @@ -857,7 +857,7 @@ func (c *Client) StopContainer(id string, timeout uint) error { // container request. // // See https://goo.gl/R9dZcV for more details. -func (c *Client) StopContainerWithContext(ctx context.Context, id string, timeout uint) error { +func (c *Client) StopContainerWithContext(id string, timeout uint, ctx context.Context) error { return c.stopContainer(id, timeout, doOptions{context: ctx}) } diff --git a/container_test.go b/container_test.go index 2deb6ec2..97951de9 100644 --- a/container_test.go +++ b/container_test.go @@ -1079,7 +1079,7 @@ func TestStartContainerWithContext(t *testing.T) { startError := make(chan error) go func() { - startError <- client.StartContainerWithContext(ctx, id, &HostConfig{}) + startError <- client.StartContainerWithContext(id, &HostConfig{}, ctx) }() select { case err := <-startError: @@ -1154,7 +1154,7 @@ func TestStopContainerWithContext(t *testing.T) { stopError := make(chan error) go func() { - stopError <- client.StopContainerWithContext(ctx, id, 10) + stopError <- client.StopContainerWithContext(id, 10, ctx) }() select { case err := <-stopError: @@ -2729,7 +2729,7 @@ func TestInspectContainerWhenContextTimesOut(t *testing.T) { ctx, cancel := context.WithTimeout(context.TODO(), 100*time.Millisecond) defer cancel() - _, err := client.InspectContainerWithContext(ctx, "id") + _, err := client.InspectContainerWithContext("id", ctx) if err != context.DeadlineExceeded { t.Errorf("Expected 'DeadlineExceededError', got: %v", err) } @@ -2744,7 +2744,7 @@ func TestStartContainerWhenContextTimesOut(t *testing.T) { ctx, cancel := context.WithTimeout(context.TODO(), 100*time.Millisecond) defer cancel() - err := client.StartContainerWithContext(ctx, "id", nil) + err := client.StartContainerWithContext("id", nil, ctx) if err != context.DeadlineExceeded { t.Errorf("Expected 'DeadlineExceededError', got: %v", err) } @@ -2759,7 +2759,7 @@ func TestStopContainerWhenContextTimesOut(t *testing.T) { ctx, cancel := context.WithTimeout(context.TODO(), 50*time.Millisecond) defer cancel() - err := client.StopContainerWithContext(ctx, "id", 10) + err := client.StopContainerWithContext("id", 10, ctx) if err != context.DeadlineExceeded { t.Errorf("Expected 'DeadlineExceededError', got: %v", err) }