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

test: unit tests for podmanengine.go file in container package #997

Merged
merged 2 commits into from
Mar 29, 2023

Conversation

tarun8718
Copy link
Contributor

This PR consists of unit tests for podmanengine.go file in the container package.

Below are the tests and their test execution status:
image

@github-actions
Copy link

Thanks for making a pull request! 😃
One of the maintainers will review and advise on the next steps.

@github-actions github-actions bot added the test label Mar 26, 2023
Comment on lines 41 to 49
func (e *podmanEngine) InspectImage(image string) ([]types.ImageInspect, error) {
inspectcmd := exec.Command("podman", "inspect", image)
logrus.Debugf("Inspecting image %s", image)
output, err := inspectcmd.CombinedOutput()
if err != nil {
logrus.Debugf("Unable to inspect image %s : %s, %s", image, err, output)
return t, err
return nil, err
}
t = types.ImageInspect{}
var t []types.ImageInspect
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Inspect functionality in podman returns an array of json, which can only be unmarshalled into a slice of structs.

Fixes this:
Screenshot 2023-03-26 at 11 37 29 PM

@codecov
Copy link

codecov bot commented Mar 26, 2023

Codecov Report

Patch coverage: 66.66% and project coverage change: +0.51 🎉

Comparison is base (6156882) 17.63% compared to head (20af906) 18.15%.

❗ Current head 20af906 differs from pull request most recent head bfcafb0. Consider uploading reports for the commit bfcafb0 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #997      +/-   ##
==========================================
+ Coverage   17.63%   18.15%   +0.51%     
==========================================
  Files          52       52              
  Lines        4820     4820              
==========================================
+ Hits          850      875      +25     
+ Misses       3758     3727      -31     
- Partials      212      218       +6     
Impacted Files Coverage Δ
environment/container/podmanengine.go 62.50% <66.66%> (+62.50%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@HarikrishnanBalagopal
Copy link
Contributor

Inspect functionality in podman returns an array of json, which can only be unmarshalled into a slice of structs.

Fixes this: Screenshot 2023-03-26 at 11 37 29 PM

It has to match this interface

InspectImage(image string) (dockertypes.ImageInspect, error)

Copy link
Contributor

@HarikrishnanBalagopal HarikrishnanBalagopal left a comment

Choose a reason for hiding this comment

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

Inspect functionality in podman returns an array of json, which can only be unmarshalled into a slice of structs.

Fixes this: Screenshot 2023-03-26 at 11 37 29 PM

It has to match this interface

InspectImage(image string) (dockertypes.ImageInspect, error)

@tarun8718
Copy link
Contributor Author

Inspect functionality in podman returns an array of json, which can only be unmarshalled into a slice of structs.
Fixes this: Screenshot 2023-03-26 at 11 37 29 PM

It has to match this interface

InspectImage(image string) (dockertypes.ImageInspect, error)

I've addressed this in the new commit. Please review.

Signed-off-by: tarun8718 <tarunkumar8718@gmail.com>
@HarikrishnanBalagopal HarikrishnanBalagopal added the lfx-project https://lfx.linuxfoundation.org/tools/mentorship/ label Mar 28, 2023
Signed-off-by: tarun8718 <tarunkumar8718@gmail.com>
@ashokponkumar
Copy link
Member

Please use https://quay.io/repository/konveyor/hello-world image for all the tests.

@tarun8718
Copy link
Contributor Author

https://quay.io/repository/konveyor/hello-world

@ashokponkumar some tests (like run cmd in a container) requires functionalities like touch/sleep infinity; Such tests can't be run on hello-world as it doesn't have the support. In such case which image do I use?

@HarikrishnanBalagopal HarikrishnanBalagopal enabled auto-merge (squash) March 29, 2023 04:26
Copy link
Contributor

@HarikrishnanBalagopal HarikrishnanBalagopal left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lfx-project https://lfx.linuxfoundation.org/tools/mentorship/ test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants