Skip to content

Manifest snap update jobs (New)#883

Merged
pieqq merged 6 commits intomainfrom
manifest-snap-update-jobs
Dec 14, 2023
Merged

Manifest snap update jobs (New)#883
pieqq merged 6 commits intomainfrom
manifest-snap-update-jobs

Conversation

@pieqq
Copy link
Copy Markdown
Collaborator

@pieqq pieqq commented Dec 8, 2023

Description

Following #805, this PR pushes things further (see below for a rundown).

Note: Although this test plan is added to the SRU and IoT-related test plans, it does not have any effect by default because it requires a manifest entry to be declared in the machine-manifest.json file (or manually input in the Manifest Entry screen if running tests manually). See newly created base/units/snapd/README.md file for more info.

Add manifest entries to test gadget/kernel/snapd snaps

The snap-refresh-*-from-[stable|base]-rev jobs are executed if the
revision of the related snap (gadget, kernel, snapd) currently installed
on the device is different from the revision in base version and/or
stable channel.

It is better to provide an option to decide whether or not these tests
should be executed, per device.

This is achieved using three manifest entries (one per snap type).

If these entries are explicitly set to true in the manifest, they will
be executed (if they match the condition described above, of course).
Otherwise, they will be skipped.

Move snap refresh/revert jobs and test plans in the snapd section

These jobs and test plans are not specific to Ubuntu Core and can be run
on any device running snapd (classic, server, core and hybrid images).

To make this clearer, we:

  • Move jobs and test plans from the the base provider's ubuntucore/
    section to the snapd/ section
  • Adjust their names (rename prefixes from ubuntucore to snapd)
  • Adjust their categories (from ubuntucore to snapd)

Add snap-refresh-revert nested part to SRU and snappy-snap-automated test plans

Doing so ensure the snap refresh/revert tests are executed on every
device running the SRU test plan (mostly classic images) as well as on
devices running IoT-related test plans (mostly Ubuntu core images).

Add documentation about all of this in the base provider's snapd section

A README.md file is added in base/units/snapd/ to provide more explanation about this test plan and the jobs it contains.

Resolved issues

CHECKBOX-718

Documentation

See base/units/snapd/README.md.

Tests

Tested locally using a virtual environment on 22.04 desktop.

Resource

Since 22.04 desktop has snapd installed but no gadget nor kernel snaps, the resource job only returns data for snapd:

$ ./snap_update_test.py --resource
name: snapd
type: snapd
tracking: latest/stable
base_rev: 16292
stable_rev: 20290
candidate_rev: 20290
beta_rev: 20671
edge_rev: 20747
original_installed_rev: 20290

✔️

Manifest entries

  1. Run checkbox-cli
  2. Select the "Snaps refresh and revert automated tests" test plan (com.canonical.certification::snap-refresh-revert)
  3. Select all the jobs and press T
  4. In the System Manifest screen, you should be able to select if you want to test Snapd or not. Select (X) No and press T to launch the test run

→ after a short while, the jobs re-run screen is show because all of the jobs have been skipped due to "failed dependencies". ✔️

  1. Press F to finish. In the text summary, you can see:
------------------[ Refresh snapd snap to its base revision ]-------------------
ID: com.canonical.certification::snapd/snap-refresh-snapd-snapd-to-base-rev
Category: com.canonical.certification::snapd
Job cannot be started because:
 - resource expression 'manifest.need_snapd_snap_update_test == "True"' evaluates to false

which is expected since we selected "No" in the manifest screen. ✔️

Run the same steps, but select "Yes" in the manifest:

  • The tests that refresh/revert to the base revision should now be executed (since base rev = 16292 while current installed rev = 20290)
  • The tests that refresh/revert to stable revision should be skipped since the revisions are the same

Inclusion in SRU and IoT test plans

The snap-refresh-revert test plan is found by Checkbox and contains the expected jobs:

Output of the snap-refresh-revert test plan on a 22.04 desktop
(venv) $ checkbox-cli list-bootstrapped "com.canonical.certification::snap-refresh-revert"
com.canonical.certification::snap_revision_info
com.canonical.plainbox::manifest
com.canonical.certification::snapd/snap-refresh-snapd-snapd-to-base-rev
com.canonical.certification::snapd/reboot-after-snap-refresh-snapd-snapd-to-base-rev
com.canonical.certification::snapd/snap-verify-after-refresh-snapd-snapd-to-base-rev
com.canonical.certification::snapd/snap-revert-snapd-snapd-from-base-rev
com.canonical.certification::snapd/reboot-after-snap-revert-snapd-snapd-from-base-rev
com.canonical.certification::snapd/snap-verify-after-revert-snapd-snapd-from-base-rev
com.canonical.certification::snapd/snap-refresh-snapd-snapd-to-stable-rev
com.canonical.certification::snapd/reboot-after-snap-refresh-snapd-snapd-to-stable-rev
com.canonical.certification::snapd/snap-verify-after-refresh-snapd-snapd-to-stable-rev
com.canonical.certification::snapd/snap-revert-snapd-snapd-from-stable-rev
com.canonical.certification::snapd/reboot-after-snap-revert-snapd-snapd-from-stable-rev
com.canonical.certification::snapd/snap-verify-after-revert-snapd-snapd-from-stable-rev

