command: add tests for container kill, commit, and pause #5506
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
- What I did
This commit adds tests for the commands
docker kill
,docker commit
, anddocker pause
. Also, it creates the mock methods of the docker clientContainerCommit
andContainerPause
so they can be used in the tests.For
docker kill
, it covers the cases that:For
docker commit
, it covers the cases that:For
docker pause
, it covers the cases that:- How I did it
I read all the test cases developed in
cli/command/container
directory and did the same forkill.go
,commit.go
andpause.go
using afakeClient
and mocking the clientContainerKill
,ContainerCommit
andContainerPause
methods.- How to verify it
Run:
make test
- Description for the changelog