From 619f672bd3351c5ae7e711b3020920b05eaf17a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Dalleau?= <frederic.dalleau@collabora.com> Date: Mon, 17 Dec 2018 15:56:11 +0000 Subject: [PATCH] Add test for Apertis update manager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a test to exercise the features of the Apertis update manager. These tests only works on OSTree images and check following: - API of update manager with `updatectl` utility - automatic update from mass storage device with static delta - manual upgrade with static delta file - automatic rollback from "failed" update - blacklist feature - rollback feature of U-Boot bootloader Signed-off-by: Frédéric Dalleau <frederic.dalleau@collabora.com> Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com> --- test-cases/apertis-update-manager-api.yaml | 46 ++++++++++++ .../apertis-update-manager-automount.yaml | 29 ++++++++ test-cases/apertis-update-manager-manual.yaml | 31 ++++++++ .../apertis-update-manager-rollback.yaml | 73 +++++++++++++++++++ 4 files changed, 179 insertions(+) create mode 100644 test-cases/apertis-update-manager-api.yaml create mode 100644 test-cases/apertis-update-manager-automount.yaml create mode 100644 test-cases/apertis-update-manager-manual.yaml create mode 100644 test-cases/apertis-update-manager-rollback.yaml diff --git a/test-cases/apertis-update-manager-api.yaml b/test-cases/apertis-update-manager-api.yaml new file mode 100644 index 0000000..230c13c --- /dev/null +++ b/test-cases/apertis-update-manager-api.yaml @@ -0,0 +1,46 @@ +metadata: + name: apertis-update-manager-api + format: "Apertis Test Definition 1.0" + image-type: any + image-arch: armhf + type: functional + exec-type: manual + priority: medium + maintainer: "Apertis Project" + description: "Test the apertis-update-manager automatic update." + + resources: + - "A Fat32 USB flash drive, preloaded with an update bundle named static-update.bundle at the root of the disk" + - "The DUT u-boot environment must be clean: in u-boot, run: `env default -a` followed by `saveenv`" + - "A PC must be connected to DUT serial port" + + expected: + - "CLI utility `updatectl` is able to interact with Apertis update manager" + - "The update was properly applied" + +run: + steps: + - "Check the current deployment" + - $ sudo ostree admin status + - "Start the user interface agent with mode preventing automatic system reboot after update" + - $ sudo updatectl --register-upgrade-handler & + - "Plug the USB flash drive into the device" + - "The update starts automatically" + - "After the update, the device does *not* reboot automatically" + - "Check that the user interface agent reports the pending update" + - | + >** Message: Upgrade status: Checking + ** Message: An upgrade is pending + - "Remove the USB flash drive" + - "Check if there is pending deployment and reboot the DUT" + - $ sudo ostree admin status + - $ sudo reboot + - "Check the current deployment has been updated and that the rollback entry points to the initial deployment" + - $ sudo ostree admin status + - "Start the user interface agent" + - $ sudo updatectl & + - "Plug the USB flash drive with the same update file into the device" + - "Check that the user interface agent reports the system is up to update" + - | + >** Message: Upgrade status: Checking + ** Message: System is up to date diff --git a/test-cases/apertis-update-manager-automount.yaml b/test-cases/apertis-update-manager-automount.yaml new file mode 100644 index 0000000..14cbff9 --- /dev/null +++ b/test-cases/apertis-update-manager-automount.yaml @@ -0,0 +1,29 @@ +metadata: + name: apertis-update-manager-auto + format: "Apertis Test Definition 1.0" + image-type: any + image-arch: armhf + type: functional + exec-type: manual + priority: medium + maintainer: "Apertis Project" + description: "Test the apertis-update-manager automatic update via mass storage device." + + resources: + - "A Fat32 USB flash drive, preloaded with an update bundle named static-update.bundle at the root of the disk" + - "The DUT u-boot environment must be clean: in u-boot, run: `env default -a` followed by `saveenv`" + - "A PC must be connected to DUT serial port" + + expected: + - "The update was properly applied" + +run: + steps: + - "Check the current deployment" + - $ sudo ostree admin status + - "Plug the USB flash drive in the device" + - "The update starts automatically" + - "After the update, the device will reboot automatically" + - "Remove the USB flash drive immediatly after reboot" + - "Check the current deployment has been updated and that the rollback entry points to the initial deployment" + - $ sudo ostree admin status diff --git a/test-cases/apertis-update-manager-manual.yaml b/test-cases/apertis-update-manager-manual.yaml new file mode 100644 index 0000000..262c2b8 --- /dev/null +++ b/test-cases/apertis-update-manager-manual.yaml @@ -0,0 +1,31 @@ +metadata: + name: apertis-update-manager + format: "Apertis Test Definition 1.0" + image-type: any + image-arch: armhf + type: functional + exec-type: manual + priority: medium + maintainer: "Apertis Project" + description: "Test the manual update with apertis-update-manager." + + resources: + - "A PC must be connected to DUT serial port" + + expected: + - "The update was properly applied" + +run: + steps: + - "Check the current deployment" + - $ sudo ostree admin status + - "Remove blacklist file if it exists" + - $ sudo rm -f /var/aum_blacklist.conf + - "Download a static delta update and copy it to the target using scp" + - $ scp /path/to/static/delta user@target:update.bundle + - "The update does not start automatically, start it manually" + - $ sudo updatectl --apply-static-delta /home/user/update.bundle + - "After the update, the device will reboot automatically" + - "Check the current deployment has been updated and that the rollback entry points to the initial deployment" + - $ sudo ostree admin status + diff --git a/test-cases/apertis-update-manager-rollback.yaml b/test-cases/apertis-update-manager-rollback.yaml new file mode 100644 index 0000000..f7b7a40 --- /dev/null +++ b/test-cases/apertis-update-manager-rollback.yaml @@ -0,0 +1,73 @@ +metadata: + name: apertis-update-manager-rollback + format: "Apertis Test Definition 1.0" + image-type: any + image-arch: armhf + type: functional + exec-type: manual + priority: medium + maintainer: "Apertis Project" + description: "Test the automatic rollback and blacklist mechanism of apertis-update-manager." + + resources: + - "A Fat32 USB flash drive, preloaded with an update bundle named static-update.bundle at the root of the disk" + - "The DUT u-boot environment must be clean: in u-boot, run: `env default -a` followed by `saveenv`" + - "A PC must be connected to DUT serial port" + + expected: + - "U-Boot is able to detect rollback situation" + - "U-Boot is able to use rollback configuration for bootloader" + - 'The "failed" update is rolled back' + - '"Failed" update is marked as blacklisted' + - 'Apertis-update-manager is able to detect blacklisted update and refuse to update the system with it' + +run: + steps: + - "Check the current deployment" + - $ sudo ostree admin status + - "Start the user interface agent with mode preventing automatic system reboot after update" + - $ sudo updatectl --register-upgrade-handler & + - "Plug the USB flash drive into the device" + - "The update starts automatically" + - "After the update, the device does *not* reboot automatically" + - "Check that the user interface agent reports the pending update" + - | + >** Message: Upgrade status: Checking + ** Message: An upgrade is pending + - "Remove the USB flash drive" + - "Check if there is pending deployment and reboot the DUT" + - $ sudo ostree admin status + - $ sudo reboot + - "In `U-Boot` console check the status of upgrade" + - $ printenv bootcount bootlimit upgrade_available + - | + >bootcount=1 + bootlimit=3 + upgrade_available=1 + - "Reset the DUT 3 times before the boot finishes" + - "U-Boot should be able to detect the rollback mode and boot the system in rollback mode" + - | + >Warning: Bootlimit (3) exceeded. Using altbootcmd. + Hit any key to stop autoboot: 0 + switch to partitions #0, OK + mmc0 is current device + Scanning mmc 0:1... + Found /extlinux/extlinux-rollback.conf + Retrieving file: /extlinux/extlinux-rollback.conf + - "Wait for system boot" + - "Check the update has been rolled back and that the initial deployment is still the active deployment" + - $ sudo ostree admin status + - "Start the user interface agent" + - $ sudo updatectl & + - "Plug the USB flash drive with the same update file into the device" + - "Check that the user interface agent reports the system is up to update" + - | + >** Message: Upgrade status: Checking + ** Message: System is up to date + - "Check the journal log should mention that the update ID has been blacklisted" + - $ sudo journalctl -ef --unit apertis-update-manager + - | + >Dec 19 20:54:34 apertis apertis-update-[330]: Ostree static delta starting + Dec 19 20:54:34 apertis apertis-update-[330]: Revision '9804c4f6e952f0ba61659f55262b9cdd8879cb480084e7f24d9167c2b35f7f28' is marked as blacklisted; skipping + Dec 19 20:54:34 apertis apertis-update-[330]: Ostree already up to date + -- GitLab