These jobs are also present in the SRU test plan since the snap-refresh-revert is now nested in it:

Selective output of the SRU test plan
(venv) $ checkbox-cli list-bootstrapped "com.canonical.certification::sru" | grep -i ".*snapd/.*-rev"
com.canonical.certification::snapd/snap-refresh-snapd-snapd-to-base-rev
com.canonical.certification::snapd/reboot-after-snap-refresh-snapd-snapd-to-base-rev
com.canonical.certification::snapd/snap-verify-after-refresh-snapd-snapd-to-base-rev
com.canonical.certification::snapd/snap-revert-snapd-snapd-from-base-rev
com.canonical.certification::snapd/reboot-after-snap-revert-snapd-snapd-from-base-rev
com.canonical.certification::snapd/snap-verify-after-revert-snapd-snapd-from-base-rev
com.canonical.certification::snapd/snap-refresh-snapd-snapd-to-stable-rev
com.canonical.certification::snapd/reboot-after-snap-refresh-snapd-snapd-to-stable-rev
com.canonical.certification::snapd/snap-verify-after-refresh-snapd-snapd-to-stable-rev
com.canonical.certification::snapd/snap-revert-snapd-snapd-from-stable-rev
com.canonical.certification::snapd/reboot-after-snap-revert-snapd-snapd-from-stable-rev
com.canonical.certification::snapd/snap-verify-after-revert-snapd-snapd-from-stable-rev

And the jobs are also available in every IoT related test plans, since they are nested in snappy-snap-automated which is present in every IoT test plans:

Partial output from the client-cert-iot-ubuntucore-16 test plan
(venv) $ checkbox-cli list-bootstrapped "com.canonical.certification::client-cert-iot-ubuntucore-16" | grep -i ".*snapd/.*-rev"
com.canonical.certification::snapd/snap-refresh-snapd-snapd-to-base-rev
com.canonical.certification::snapd/reboot-after-snap-refresh-snapd-snapd-to-base-rev
com.canonical.certification::snapd/snap-verify-after-refresh-snapd-snapd-to-base-rev
com.canonical.certification::snapd/snap-revert-snapd-snapd-from-base-rev
com.canonical.certification::snapd/reboot-after-snap-revert-snapd-snapd-from-base-rev
com.canonical.certification::snapd/snap-verify-after-revert-snapd-snapd-from-base-rev
com.canonical.certification::snapd/snap-refresh-snapd-snapd-to-stable-rev
com.canonical.certification::snapd/reboot-after-snap-refresh-snapd-snapd-to-stable-rev
com.canonical.certification::snapd/snap-verify-after-refresh-snapd-snapd-to-stable-rev
com.canonical.certification::snapd/snap-revert-snapd-snapd-from-stable-rev
com.canonical.certification::snapd/reboot-after-snap-revert-snapd-snapd-from-stable-rev
com.canonical.certification::snapd/snap-verify-after-revert-snapd-snapd-from-stable-rev
Partial output from the client-cert-iot-ubuntucore-22 test plan
(venv) $ checkbox-cli list-bootstrapped "com.canonical.certification::client-cert-iot-ubuntucore-22" | grep -i ".*snapd/.*-rev"
com.canonical.certification::snapd/snap-refresh-snapd-snapd-to-base-rev
com.canonical.certification::snapd/reboot-after-snap-refresh-snapd-snapd-to-base-rev
com.canonical.certification::snapd/snap-verify-after-refresh-snapd-snapd-to-base-rev
com.canonical.certification::snapd/snap-revert-snapd-snapd-from-base-rev
com.canonical.certification::snapd/reboot-after-snap-revert-snapd-snapd-from-base-rev
com.canonical.certification::snapd/snap-verify-after-revert-snapd-snapd-from-base-rev
com.canonical.certification::snapd/snap-refresh-snapd-snapd-to-stable-rev
com.canonical.certification::snapd/reboot-after-snap-refresh-snapd-snapd-to-stable-rev
com.canonical.certification::snapd/snap-verify-after-refresh-snapd-snapd-to-stable-rev
com.canonical.certification::snapd/snap-revert-snapd-snapd-from-stable-rev
com.canonical.certification::snapd/reboot-after-snap-revert-snapd-snapd-from-stable-rev
com.canonical.certification::snapd/snap-verify-after-revert-snapd-snapd-from-stable-rev
Partial output from the client-cert-iot-server-22-04 test plan
(venv) $ checkbox-cli list-bootstrapped "com.canonical.certification::client-cert-iot-server-22-04" | grep -i ".*snapd/.*-rev"
com.canonical.certification::snapd/snap-refresh-snapd-snapd-to-base-rev
com.canonical.certification::snapd/reboot-after-snap-refresh-snapd-snapd-to-base-rev
com.canonical.certification::snapd/snap-verify-after-refresh-snapd-snapd-to-base-rev
com.canonical.certification::snapd/snap-revert-snapd-snapd-from-base-rev
com.canonical.certification::snapd/reboot-after-snap-revert-snapd-snapd-from-base-rev
com.canonical.certification::snapd/snap-verify-after-revert-snapd-snapd-from-base-rev
com.canonical.certification::snapd/snap-refresh-snapd-snapd-to-stable-rev
com.canonical.certification::snapd/reboot-after-snap-refresh-snapd-snapd-to-stable-rev
com.canonical.certification::snapd/snap-verify-after-refresh-snapd-snapd-to-stable-rev
com.canonical.certification::snapd/snap-revert-snapd-snapd-from-stable-rev
com.canonical.certification::snapd/reboot-after-snap-revert-snapd-snapd-from-stable-rev
com.canonical.certification::snapd/snap-verify-after-revert-snapd-snapd-from-stable-rev

