Skip to content
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

Make sure the device reboots after snap refresh/revert tests (BugFix) #1124

Merged
merged 10 commits into from
Apr 11, 2024

Conversation

pieqq
Copy link
Collaborator

@pieqq pieqq commented Mar 29, 2024

Description

The snap_update_test.py script is currently running asynchronous snapd requests and simply waiting 90 seconds before rebooting the device, without checking the status of the snapd command. This leads to very flaky results.

This PR updates the script (and parts of checkbox_support.snapd_utils.snapd) to

  • wait for the snapd request to finish
  • poll the snapd change to provide more information to the tester
  • keep all of this information in a log that is then attached to the session (because Checkbox currently does not keep output for noreturn jobs)
  • initiate a reboot after each snap refresh/revert command instead of in a separate job. This is to avoid a situation we have seen in production where non-related jobs would be run between the refresh/revert job and the reboot job, making the results for these jobs unreliable

Resolved issues

CHECKBOX-1264

Documentation

Changes are meticulously documented in the git commits. Please read them for more information.

Tests

  • Unit tests
  • Tested on the Xinyi device by running the snap-refresh-revert test plan on it after making sure the snapd, gadget and pc kernels were all using their respective beta channels. Submission available here. The skipped tests are because the targeted revision is the same as the currently installed revision, which is expected for the gadget snap as the base version, stable version and beta version are all the same revision. Please note that the submission archive has an attachment_files directory containing the output of the noreturn jobs, such as:
[content of /attachment_files/com.canonical.certification__snapd_log-attach-after-snap-refresh-snapd-snapd-to-base-rev]

Refreshing snap snapd from revision 21465 to 19267
(info) (Doing) Ensure prerequisites for "snapd" are available
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Fetch and check assertions for snap "snapd" (19267)
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Setup snap "snapd" (19267) security profiles
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Setup snap "snapd" (19267) security profiles
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Setup snap "snapd" (19267) security profiles
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
Snap operation finished. See `snap change 358` for more info
Waiting for reboot...

Copy link

codecov bot commented Mar 29, 2024

Codecov Report

Attention: Patch coverage is 98.21429% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 43.14%. Comparing base (f35524b) to head (3bf8bfc).

Files Patch % Lines
...ckbox-support/checkbox_support/snap_utils/snapd.py 96.55% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1124      +/-   ##
==========================================
+ Coverage   43.04%   43.14%   +0.10%     
==========================================
  Files         355      355              
  Lines       38610    38624      +14     
  Branches     6556     6559       +3     
==========================================
+ Hits        16619    16665      +46     
+ Misses      21327    21294      -33     
- Partials      664      665       +1     
Flag Coverage Δ
checkbox-support 52.14% <96.55%> (+0.71%) ⬆️
provider-base 16.11% <100.00%> (+0.02%) ⬆️

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.

@pieqq pieqq force-pushed the 1264-reboot-after-snap-update branch from de5e756 to 1bffbeb Compare March 29, 2024 05:49
Hook25
Hook25 previously approved these changes Apr 3, 2024
Copy link
Collaborator

@Hook25 Hook25 left a comment

Choose a reason for hiding this comment

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

Mostly like what I see here, especially the prints instead of logging, makes way more sense for us else we always need to re-run the job to see what is wrong with it.

Consider taking a look at my comment, I'm a bit confused by that poll function.

pieqq added 10 commits April 11, 2024 08:48
In order to get more data in the job logs, Snapd._poll_change() is
amended to do the following:

- Outuput info about the task when it's in the "Wait" status (and
return, as it likely means the snap is waiting for a reboot)
- Outuput info about the task when it's in the "Error" status
- If an ongoing task (status = "Doing") has a progress label assigned,
print the current progress in % (similar to what's done in the snap
command itself). This is useful to investigate if tasks like snap
downloads have frozen at some point.

Unit tests for the _poll_change() method are also added.
In order to be more consistent with other methods, these methods now
return the response.

Unit tests are added for these methods as well.
Script can now be called with the --timeout argument (defaulting to 300
seconds).

