canonical / checkbox

Checkbox is a testing framework used to validate device compatibility with Ubuntu Linux. It’s the testing tool developed for the purposes of the Ubuntu Certification program.
https://checkbox.readthedocs.io
GNU General Public License v3.0
33 stars 49 forks source link

Expose Checkbox version in JSON output (submission.json) (new) #1595

Closed pieqq closed 1 week ago

pieqq commented 1 week ago

Description

The Jinja2 template data already has client_version, which internally uses the plainbox.get_version_string() function to return either the Checkbox version as a string like

Checkbox 3.3.1.dev333+gbe9508960.d20240701

either information about the Snap being used, if Checkbox is run as a snap:

checkbox 4.2.0-dev127 (10238)

This commit adds a checkbox_version field that always contains only the Checkbox version, without any additional string, such as :

3.3.1.dev333+gbe9508960.d20240701

This allows for a more precise tracking of what version of the Checkbox framework is used for debugging purposes.

Resolved issues

Fix #1580

https://warthogs.atlassian.net/browse/CHECKBOX-1643

Documentation

Checkbox JSON schema updated to reflect the new properties.

Tests

  1. Run checkbox-cli and select a test plan to run.
  2. End the session and make sure a submission archive is created
  3. Check the submission.json file and make sure it contains the client_version and checkbox_version fields, such as:
{
    "title": "session title",
    "client_version": "Checkbox 3.3.1.dev333+gbe9508960.d20240701",
    "checkbox_version": "3.3.1.dev333+gbe9508960.d20240701",
    "testplan_id": "com.canonical.certification::acpi-automated",
    "custom_joblist": false,
   (...)
}

Also tested the changes from within a snap. The resulting submission.json starts with:

{
    "title": "session title",
    "client_version": "checkbox 4.2.0-dev127 (10238)",
    "checkbox_version": "4.2.0.dev127",
    "testplan_id": "com.canonical.certification::acpi-automated",
    "custom_joblist": false,
...
}
codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 48.03%. Comparing base (b2822b6) to head (2246f89). Report is 2 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1595 +/- ## ======================================= Coverage 48.03% 48.03% ======================================= Files 371 371 Lines 39850 39852 +2 Branches 6734 6734 ======================================= + Hits 19140 19142 +2 Misses 19993 19993 Partials 717 717 ``` | [Flag](https://app.codecov.io/gh/canonical/checkbox/pull/1595/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=canonical) | Coverage Δ | | |---|---|---| | [checkbox-ng](https://app.codecov.io/gh/canonical/checkbox/pull/1595/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=canonical) | `68.65% <100.00%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=canonical#carryforward-flags-in-the-pull-request-comment) to find out more.

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