Conversation
* Fix validation * Fix setting default value
tgreenx
left a comment
There was a problem hiding this comment.
Great work ! I reviewed as much as I could, and didn't find any obvious issue (and also after manual testing). Moreover the t/usage.t file is quite large and should provide good coverage.
Note that the PR was missing a version tag, so I added V-Minor for now but the updated exit codes (i.e. 0, 1 and 2 instead of just 0 and 1) could justify a V-Major.
matsduf
left a comment
There was a problem hiding this comment.
Press return to run 'make distcheck'...
"/usr/local/bin/perl" "-Iinc" "-MExtUtils::Manifest=fullcheck" -e fullcheck
Not in MANIFEST: t/usage.fake-data.data
Not in MANIFEST: t/usage.fake-root.data
Not in MANIFEST: t/usage.hints
Not in MANIFEST: t/usage.normal.data
Not in MANIFEST: t/usage.profile
Not in MANIFEST: t/usage.t
Not in MANIFEST: t/usage.wrapper.pl
|
I've updated the MANIFEST file. Please approve/review again. |
|
Since it is a API change a |
|
Thanks for reviewing! |
Purpose
This PR adds a framework for automatic testing of the user interface of zonemaster-cli.
To validate the design of the framework I've added a large amount of tests providing good coverage of validation and happy paths of command line options. Please let me know if I've missed anything so I can add it in a followup PR. The only options I know I've left out are
--saveand--restore.Context
I made this to be able to ensure good test coverage when migrating away from MooseX::Getopt::GLD without having to perform excessive amounts of manual testing.
Changes
The most important part of this PR is the introduction of
t/usage.thosting a testing framework (check_success()andcheck_usage_error()) as well as a battery of tests. The framework relies on a wrapper scriptt/usage.wrapper.plthat acts as a test harness.The added tests are categorized into four groups. Each group uses a separate file for recorded data.
I found a couple of bugs when adding these tests and I've included fixes for most of those as well.
I've moved all calls to exit from Zonemaster::CLI into zonemaster-cli. This way the wrapper can perform its cleanup.
Zonemaster::CLI is updated to print errors to STDERR and return exit status 2 on usage errors. This is conventional and allows for more accurate testing.
zonemaster-cli is updated to exit with status 1 if Zonemaster::CLI throws an exception. We didn't really exert much control over these exit statuses before.
Some PO files that apparently are untidy in develop are tidied to make
t/po-files.thappy.How to test this PR
Run
t/usage.t.