-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add 'expand' subcommand to list jobs and templates in a test plan (New) #1065
Conversation
The new subcommand "expands" a given test plan by going through all its sections and returning the pure (non-instantiated) jobs and templates being used. It is different from the "list-boostrapped" subcommand since it does not perform any bootstrap. By default, it outputs the jobs/templates id as text, but it can be called with the `--format json` option to output JSON data with all the known information for said jobs and templates. This is to be used by external tools, for instance to create a document listing information (summary, description...) about executed jobs and templates. Fix CHECKBOX-1263
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1065 +/- ##
==========================================
+ Coverage 40.92% 41.13% +0.21%
==========================================
Files 337 337
Lines 37547 37606 +59
Branches 6383 6398 +15
==========================================
+ Hits 15365 15471 +106
+ Misses 21543 21491 -52
- Partials 639 644 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
The select_jobs() function can actually be called with not only a list of jobs, but also templates.
Qualifiers can be used on jobs as well as templates.
This works very well, thanks! Adding a note here for future reference: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ready to land imo. See if you like my suggestions, ty for changing the nomenclature (jobs -> unit) everywhere, it is clearer now!
Sort the unit list by id/template-id before printing it out. In addition, sort the keys inside each JSON record for easier comparison.
…w) (canonical#1065) * Add 'expand' subcommand to list jobs and templates in a test plan The new subcommand "expands" a given test plan by going through all its sections and returning the pure (non-instantiated) jobs and templates being used. It is different from the "list-boostrapped" subcommand since it does not perform any bootstrap. By default, it outputs the jobs/templates id as text, but it can be called with the `--format json` option to output JSON data with all the known information for said jobs and templates. This is to be used by external tools, for instance to create a document listing information (summary, description...) about executed jobs and templates. Fix CHECKBOX-1263 * Rename plainbox.impl.secure.qualifiers.select_jobs() to select_units() The select_jobs() function can actually be called with not only a list of jobs, but also templates. * Rename IJobQualifier to IUnitQualifier Qualifiers can be used on jobs as well as templates. * Add unit tests * Sort the unit list before returning it Sort the unit list by id/template-id before printing it out. In addition, sort the keys inside each JSON record for easier comparison.
Description
The new subcommand "expands" a given test plan by going through all its sections and returning the pure (non-instantiated) jobs and templates being used.
It is different from the "list-boostrapped" subcommand since it does not perform any bootstrap.
By default, it outputs the jobs/templates id as text, but it can be called with the
--format json
option to output JSON data with all the known information for said jobs and templates.This is to be used by external tools, for instance to create a document listing information (summary, description...) about executed jobs and templates.
Resolved issues
Fix CHECKBOX-1263
Documentation
Tests
Given the following units:
Test plans:
Resource jobs:
Template jobs:
Regular jobs:
We can run the
expand
subcommand like so:Observations:
mandatory_include
section (here,demo-mandatory
)nested_part
are included (demo-job1
,demo-job-sibling1
,demo-job-sibling[1-3]
)...exclude
section (demo-job2
,demo-job-sibling4
)demo-none-name
uses a resource job that does not return anything)demo-test-regex-name
,demo-none-regex-name
)Finally, the command can also output JSON data by adding
--format json
. Here is the output ofcheckbox-cli expand --format json com.canonical.certification::demo-test-plan | jq
:JSON output