konveyor / move2kube

Move2Kube is a command-line tool for automating creation of Infrastructure as code (IaC) artifacts. It has inbuilt support for creating IaC artifacts for replatforming to Kubernetes/Openshift.
https://move2kube.konveyor.io/
Apache License 2.0
383 stars 118 forks source link

test: Test the container package. #884

Closed HarikrishnanBalagopal closed 5 months ago

HarikrishnanBalagopal commented 1 year ago

⚠️ Don't forget to read our contribution guidelines before you start working on an issue https://github.com/konveyor/move2kube/blob/main/contributing.md

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:

Some helpful resources on how to write unit tests in Go:

Code to be tested

https://github.com/konveyor/move2kube/blob/6ee8f6be3e7f9b9eb0bb1200b468ac95018f244f/environment/container

moki1202 commented 1 year ago

@HarikrishnanBalagopal I've written a few (rather simple) go tests so I think I can try to give this a go :)

punithnayak commented 1 year ago

Hey @HarikrishnanBalagopal Can you assign me so that can raise a Pr

HarikrishnanBalagopal commented 1 year ago

Hey @HarikrishnanBalagopal Can you assign me so that can raise a Pr

Thanks for your interest. I have assigned the issue to you. Feel free to ask in the #konveyor Slack channel to get help https://kubernetes.slack.com/archives/CR85S82A2

akagami-harsh commented 8 months ago

hey @HarikrishnanBalagopal, what's the status on the issue

HarikrishnanBalagopal commented 5 months ago

@akagami-harsh Fixed in https://github.com/konveyor/move2kube/pull/994 and https://github.com/konveyor/move2kube/pull/997