pieqq added 4 commits December 8, 2023 21:42
The snap-refresh-*-from-[stable|base]-rev jobs are executed if the
revision of the related snap (gadget, kernel, snapd) currently installed
on the device is different from the revision in base version and/or
stable channel.

It is better to provide an option to decide whether or not these tests
should be executed, per device.

This is achieved using three manifest entries (one per snap type).

If these entries are explicitely set to True in the manifest, they will
be executed (if they match the condition described above, of course).
Otherwise, they will be skipped.
These jobs and test plans are not specific to Ubuntu Core and can be run
on any device running snapd (classic, server, core and hybrid images).

This commit will:
- Move jobs and test plans from the the base provider's ubuntucore/
section to the snapd/ section
- Adjust their names (rename prefixes from ubuntucore to snapd)
- Adjust their categories (from ubuntucore to snapd)
Doing so ensure the snap refresh/revert tests are executed on every
device running the SRU test plan (mostly classic images) as well as on
devices running IoT-related test plans (mostly Ubuntu core images).
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 8, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8d1f256) 35.70% compared to head (397ba8f) 35.70%.
Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #883   +/-   ##
=======================================
  Coverage   35.70%   35.70%           
=======================================
  Files         303      303           
  Lines       34250    34250           
  Branches     5917     5917           
=======================================
  Hits        12230    12230           
  Misses      21458    21458           
  Partials      562      562           
Flag Coverage Δ
provider-base 5.29% <ø> (ø)
provider-sru 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown

@yphus yphus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work with this new set of jobs.
Manifests will allow fine tuning of the snaps requiring such test coverage.

Copy link
Copy Markdown
Contributor

@patliuu patliuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the whole work on revamping these tests.
Manifest provides flexibility so it won't impact the pre-GM tests. 👍️

@pieqq pieqq merged commit 582d483 into main Dec 14, 2023
@pieqq pieqq deleted the manifest-snap-update-jobs branch December 14, 2023 01:18
binli pushed a commit to binli/checkbox that referenced this pull request Mar 22, 2024
…es to control when to execute them (New) (canonical#883)

Fix CHECKBOX-718

* Add manifest entries to test gadget/kernel/snapd snaps

The snap-refresh-*-from-[stable|base]-rev jobs are executed if the
revision of the related snap (gadget, kernel, snapd) currently installed
on the device is different from the revision in base version and/or
stable channel.

It is better to provide an option to decide whether or not these tests
should be executed, per device.

This is achieved using three manifest entries (one per snap type).

If these entries are explicitely set to True in the manifest, they will
be executed (if they match the condition described above, of course).
Otherwise, they will be skipped.

* Move snap refresh/revert jobs and test plans in the snapd section

These jobs and test plans are not specific to Ubuntu Core and can be run
on any device running snapd (classic, server, core and hybrid images).

This commit will:
- Move jobs and test plans from the the base provider's ubuntucore/
section to the snapd/ section
- Adjust their names (rename prefixes from ubuntucore to snapd)
- Adjust their categories (from ubuntucore to snapd)

* Add snap-refresh-revert nested part to SRU and snappy-snap-automated

Doing so ensure the snap refresh/revert tests are executed on every
device running the SRU test plan (mostly classic images) as well as on
devices running IoT-related test plans (mostly Ubuntu core images).

* Add README.md for the base provider's snapd section

* Move the snap refresh/revert manifest to the snapd section

* Add some explanation in snapd manifest file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants