Skip to content

Conversation

@kolyshkin
Copy link
Contributor

If container wait has failed, show an error from the engine and return an appropriate exit code.

This relies on engine changes from moby/moby#34999

If container wait has failed, show an error from the engine
and return an appropriate exit code.

This requires engine changes from moby/moby#34999

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@codecov-io
Copy link

codecov-io commented Dec 15, 2017

Codecov Report

Merging #755 into master will increase coverage by 2.63%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #755      +/-   ##
==========================================
+ Coverage   50.92%   53.56%   +2.63%     
==========================================
  Files         237      218      -19     
  Lines       15332    14617     -715     
==========================================
+ Hits         7808     7829      +21     
+ Misses       7024     6305     -719     
+ Partials      500      483      -17

@dnephin
Copy link
Contributor

dnephin commented Dec 18, 2017

Looks like we are missing unit test coverage for this function. Would you mind writing a test for the error case and the success case? It should be easy to produce an error using the fake client in cli/command/container/client_test.go (just add the wait method), and NewFakeCli().

@kolyshkin
Copy link
Contributor Author

@dnephin test cases added, PTAL

Copy link
Collaborator

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🦁

}

client := test.NewFakeCli(&fakeClient{waitFunc: waitFn, Version: api.DefaultVersion})
//t.Logf("client version: %v\n", client.ClientVersion())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove that one 👼

Copy link
Contributor

@dnephin dnephin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (with the commented out line removed)

var res container.ContainerWaitOKBody

go func() {
if strings.Contains(cid, "exit-code-42") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could use a switch/case

switch {
case strings.Contains(cid, "exit-code-42"):
 ...
}

but not a big deal

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin
Copy link
Contributor Author

Commits updated as per @vdemeester and @dnephin suggestions; I think it's ready to be merged.

@dnephin dnephin merged commit 1620538 into docker:master Jan 16, 2018
@GordonTheTurtle GordonTheTurtle added this to the 18.02.0 milestone Jan 16, 2018
nobiit pushed a commit to nobidev/docker-cli that referenced this pull request Nov 19, 2025
Show container wait error
Upstream-commit: 1620538
Component: cli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants