-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add empty tutorial provider * add tutorial jobs that end in 3 different outcomes * add additional units for the tutorial provider * Add tutorial job that uses an environment variable * Add readme for the tutorial provider * Split tutorial provider name and namespace * Amend existing tutorial pages to point to the newly created tutorial test plan * Add tutorial provider to the checkbox22 snap The base tutorial uses jobs and test plan from this provider as part of the introduction to Checkbox, so it needs to be present in the snap. * Add a Tutorial category * Tutorial provider: update existing jobs and add manual and semi-auto jobs * Tutorial provider: add interactive jobs to the test plan --------- Co-authored-by: Pierre Equoy <pierre.equoy@canonical.com>
- Loading branch information
Showing
10 changed files
with
224 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,7 @@ | ||
Summary | ||
======= | ||
|
||
This provider contains jobs and test plans used in the tutorial available in | ||
the official Checkbox documentation: | ||
|
||
https://checkbox.readthedocs.io/en/latest/tutorial/ |
This file contains 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,10 @@ | ||
#!/usr/bin/env python3 | ||
from plainbox.provider_manager import setup, N_ | ||
|
||
setup( | ||
name="tutorial", | ||
namespace="com.canonical.certification", | ||
version="1.0", | ||
description=N_("The Checkbox Tutorial provider"), | ||
gettext_domain="com_canonical_certification_tutorial", | ||
) |
This file contains 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,3 @@ | ||
unit: category | ||
id: tutorial | ||
_name: Tutorial |
This file contains 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,125 @@ | ||
id: tutorial/passing | ||
category_id: tutorial | ||
plugin: shell | ||
_summary: A job that always passes | ||
command: | ||
echo This job passes! | ||
true | ||
|
||
id: tutorial/failing | ||
category_id: tutorial | ||
plugin: shell | ||
_summary: A job that always fails | ||
command: | ||
echo This job fails! | ||
false | ||
|
||
id: tutorial/crashing | ||
category_id: tutorial | ||
plugin: shell | ||
_summary: A job that always crashes | ||
command: | ||
# Start the sleep 5 command, but if it doesn't finish in 1 second, send it the | ||
# KILL signal to stop it immediately." Since sleep 5 is meant to run for 5 | ||
# seconds and the timeout is set to 1 second, the sleep 5 command will be | ||
# killed by the KILL signal after just 1 second. | ||
echo "This job crashes because we run a command to kill it before it's finished." | ||
timeout -s KILL 0.1 sleep 5 | ||
|
||
id: tutorial/has_resource | ||
category_id: tutorial | ||
plugin: shell | ||
requires: | ||
(tutorial_resources.name == 'first-resource' and tutorial_resources.has_required_thing == 'true') | ||
_summary: A job that requires a resource and it is available | ||
command: | ||
echo This job runs because its requirements are fulfilled. | ||
true | ||
|
||
id: tutorial/no_resource | ||
category_id: tutorial | ||
plugin: shell | ||
requires: | ||
(tutorial_resources.name == 'second-resource' and tutorial_resources.has_required_thing == 'true') | ||
_summary: A job that requires a resource but it's not available | ||
command: | ||
true # doesn't matter - will not run | ||
|
||
id: tutorial/passing_dependency | ||
category_id: tutorial | ||
plugin: shell | ||
depends: | ||
tutorial/passing | ||
_summary: A job that depends on other job that passes | ||
command: | ||
true # this will run! | ||
|
||
id: tutorial/failing_dependency | ||
category_id: tutorial | ||
plugin: shell | ||
depends: | ||
tutorial/failing | ||
_summary: A job that is skipped because it depends on a job that fails | ||
command: | ||
true # doesn't matter - will not run | ||
|
||
id: tutorial/environment_variable | ||
category_id: tutorial | ||
plugin: shell | ||
_summary: A job that displays an environment variable, if set | ||
environ: TUTORIAL | ||
command: | ||
echo This job prints the content of a given environment variable if set, or a default value otherwise | ||
echo ${TUTORIAL:-"Default Value"} | ||
|
||
id: tutorial/manual | ||
category_id: tutorial | ||
plugin: manual | ||
_summary: A manual job | ||
estimated_duration: 1m | ||
_purpose: | ||
This is a manual job. User needs to select an outcome. | ||
_steps: | ||
1. Read the content of this job. | ||
2. Check that there are 3 sections (Purpose, Steps, Verification). | ||
_verification: | ||
Did Checkbox display all 3 sections of the manual job? | ||
|
||
id: tutorial/user-interact | ||
category_id: tutorial | ||
plugin: user-interact | ||
_summary: A semi-automated job where the outcome is set automatically | ||
estimated_duration: 1m | ||
command: true | ||
_purpose: | ||
This is a "user-interact" semi-automated job. It requires the user to perform | ||
an interaction, after which the outcome is automatically set and Checkbox moves | ||
on to the next job. | ||
. | ||
This test will run the command `true`, which always returns 0. | ||
_steps: | ||
1. Read the content of this job. | ||
2. Press Enter to start the test. The outcome will be set automatically to | ||
"pass" based on the return value from the command, and Checkbox will then | ||
move on to the next job. | ||
|
||
id: tutorial/user-interact-verify | ||
category_id: tutorial | ||
plugin: user-interact-verify | ||
_summary: A semi-automated job where the user manually sets the outcome | ||
estimated_duration: 1m | ||
command: true | ||
_purpose: | ||
This is a "user-interact-verify" semi-automated job. It requires the user | ||
to perform an interaction, then Checkbox executes a command and suggests | ||
an outcome based its return code. However, in the end it is up to the user | ||
to manually choose the right outcome. | ||
. | ||
This test will run the command `true`, which always returns 0. | ||
_steps: | ||
1. Read the content of this job. | ||
2. Press Enter to start the test. The outcome will be automatically set to | ||
"pass" but you will have a chance to manually select another outcome. | ||
_verification: | ||
Make sure that Checkbox suggested the outcome to be "pass", yet you can | ||
still manually select another outcome. |
This file contains 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,11 @@ | ||
id: tutorial_resources | ||
category_id: tutorial | ||
plugin: resource | ||
_summary: A job that generates different resources for tutorial purposes | ||
command: | ||
echo name: first-resource | ||
echo has_required_thing: true | ||
echo | ||
echo name: second-resource | ||
echo has_required_thing: false | ||
echo |
This file contains 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,17 @@ | ||
unit: test plan | ||
id: tutorial-base | ||
_name: Checkbox Base Tutorial Test Plan | ||
bootstrap_include: | ||
tutorial_resources | ||
include: | ||
tutorial/passing | ||
tutorial/failing | ||
tutorial/crashing | ||
tutorial/passing_dependency | ||
tutorial/failing_dependency | ||
tutorial/has_resource | ||
tutorial/no_resource | ||
tutorial/environment_variable | ||
tutorial/manual | ||
tutorial/user-interact | ||
tutorial/user-interact-verify |