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 50 forks source link

Resource expression v2 implementation (new) #1593

Open Hook25 opened 1 week ago

Hook25 commented 1 week ago

Description

Currently we have a mechanism to gate jobs and generate job from templates that is called resource jobs + resource expressions. The evaluation of these resource expressions is currently semantically broken. It was intentionally broken because the current implementation is too expensive as it tries to computes an explicit product of all resources involved in an expression to then filter them. Additionally the current implementation doesn't allow to fetch "why" a resource expression matches a resource set or not. This doesn't allow Checkbox to produce an explanation to why a job was skipped, but also importantly, greately slows down template expansions, because to do it the current implementation is called N times (one per resource object) to see if it matches the expression.

This is the implementation of a new system that matches the original grammar (with 1 major breaking change) but should:

Resolved issues

Fixes: CHECKBOX-1384

Documentation

The module should be self documenting, all relevant classes and method and the module itself have ample documentation inside

Tests

This adds tests for various scenarios

Note: This is checked out from resource_expression_v2 branch, just the new resource expression implementation

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 96.29630% with 10 lines in your changes missing coverage. Please review.

Project coverage is 48.35%. Comparing base (27405cf) to head (abfaa21). Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
checkbox-ng/plainbox/impl/new_resource.py 96.29% 7 Missing and 3 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1593 +/- ## ========================================== + Coverage 48.03% 48.35% +0.32% ========================================== Files 371 372 +1 Lines 39850 40122 +272 Branches 6734 6775 +41 ========================================== + Hits 19140 19402 +262 - Misses 19993 20000 +7 - Partials 717 720 +3 ``` | [Flag](https://app.codecov.io/gh/canonical/checkbox/pull/1593/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/1593/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=canonical) | `69.15% <95.92%> (+0.50%)` | :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.