This is passed to the Snapd() instance, along with the verbosity flag
that enables Snapd._info() to output useful information for the job
logs.
Print statements make more sense because any information captured during
the snap commands should be made available to the Checkbox results later
on.
- Reboot commands are moved inside the snapd/snap-[refresh|revert]-*
jobs. This is to make sure the device is rebooted right after the
command is issued (with previous version, some other jobs might be run
between the refresh/revert command and the reboot command, making the
test results unreliable)
- As a result, the snapd/snap-[refresh|revert]-* are flagged as noreturn
- Because Checkbox does not capture the outputs of noreturn jobs, their
outputs are stored in the $PLAINBOX_SESSION_SHARE directory using `tee`
- Reboot jobs are replaced with attachment jobs to upload the outputs
along with the submissions
Following the work done in commit
b8befd8, add template-id to the new
templates that don't have them set yet.
@pieqq pieqq force-pushed the 1264-reboot-after-snap-update branch from c398574 to 3bf8bfc Compare April 11, 2024 00:48
@pieqq
Copy link
Collaborator Author

pieqq commented Apr 11, 2024

I've built a snap with the latest version from this branch, and ran it on the Xinyi device:

https://certification.canonical.com/hardware/202207-30448/submission/363697/

The outcome looks as expected:

  • gadget snap is the same revision for all base/stable/beta, so all of the jobs are skipped
  • pc-kernel snap has the same revision for stable and beta, so refreshing/reverting to/from stable is skipped
  • the logs attached in the submission look OK, and correspond to the outcome I've seen while running Checkbox remote:
======[ Bootstrap com.canonical.certification::snap_revision_info (1/1) ]=======
-----------------------------[ Running job 1 / 25 ]-----------------------------
-----------------------------[ Hardware Manifest ]------------------------------
ID: com.canonical.plainbox::manifest
Category: Informational tests
--------------------------------------------------------------------------------
$PROVIDERPATH is defined, so following provider sources are ignored ['/home/ubuntu/.local/share/plainbox-providers-1', '/var/tmp/checkbox-providers-develop'] 
Skipped file: /snap/checkbox22/current/providers/checkbox-provider-base/units/stress/suspend_cycles_reboot.md
ns: com.canonical.certification
name: checkbox-provider-base
has_audio_playback: True
has_audio_capture: True
has_audio_loopback_connector: 
has_bt_adapter: 
has_bt_smart: 
has_rpi_camera: 
has_camera: False
has_md_raid: 
has_eeprom: 
has_ethernet_adapter: True
has_fingerprint_reader: 
gpio_loopback: 
has_hdmi: None
has_dp: 
has_vga: 
has_dvi: 
has_i2c: 
has_ishtp: 
has_eclite: 
has_special_keys: 
has_led_indicator: 
has_card_reader: 
has_mei: 
has_muxpi_hdmi: 
has_qep: 
need_kernel_snap_update_test: True
need_snapd_snap_update_test: True
need_gadget_snap_update_test: True
socket_can_echo_server_running: 
has_thunderbolt: 
has_thunderbolt3: False
has_touchpad: None
has_touchscreen: 
has_tpm_chip: 
has_usbc_data: 
has_usbc_video: 
has_usb_storage: True
has_usbc_otg: 
has_va_api: 
has_hardware_watchdog: 
has_wlan_adapter: True
has_wwan_module: 

ns: com.canonical.certification
name: checkbox-provider-certification-client

ns: com.canonical.certification
name: checkbox-provider-certification-server

ns: com.canonical.certification
name: plainbox-provider-docker

ns: com.canonical.certification
name: checkbox-provider-gpgpu

ns: com.canonical.certification
name: com.canonical.certification:checkbox-provider-iiotg
has_edac_module: 
has_usb_dwc3_controller: 

ns: com.canonical.certification
name: checkbox-provider-resource

ns: com.canonical.certification
name: checkbox-provider-sru

ns: com.canonical.certification
name: checkbox-provider-tpm2
has_tpm2_chip: True

