Skip to content

Commit

Permalink
updating based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
sebito91 committed Feb 1, 2018
1 parent 23cc4f7 commit b6edff4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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})
}

Expand Down Expand Up @@ -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})
}

Expand Down Expand Up @@ -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})
}

Expand Down
10 changes: 5 additions & 5 deletions container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand Down

0 comments on commit b6edff4

Please sign in to comment.