-
Notifications
You must be signed in to change notification settings - Fork 70
New documentation for groups feature (Infra) #2208
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
Open
fernando79513
wants to merge
6
commits into
main
Choose a base branch
from
add-groups-documentation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5566526
New documentation for groups feature
fernando79513 06c4a32
Apply suggestions from code review
fernando79513 4ebae5e
Added PR suggestions
fernando79513 7cf8126
Addressed validation comments
fernando79513 6a29d57
Clarifying group usage
fernando79513 d20519b
Fixed single quoting
fernando79513 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,237 @@ | ||
| Using groups | ||
| ^^^^^^^^^^^^^^^ | ||
|
|
||
| The ``group`` field lets you keep related jobs together and have the | ||
| dependency solver treat them as a single block. This is useful for | ||
| jobs that require a setup/teardown, or a sequence of jobs that | ||
| must not be interleaved with others. | ||
|
|
||
| Groups are not units, therefore a group id cannot be used in the ``include`` section | ||
| of a test plan. They are fields inside job units, like ``depends``, ``after`` or | ||
| ``before``, and also serve the purpose of controlling execution order. | ||
|
|
||
| Key behaviors of groups | ||
| -------------------------- | ||
|
|
||
| - Jobs in the same group are always run as a contiguous block. | ||
| - Dependencies between jobs **inside** the group are resolved normally. | ||
| - If a job **inside** the group depends on a job **outside**, the **whole group** | ||
| depends on that outside job. | ||
| - If a job **outside** the group depends on a job **inside**, it depends on the | ||
| **whole group**. | ||
| - If these group-level dependencies create a cycle, Checkbox outputs a dependency | ||
| warning and removes the involved jobs from the test plan. | ||
|
|
||
| Examples | ||
| -------- | ||
|
|
||
| Setup/teardown structure | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| The group field could be used to create a setup → tests → teardown structure, | ||
| where the setup and teardown jobs are part of the same group as the tests. | ||
|
|
||
| .. code-block:: | ||
|
|
||
| id: wireless_setup | ||
| flags: simple | ||
| group: group_wireless | ||
| command: echo 'Setting up wireless tests' | ||
|
|
||
| id: wireless_test_1 | ||
| flags: simple | ||
| group: group_wireless | ||
| after: wireless_setup | ||
| before: wireless_teardown | ||
| command: echo 'Running wireless test 1' | ||
|
|
||
| id: wireless_test_2 | ||
| flags: simple | ||
| group: group_wireless | ||
| after: wireless_setup | ||
| before: wireless_teardown | ||
| command: echo 'Running wireless test 2' | ||
|
|
||
| id: wireless_teardown | ||
| flags: simple | ||
| group: group_wireless | ||
| after: wireless_setup | ||
| command: echo 'Tearing down wireless tests' | ||
|
|
||
| id: wireless_test_plan | ||
| name: wireless_test_plan | ||
| unit: test plan | ||
| _summary: Setup/teardown group test | ||
| include: | ||
| wireless_.* | ||
|
|
||
| Execution order:: | ||
|
|
||
| wireless_setup | ||
| wireless_test_1 | ||
| wireless_test_2 | ||
| wireless_teardown | ||
|
|
||
| Step-by-step execution | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| If we want to ensure a strict step-by-step execution order between jobs, even | ||
| if there are dependencies on other jobs, we can use groups to enforce that. | ||
|
|
||
| .. code-block:: | ||
|
|
||
| id: gather_device_info | ||
| flags: simple | ||
| command: echo "device_info" >> "$PLAINBOX_SESSION_SHARE"/device_info.txt | ||
|
|
||
| id: device_insert | ||
| flags: simple | ||
| group: group_device | ||
| command: echo "Inserting device" | ||
|
|
||
| id: device_test_write | ||
| flags: simple | ||
| group: group_device | ||
| depends: gather_device_info device_insert | ||
| command: echo "Testing device write" | ||
|
|
||
| id: device_test_read | ||
| flags: simple | ||
| group: group_device | ||
| after: device_test_write | ||
| command: echo "Testing device read" | ||
|
|
||
| id: device_remove | ||
| flags: simple | ||
| group: group_device | ||
| after: device_test_read | ||
| command: echo "Removing device" | ||
|
|
||
| id: device_test_plan | ||
| name: device_test_plan | ||
| unit: test plan | ||
| _summary: Step by step device test | ||
| include: | ||
| device_.* | ||
| gather_device_info | ||
fernando79513 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Execution order:: | ||
|
|
||
| gather_device_info | ||
| device_insert | ||
| device_test_write | ||
| device_test_read | ||
| device_remove | ||
|
|
||
| .. note:: | ||
|
|
||
| Although ``gather_device_info`` is placed after the ``device_*`` jobs, it will be | ||
| executed by Checkbox before them because ``device_test_write`` depends on it and | ||
| because it's part of the ``group_device`` group like all the other ``device_*`` jobs. | ||
|
|
||
| Templated groups | ||
| ~~~~~~~~~~~~~~~~ | ||
|
|
||
| The group field can also be used in templated jobs. | ||
|
|
||
| .. note:: | ||
|
|
||
| Templated jobs can not be used as dependencies, See Instantiation in :ref:`Template unit<templates>`. | ||
|
|
||
| .. code-block:: | ||
|
|
||
| id: group_template_resource | ||
| plugin: resource | ||
| command: | ||
| echo 'id: A' | ||
| echo '' | ||
| echo 'id: B' | ||
|
|
||
| unit: template | ||
| template-unit: job | ||
| template-resource: group_template_resource | ||
| id: test_{id}_1 | ||
| group: group_{id} | ||
| flags: simple | ||
| command: echo "Running test {id}_1" | ||
|
|
||
| unit: template | ||
| template-unit: job | ||
| template-resource: group_template_resource | ||
| id: test_{id}_2 | ||
| group: group_{id} | ||
| flags: simple | ||
| command: echo "Running test {id}_2" | ||
|
|
||
| id: ordering_groups_template | ||
| name: ordering_groups_template | ||
| unit: test plan | ||
| _summary: Templated group order test | ||
| include: | ||
| test_id_1 | ||
| test_id_2 | ||
fernando79513 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| bootstrap_include: | ||
| group_template_resource | ||
|
|
||
| Execution order:: | ||
|
|
||
| test_A_1 | ||
| test_A_2 | ||
| test_B_1 | ||
| test_B_2 | ||
|
|
||
|
|
||
| Groups in jobs with the "also-after-suspend" flag | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| The dependency manager can handle jobs with the "also-after-suspend" | ||
| flag inside groups. | ||
|
|
||
| .. note:: | ||
|
|
||
| Since ``also-after-suspend`` jobs make use of the ``siblings`` feature, they can not be used | ||
| as dependencies. See Instantiation in :ref:`Template unit<templates>`. | ||
|
|
||
|
|
||
| .. code-block:: | ||
|
|
||
| id: test_A_1 | ||
| group: group_A | ||
| flags: simple also-after-suspend | ||
| command: echo "Running test 1" | ||
|
|
||
| id: test_A_2 | ||
| group: group_A | ||
| flags: simple also-after-suspend | ||
| command: echo "Running test 2" | ||
|
|
||
| id: test_B_1 | ||
| group: group_B | ||
| flags: simple also-after-suspend | ||
| command: echo "Running test 3" | ||
|
|
||
| id: test_B_2 | ||
| group: group_B | ||
| flags: simple also-after-suspend | ||
| command: echo "Running test 4" | ||
|
|
||
| id: after_suspend_groups | ||
| name: after_suspend_groups | ||
| unit: test plan | ||
| _summary: after_suspend_groups | ||
| include: | ||
| .*test_.* | ||
|
|
||
| Execution order:: | ||
|
|
||
| test_A_1 | ||
| test_A_2 | ||
| test_B_1 | ||
| test_B_2 | ||
| sleep | ||
| rtc | ||
| suspend/suspend_advanced_auto | ||
| after-suspend-test_A_1 | ||
| after-suspend-test_A_2 | ||
| after-suspend-test_B_1 | ||
| after-suspend-test_B_2 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.