ns: com.canonical.certification
name: tutorial

--------------------------------------------------------------------------------
Outcome: job passed
-----------------------------[ Running job 2 / 25 ]-----------------------------
-------------[ Refresh xinyi-pc-classic snap to its base revision ]-------------
ID: com.canonical.certification::snapd/snap-refresh-gadget-xinyi-pc-classic-to-base-rev
Category: Snapd
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Outcome: job cannot be started
-----------------------------[ Running job 3 / 25 ]-----------------------------
----[ Attach logs after refreshing xinyi-pc-classic snap to base revision ]-----
ID: com.canonical.certification::snapd/log-attach-after-snap-refresh-gadget-xinyi-pc-classic-to-base-rev
Category: Snapd
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Outcome: job passed
-----------------------------[ Running job 4 / 25 ]-----------------------------
--[ Verify xinyi-pc-classic snap revision after refreshing to base revision ]---
ID: com.canonical.certification::snapd/snap-verify-after-refresh-gadget-xinyi-pc-classic-to-base-rev
Category: Snapd
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Outcome: job cannot be started
-----------------------------[ Running job 5 / 25 ]-----------------------------
----[ Revert xinyi-pc-classic snap from base revision to original revision ]----
ID: com.canonical.certification::snapd/snap-revert-gadget-xinyi-pc-classic-from-base-rev
Category: Snapd
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Outcome: job cannot be started
-----------------------------[ Running job 6 / 25 ]-----------------------------
-----[ Attach logs after reverting xinyi-pc-classic snap to base revision ]-----
ID: com.canonical.certification::snapd/log-attach-after-snap-revert-gadget-xinyi-pc-classic-from-base-rev
Category: Snapd
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Outcome: job passed
-----------------------------[ Running job 7 / 25 ]-----------------------------
--[ Verify xinyi-pc-classic snap revision after reverting from base revision ]--
ID: com.canonical.certification::snapd/snap-verify-after-revert-gadget-xinyi-pc-classic-from-base-rev
Category: Snapd
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Outcome: job cannot be started
-----------------------------[ Running job 8 / 25 ]-----------------------------
-----[ Refresh xinyi-pc-classic snap to latest revision in stable channel ]-----
ID: com.canonical.certification::snapd/snap-refresh-gadget-xinyi-pc-classic-to-stable-rev
Category: Snapd
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Outcome: job cannot be started
-----------------------------[ Running job 9 / 25 ]-----------------------------
[ Attach logs after refreshing xinyi-pc-classic snap to latest revision in stable channel ]
ID: com.canonical.certification::snapd/log-attach-after-snap-refresh-gadget-xinyi-pc-classic-to-stable-rev
Category: Snapd
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Outcome: job passed
----------------------------[ Running job 10 / 25 ]-----------------------------
------------------[ Refresh snapd snap to its base revision ]-------------------
ID: com.canonical.certification::snapd/snap-refresh-snapd-snapd-to-base-rev
Category: Snapd
--------------------------------------------------------------------------------
Refreshing snap snapd from revision 21465 to 19267
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Fetch and check assertions for snap "snapd" (19267)
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Mount snap "snapd" (19267)
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Setup snap "snapd" (19267) security profiles
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Setup snap "snapd" (19267) security profiles
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
Snap operation finished. See `snap change 386` for more info
Waiting for reboot...
Connection lost!
[Errno 104] Connection reset by peer
Reconnecting ...
Reconnected (took: 47s)
----------------------------[ Running job 12 / 26 ]-----------------------------
----------[ Attach logs after refreshing snapd snap to base revision ]----------
ID: com.canonical.certification::snapd/log-attach-after-snap-refresh-snapd-snapd-to-base-rev
Category: Snapd
--------------------------------------------------------------------------------
Refreshing snap snapd from revision 21465 to 19267
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Fetch and check assertions for snap "snapd" (19267)
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Mount snap "snapd" (19267)
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Setup snap "snapd" (19267) security profiles
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Setup snap "snapd" (19267) security profiles
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
Snap operation finished. See `snap change 386` for more info
Waiting for reboot...
--------------------------------------------------------------------------------
Outcome: job passed
----------------------------[ Running job 13 / 26 ]-----------------------------
--------[ Verify snapd snap revision after refreshing to base revision ]--------
ID: com.canonical.certification::snapd/snap-verify-after-refresh-snapd-snapd-to-base-rev
Category: Snapd
--------------------------------------------------------------------------------
Beginning verify...
snapd snap refresh complete
Checking refresh status for snap snapd...
PASS: current revision (19267) matches the expected revision
--------------------------------------------------------------------------------
Outcome: job passed
----------------------------[ Running job 14 / 26 ]-----------------------------
---------[ Revert snapd snap from base revision to original revision ]----------
ID: com.canonical.certification::snapd/snap-revert-snapd-snapd-from-base-rev
Category: Snapd
--------------------------------------------------------------------------------
Reverting snap snapd from revision 19267 to 21465
(info) (Doing) Setup snap "snapd" (21465) security profiles
(info) (Doing) Setup snap "snapd" (21465) security profiles
(info) (Doing) Setup snap "snapd" (21465) security profiles
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
Snap operation finished. See `snap change 387` for more info
Waiting for reboot...
Connection lost!
connection closed by peer
Reconnecting ...
Reconnected (took: 51s)
----------------------------[ Running job 15 / 26 ]-----------------------------
----------[ Attach logs after reverting snapd snap to base revision ]-----------
ID: com.canonical.certification::snapd/log-attach-after-snap-revert-snapd-snapd-from-base-rev
Category: Snapd
--------------------------------------------------------------------------------
Reverting snap snapd from revision 19267 to 21465
(info) (Doing) Setup snap "snapd" (21465) security profiles
(info) (Doing) Setup snap "snapd" (21465) security profiles
(info) (Doing) Setup snap "snapd" (21465) security profiles
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
Snap operation finished. See `snap change 387` for more info
Waiting for reboot...
--------------------------------------------------------------------------------
Outcome: job passed
----------------------------[ Running job 16 / 26 ]-----------------------------
-------[ Verify snapd snap revision after reverting from base revision ]--------
ID: com.canonical.certification::snapd/snap-verify-after-revert-snapd-snapd-from-base-rev
Category: Snapd
--------------------------------------------------------------------------------
Beginning verify...
snapd snap revert complete
Checking revert status for snap snapd...
PASS: current revision (21465) matches the expected revision
--------------------------------------------------------------------------------
Outcome: job passed
----------------------------[ Running job 17 / 26 ]-----------------------------
----------[ Refresh snapd snap to latest revision in stable channel ]-----------
ID: com.canonical.certification::snapd/snap-refresh-snapd-snapd-to-stable-rev
Category: Snapd
--------------------------------------------------------------------------------
Refreshing snap snapd from revision 21465 to 21184
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Fetch and check assertions for snap "snapd" (21184)
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Setup snap "snapd" (21184) security profiles
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Setup snap "snapd" (21184) security profiles
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Setup snap "snapd" (21184) security profiles
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
Connection lost!
connection closed by peer
Reconnecting ...
Reconnected (took: 51s)
----------------------------[ Running job 18 / 26 ]-----------------------------
[ Attach logs after refreshing snapd snap to latest revision in stable channel ]
ID: com.canonical.certification::snapd/log-attach-after-snap-refresh-snapd-snapd-to-stable-rev
Category: Snapd
--------------------------------------------------------------------------------
Refreshing snap snapd from revision 21465 to 21184
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Fetch and check assertions for snap "snapd" (21184)
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Setup snap "snapd" (21184) security profiles
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Setup snap "snapd" (21184) security profiles
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Setup snap "snapd" (21184) security profiles
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Automatically connect eligible plugs and slots of snap "snapd"
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
(info) (Doing) Monitoring snap "snapd" to determine whether extra refresh steps are required
Snap operation finished. See `snap change 388` for more info
Waiting for reboot...
--------------------------------------------------------------------------------
Outcome: job passed
----------------------------[ Running job 19 / 26 ]-----------------------------
----------------[ Refresh pc-kernel snap to its base revision ]-----------------
ID: com.canonical.certification::snapd/snap-refresh-kernel-pc-kernel-to-base-rev
Category: Snapd
--------------------------------------------------------------------------------
Refreshing snap pc-kernel from revision 1731 to 1289
(info) (Doing) Monitoring snap "pc-kernel" to determine whether extra refresh steps are required
(info) (Doing) Fetch and check assertions for snap "pc-kernel" (1289)
(info) (Doing) Monitoring snap "pc-kernel" to determine whether extra refresh steps are required
(info) (Doing) Mount snap "pc-kernel" (1289)
(info) (Doing) Monitoring snap "pc-kernel" to determine whether extra refresh steps are required
(info) (Doing) Copy snap "pc-kernel" data
(info) (Doing) Monitoring snap "pc-kernel" to determine whether extra refresh steps are required
Connection lost!
connection closed by peer
Reconnecting ...
Reconnected (took: 58s)
----------------------------[ Running job 20 / 26 ]-----------------------------
--------[ Attach logs after refreshing pc-kernel snap to base revision ]--------
ID: com.canonical.certification::snapd/log-attach-after-snap-refresh-kernel-pc-kernel-to-base-rev
Category: Snapd
--------------------------------------------------------------------------------
Refreshing snap pc-kernel from revision 1731 to 1289
(info) (Doing) Monitoring snap "pc-kernel" to determine whether extra refresh steps are required
(info) (Doing) Fetch and check assertions for snap "pc-kernel" (1289)
(info) (Doing) Monitoring snap "pc-kernel" to determine whether extra refresh steps are required
(info) (Doing) Mount snap "pc-kernel" (1289)
(info) (Doing) Monitoring snap "pc-kernel" to determine whether extra refresh steps are required
(info) (Doing) Copy snap "pc-kernel" data
(info) (Doing) Monitoring snap "pc-kernel" to determine whether extra refresh steps are required
(info) (Wait) Make snap "pc-kernel" (1289) available to the system
Snap operation finished. See `snap change 389` for more info
Waiting for reboot...
--------------------------------------------------------------------------------
Outcome: job passed
----------------------------[ Running job 21 / 26 ]-----------------------------
------[ Verify pc-kernel snap revision after refreshing to base revision ]------
ID: com.canonical.certification::snapd/snap-verify-after-refresh-kernel-pc-kernel-to-base-rev
Category: Snapd
--------------------------------------------------------------------------------
Beginning verify...
pc-kernel snap refresh complete
Checking refresh status for snap pc-kernel...
PASS: current revision (1289) matches the expected revision
--------------------------------------------------------------------------------
Outcome: job passed
----------------------------[ Running job 22 / 26 ]-----------------------------
-------[ Revert pc-kernel snap from base revision to original revision ]--------
ID: com.canonical.certification::snapd/snap-revert-kernel-pc-kernel-from-base-rev
Category: Snapd
--------------------------------------------------------------------------------
Reverting snap pc-kernel from revision 1289 to 1731
(info) (Doing) Ensure prerequisites for "pc-kernel" are available
(info) (Wait) Make snap "pc-kernel" (1731) available to the system
Snap operation finished. See `snap change 390` for more info
Waiting for reboot...
Connection lost!
connection closed by peer
Reconnecting ...
Reconnected (took: 55s)
----------------------------[ Running job 23 / 26 ]-----------------------------
--------[ Attach logs after reverting pc-kernel snap to base revision ]---------
ID: com.canonical.certification::snapd/log-attach-after-snap-revert-kernel-pc-kernel-from-base-rev
Category: Snapd
--------------------------------------------------------------------------------
Reverting snap pc-kernel from revision 1289 to 1731
(info) (Doing) Ensure prerequisites for "pc-kernel" are available
(info) (Wait) Make snap "pc-kernel" (1731) available to the system
Snap operation finished. See `snap change 390` for more info
Waiting for reboot...
--------------------------------------------------------------------------------
Outcome: job passed
----------------------------[ Running job 24 / 26 ]-----------------------------
-----[ Verify pc-kernel snap revision after reverting from base revision ]------
ID: com.canonical.certification::snapd/snap-verify-after-revert-kernel-pc-kernel-from-base-rev
Category: Snapd
--------------------------------------------------------------------------------
Beginning verify...
pc-kernel snap revert complete
Checking revert status for snap pc-kernel...
PASS: current revision (1731) matches the expected revision
--------------------------------------------------------------------------------
Outcome: job passed
----------------------------[ Running job 25 / 26 ]-----------------------------
--------[ Refresh pc-kernel snap to latest revision in stable channel ]---------
ID: com.canonical.certification::snapd/snap-refresh-kernel-pc-kernel-to-stable-rev
Category: Snapd
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Outcome: job cannot be started
----------------------------[ Running job 26 / 26 ]-----------------------------
[ Attach logs after refreshing pc-kernel snap to latest revision in stable channel ]
ID: com.canonical.certification::snapd/log-attach-after-snap-refresh-kernel-pc-kernel-to-stable-rev
Category: Snapd
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Outcome: job passed
==================================[ Results ]===================================
32.0kB [00:00, 478kB/s, file=python://stdout]                                                                                                                                          
  job passed   : Gather name, tracking, and revision info of the kernel, snapd and gadget snaps
  job passed   : Hardware Manifest
job cannot be started: Refresh xinyi-pc-classic snap to its base revision
  job passed   : Attach logs after refreshing xinyi-pc-classic snap to base revision
job cannot be started: Verify xinyi-pc-classic snap revision after refreshing to base revision
job cannot be started: Revert xinyi-pc-classic snap from base revision to original revision
  job passed   : Attach logs after reverting xinyi-pc-classic snap to base revision
job cannot be started: Verify xinyi-pc-classic snap revision after reverting from base revision
job cannot be started: Refresh xinyi-pc-classic snap to latest revision in stable channel
  job passed   : Attach logs after refreshing xinyi-pc-classic snap to latest revision in stable channel
  job passed   : Refresh snapd snap to its base revision
  job passed   : Attach logs after refreshing snapd snap to base revision
  job passed   : Verify snapd snap revision after refreshing to base revision
  job passed   : Revert snapd snap from base revision to original revision
  job passed   : Attach logs after reverting snapd snap to base revision
  job passed   : Verify snapd snap revision after reverting from base revision
  job passed   : Refresh snapd snap to latest revision in stable channel
  job passed   : Attach logs after refreshing snapd snap to latest revision in stable channel
  job passed   : Refresh pc-kernel snap to its base revision
  job passed   : Attach logs after refreshing pc-kernel snap to base revision
  job passed   : Verify pc-kernel snap revision after refreshing to base revision
  job passed   : Revert pc-kernel snap from base revision to original revision
  job passed   : Attach logs after reverting pc-kernel snap to base revision
  job passed   : Verify pc-kernel snap revision after reverting from base revision
job cannot be started: Refresh pc-kernel snap to latest revision in stable channel
  job passed   : Attach logs after refreshing pc-kernel snap to latest revision in stable channel

Copy link
Collaborator

@Hook25 Hook25 left a comment

Choose a reason for hiding this comment

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

ty for the extra "snapped" validation! +1

@Hook25 Hook25 merged commit 961183e into main Apr 11, 2024
17 checks passed
@Hook25 Hook25 deleted the 1264-reboot-after-snap-update branch April 11, 2024 06:57
pieqq added a commit that referenced this pull request Apr 11, 2024
…est plan

The snap-refresh-revert nested part had been removed from the SRU test
plan in cd17d9a following some
discoveries that, when executed, the jobs executed would change the
system state in the wrong order (e.g. updating the kernel snap without
reverting it while running other jobs afterwards).

The jobs were modified to prevent this kind of scenario[1], and the use
of manifest entries[2] prevents the jobs from being run on all the
devices yet (currently, the only project that enables them is the Xinyi
project).

Fix LM-1522

[1] #1124
[2]
https://github.com/canonical/checkbox/tree/main/providers/base/units/snapd#manifest-entries
pieqq added a commit that referenced this pull request Apr 11, 2024
…est plan (BugFix) (#1176)

Bring back kernel/snapd/gadget snaps revert/refresh jobs to the SRU test plan

The snap-refresh-revert nested part had been removed from the SRU test
plan in cd17d9a following some
discoveries that, when executed, the jobs executed would change the
system state in the wrong order (e.g. updating the kernel snap without
reverting it while running other jobs afterwards).

The jobs were modified to prevent this kind of scenario[1], and the use
of manifest entries[2] prevents the jobs from being run on all the
devices yet (currently, the only project that enables them is the Xinyi
project).

Fix LM-1522

[1] #1124
[2]
https://github.com/canonical/checkbox/tree/main/providers/base/units/snapd#manifest-entries
LiaoU3 pushed a commit to LiaoU3/checkbox that referenced this pull request Apr 17, 2024
…canonical#1124)

* Provide more information in Snapd._poll_change()

In order to get more data in the job logs, Snapd._poll_change() is
amended to do the following:

- Outuput info about the task when it's in the "Wait" status (and
return, as it likely means the snap is waiting for a reboot)
- Outuput info about the task when it's in the "Error" status
- If an ongoing task (status = "Doing") has a progress label assigned,
print the current progress in % (similar to what's done in the snap
command itself). This is useful to investigate if tasks like snap
downloads have frozen at some point.

Unit tests for the _poll_change() method are also added.

* Return the response when calling Snapd.install() and remove()

In order to be more consistent with other methods, these methods now
return the response.

Unit tests are added for these methods as well.

* Add timeout argument to snap_update_test.py and output more info

Script can now be called with the --timeout argument (defaulting to 300
seconds).

This is passed to the Snapd() instance, along with the verbosity flag
that enables Snapd._info() to output useful information for the job
logs.

* Replace logging with print statements in snap_update_test.py

Print statements make more sense because any information captured during
the snap commands should be made available to the Checkbox results later
on.

* Modify snap-refresh-revert jobs

- Reboot commands are moved inside the snapd/snap-[refresh|revert]-*
jobs. This is to make sure the device is rebooted right after the
command is issued (with previous version, some other jobs might be run
between the refresh/revert command and the reboot command, making the
test results unreliable)
- As a result, the snapd/snap-[refresh|revert]-* are flagged as noreturn
- Because Checkbox does not capture the outputs of noreturn jobs, their
outputs are stored in the $PLAINBOX_SESSION_SHARE directory using `tee`
- Reboot jobs are replaced with attachment jobs to upload the outputs
along with the submissions

* Replace reboot jobs with log attachment jobs in snap-refresh-revert test plan

Fix CHECKBOX-1264

* Fix snapd unit tests

* Add unit test to improve coverage

* Fix unit test

* Add template-id to log-attach jobs

Following the work done in commit
b8befd8, add template-id to the new
templates that don't have them set yet.
LiaoU3 pushed a commit to LiaoU3/checkbox that referenced this pull request Apr 17, 2024
…est plan (BugFix) (canonical#1176)

Bring back kernel/snapd/gadget snaps revert/refresh jobs to the SRU test plan

The snap-refresh-revert nested part had been removed from the SRU test
plan in cd17d9a following some
discoveries that, when executed, the jobs executed would change the
system state in the wrong order (e.g. updating the kernel snap without
reverting it while running other jobs afterwards).

The jobs were modified to prevent this kind of scenario[1], and the use
of manifest entries[2] prevents the jobs from being run on all the
devices yet (currently, the only project that enables them is the Xinyi
project).

Fix LM-1522

[1] canonical#1124
[2]
https://github.com/canonical/checkbox/tree/main/providers/base/units/snapd#manifest-entries
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.

None yet

2 participants