Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

command: add tests for container kill, commit, and pause #5506

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Stavrospanakakis
Copy link
Contributor

- What I did
This commit adds tests for the commands docker kill, docker commit, and docker pause. Also, it creates the mock methods of the docker client ContainerCommit and ContainerPause so they can be used in the tests.

For docker kill, it covers the cases that:

  • the command runs successfully
  • the client returns an error

For docker commit, it covers the cases that:

  • the command runs successfully
  • the client returns an error

For docker pause, it covers the cases that:

  • the command runs successfully
  • the client returns an error

- How I did it
I read all the test cases developed in cli/command/container directory and did the same for kill.go, commit.go and pause.go using a fakeClient and mocking the client ContainerKill, ContainerCommit and ContainerPause methods.

- How to verify it
Run: make test

- Description for the changelog

Add tests for container kill, commit, and pause commands

@codecov-commenter
Copy link

codecov-commenter commented Oct 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.59%. Comparing base (7908982) to head (442c386).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5506      +/-   ##
==========================================
+ Coverage   60.26%   60.59%   +0.32%     
==========================================
  Files         345      345              
  Lines       23448    23448              
==========================================
+ Hits        14132    14209      +77     
+ Misses       8341     8263      -78     
- Partials      975      976       +1     

This commit adds tests for the commands
docker kill, docker commit, and docker
pause. Also, it creates the mock methods
of the docker client ContainerCommit and
ContainerPause so they can
be used in the tests.

For docker kill, it covers the
cases that:
 - the command runs successfully
 - the client returns an error

For docker commit, it covers
the cases that:
 - the command runs successfully
 - the client returns an error

For docker pause, it covers
the cases that:
 - the command runs successfully
 - the client returns an error

Signed-off-by: Stavros Panakakis <[email protected]>
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.

3 participants