test: Test the container package. #884
Labels
good first issue
Denotes an issue ready for a new contributor, according to the "help wanted" guidelines.
hacktoberfest
help wanted
Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
Description
Since Move2Kube moved from v1 to v2 and then to the v3 architecture, the test coverage has dropped significantly.
One of the many places that need unit tests are the files in the
container
package.It is a core part of Move2Kube's
transform
functionality and yet has only a few unit tests.https://github.com/konveyor/move2kube/blob/6ee8f6be3e7f9b9eb0bb1200b468ac95018f244f/environment/container
This package deals with pulling container images, starting and stopping containers, etc. using different runtimes like Docker and Podman.
It can also copy files/directories from the local filesystem into the container and vice versa.
https://github.com/konveyor/move2kube/blob/6ee8f6be3e7f9b9eb0bb1200b468ac95018f244f/environment/container/utils.go
How to get started
For this issue you should start with some simple tests that pulls a container image, starts a container, copies a file into the container, etc.
Next step would be to make slight changes to the files in the directory and create a separate subtest for each scenario.
Some scenarios that are good to test:
How to add unit tests
Some guidelines:
move2kube/environment/container/dockerengine_test.go
Lines 25 to 61 in 6ee8f6b
move2kube/types/collection/cluster_test.go
Lines 28 to 105 in 6ee8f6b
Some helpful resources on how to write unit tests in Go:
Code to be tested
https://github.com/konveyor/move2kube/blob/6ee8f6be3e7f9b9eb0bb1200b468ac95018f244f/environment/container
The text was updated successfully, but these errors were encountered: