avocado-framework / avocado

Avocado is a set of tools and libraries to help with automated testing. One can call it a test framework with benefits. Native tests are written in Python and they follow the unittest pattern, but any executable can serve as a test.
https://avocado-framework.github.io/
Other
345 stars 343 forks source link

VMimage get --debug option #6061

Open richtja opened 3 weeks ago

richtja commented 3 weeks ago

This commit adds a new option to vmimage get feature called debug. It brings possibility to run vmimage command in debug mode to get more detailed information about possible failures. In debug mode, all exceptions caused by vmimage utility will be raised to console. That should provide enough information for further debugging of possible issues.

Reference: #6051


vmimage get without debug:

$ avocado vmimage get --distro Fedora --distro-version 2 
The requested image could not be downloaded

vmimage get with debug:

$ avocado vmimage get --distro Fedora --distro-version 2 --debug
avocado.utils.vmimage: Version not available at https://dl.fedoraproject.org/pub/fedora/linux/releases/
The requested image could not be downloaded
codecov[bot] commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 26.66667% with 11 lines in your changes missing coverage. Please review.

Project coverage is 54.44%. Comparing base (6b55d5a) to head (7420e5f). Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
avocado/plugins/vmimage.py 14.28% 6 Missing :warning:
avocado/utils/vmimage.py 37.50% 5 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #6061 +/- ## ========================================== - Coverage 54.46% 54.44% -0.03% ========================================== Files 202 202 Lines 21883 21890 +7 ========================================== - Hits 11919 11918 -1 - Misses 9964 9972 +8 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

richtja commented 2 weeks ago

Hi @richtja ,

Thanks for working on this. While this gets the most important thing done, that is, info about a failure, IMO a --debug option should:

1. Also work during success cases, that is, it should show what's going on whether the operation is succeeding or failing

2. Should not crash the application

Have you tried adding various logging entries to the avocado.utils.vmimage module and making them visible when --debug is given?

Hi @clebergnu, thanks for your review. I have changed this PR to use logging instead of raising errors. Please have a look.