Allow non-exact matching for ids in cli subcommands (New)#1964
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1964 +/- ##
==========================================
+ Coverage 50.55% 50.64% +0.09%
==========================================
Files 384 384
Lines 41116 41222 +106
Branches 7628 7658 +30
==========================================
+ Hits 20786 20878 +92
- Misses 19586 19597 +11
- Partials 744 747 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Minor: fixed missing import
Minor: raise system exit when more than 1 is found
pieqq
left a comment
There was a problem hiding this comment.
Tested locally, works as advertised, it's really nice! I tried it with expand, list-bootstrapped and show.
One request with regard to help and docs:
Currently, commands that take a test plan as input have an help screen that looks like this:
checkbox-cli expand -h
usage: checkbox-cli [-h] [-f FORMAT] [--exact] TEST_PLAN
Expand a given test plan: display all the jobs, templates and manifest entries that are defined in this test plan and that would be executed if ran. This is useful to visualize the full list of units called for complex test plans that consist of many nested parts with different 'include' and 'exclude' sections.
NOTE: the elements listed here are not sorted by execution order. To see the execution order, please use the 'list-bootstrapped' command instead.
positional arguments:
TEST_PLAN test-plan id to expand
options:
-h, --help show this help message and exit
-f FORMAT, --format FORMAT
output format: 'text' or 'json' (default: text)
--exact only expand the test-plan that exactly matches
Can you:
- improve the help text for
TEST_PLAN(for example, for above,testplan id to expand (namespace can be omitted)or something like that) - reword the help for
exact(e.g.only expand the testplan that exactly matches the given string (must include namespace))
Can you also update the tutorial page A few more Checkbox commands to explain that namespace is not necessary and to show it? (so, for instance in the list-bootstrapped example, replace list-bootstrapped com.canonical.certification::audio-cert-automated with list-bootstrapped audio-cert-automated). There is a Namespace ref in the glossary that you can point to if needed.
fernando79513
left a comment
There was a problem hiding this comment.
I've just left two small comments. Can't wait to have this in place. I've just had to write twice the com.canonical.certification this morning.
Minor: remove typo from the docs
* Allow non-exact matching for ids in cli subcommands * Roll back hackaround IQN being dumb * Test find_children_by_name Minor: fixed missing import * Test get_testplan_ids_by_id Minor: raise system exit when more than 1 is found * Explain fuzzy matching in a note in the docs * Better naming of variables * Mention what has to fully match * No more FQID -> fully qualified ID Minor: remove typo from the docs
* Allow non-exact matching for ids in cli subcommands * Roll back hackaround IQN being dumb * Test find_children_by_name Minor: fixed missing import * Test get_testplan_ids_by_id Minor: raise system exit when more than 1 is found * Explain fuzzy matching in a note in the docs * Better naming of variables * Mention what has to fully match * No more FQID -> fully qualified ID Minor: remove typo from the docs
* Allow non-exact matching for ids in cli subcommands * Roll back hackaround IQN being dumb * Test find_children_by_name Minor: fixed missing import * Test get_testplan_ids_by_id Minor: raise system exit when more than 1 is found * Explain fuzzy matching in a note in the docs * Better naming of variables * Mention what has to fully match * No more FQID -> fully qualified ID Minor: remove typo from the docs
* Allow non-exact matching for ids in cli subcommands * Roll back hackaround IQN being dumb * Test find_children_by_name Minor: fixed missing import * Test get_testplan_ids_by_id Minor: raise system exit when more than 1 is found * Explain fuzzy matching in a note in the docs * Better naming of variables * Mention what has to fully match * No more FQID -> fully qualified ID Minor: remove typo from the docs
Description
It is often bothersome, and rarely useful, to include the namespace for all ids in the checkbox-cli subcommands.
This changes them all so that any id provided will be searched both as a
namespace::idand a?::idinput. This doesn't affect the user that provides the namespace, but makes it way more accessible for all users to use these tools.Whenever this behaviour is not desirable, for whatever reason,
--exactcan be provided to all changed subcommands to have the old behaviour back.Resolved issues
Fixes: https://warthogs.atlassian.net/browse/CHECKBOX-1951
Documentation
Documents the new
--exactoptionTests
Tested new functions added (most)
Launched manually the commands with the new and old behaviour, ie.
should all yield the same result