Merge ~alfonsosanchezbeato/snappy-hwe-snaps/+git/bluez:tests-on-uc20 into ~snappy-hwe-team/snappy-hwe-snaps/+git/bluez:snap-20

Proposed by Alfonso Sanchez-Beato
Status: Merged
Approved by: Alfonso Sanchez-Beato
Approved revision: 93677f5ccc0f0441e950457f5bb6f9f6c77e8087
Merged at revision: 9080953f8db96ae7b929073b8c96e03fb1ee4d89
Proposed branch: ~alfonsosanchezbeato/snappy-hwe-snaps/+git/bluez:tests-on-uc20
Merge into: ~snappy-hwe-team/snappy-hwe-snaps/+git/bluez:snap-20
Diff against target: 194 lines (+28/-75)
5 files modified
spread.yaml (+4/-2)
tests/lib/prepare-all.sh (+3/-41)
tests/lib/prepare.sh (+8/-13)
tests/lib/restore-each.sh (+4/-9)
tests/lib/utilities.sh (+9/-10)
Reviewer Review Type Date Requested Status
System Enablement Bot continuous-integration Approve
Review via email: mp+387359@code.launchpad.net

Commit message

tests: run tests now on UC20 image

Description of the change

tests: run tests now on UC20 image

To post a comment you must log in.
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :

PASSED: Successfully build documentation, rev: 93677f5ccc0f0441e950457f5bb6f9f6c77e8087

Generated documentation is available at https://jenkins.canonical.com/system-enablement/job/snappy-hwe-snaps-snap-docs/1343/

Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/spread.yaml b/spread.yaml
2index 0f2b314..ee293b4 100644
3--- a/spread.yaml
4+++ b/spread.yaml
5@@ -26,8 +26,10 @@ environment:
6
7 backends:
8 qemu:
9+ memory: 4G
10 systems:
11- - ubuntu-core-16:
12+ - ubuntu-core-20:
13+ bios: /usr/share/OVMF/OVMF_CODE.fd
14 username: test
15 password: test
16
17@@ -44,7 +46,7 @@ suites:
18 tests/main/:
19 summary: Full-system tests for BlueZ
20 systems:
21- - ubuntu-core-16
22+ - ubuntu-core-20
23 prepare: |
24 . $TESTSLIB/prepare.sh
25 restore-each: |
26diff --git a/tests/lib/prepare-all.sh b/tests/lib/prepare-all.sh
27index 979e57d..08ae20a 100644
28--- a/tests/lib/prepare-all.sh
29+++ b/tests/lib/prepare-all.sh
30@@ -1,42 +1,4 @@
31-#!/bin/sh
32+#!/bin/bash -x
33
34-# We don't have to build a snap when we should use one from a channel
35-if [ -n "$SNAP_CHANNEL" ] ; then
36- exit 0
37-fi
38-
39-# If there is a snap prebuilt for us, lets take that one to speed things up
40-if [ -e $PROJECT_PATH/${SNAP_NAME}_*_${SNAP_ARCH}.snap ] ; then
41- exit 0
42-fi
43-
44-
45-# Setup classic snap and build the snap in there
46-snap install --devmode --beta classic
47-cat <<-EOF > /home/test/build-snap.sh
48-#!/bin/sh
49-set -ex
50-
51-export DEBIAN_FRONTEND=noninteractive
52-
53-# FIXME: Enable propose for now until problems with conflicting systemd
54-# packages between the Ubuntu Core image ppa and the archive are fixed.
55-echo "deb http://archive.ubuntu.com/ubuntu/ xenial-proposed restricted main universe" > /etc/apt/sources.list.d/ubuntu-proposed.list
56-echo "deb http://ppa.launchpad.net/snappy-dev/image/ubuntu xenial main" > /etc/apt/sources.list.d/ubuntu-image-ppa.list
57-
58-# Ensure we have the latest updates installed as the core snap
59-# may be a bit out of date.
60-apt update
61-apt -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' full-upgrade -y --force-yes
62-
63-apt install -y --force-yes snapcraft
64-cd $PROJECT_PATH
65-snapcraft clean
66-snapcraft
67-EOF
68-chmod +x /home/test/build-snap.sh
69-sudo classic /home/test/build-snap.sh
70-snap remove classic
71-
72-# Make sure we have a snap build
73-test -e $PROJECT_PATH/${SNAP_NAME}_*_${SNAP_ARCH}.snap
74+# Nothing to do here for the moment
75+exit 0
76diff --git a/tests/lib/prepare.sh b/tests/lib/prepare.sh
77index 185bacb..cdf9213 100644
78--- a/tests/lib/prepare.sh
79+++ b/tests/lib/prepare.sh
80@@ -1,6 +1,7 @@
81-#!/bin/sh
82+#!/bin/bash -ex
83
84-. $TESTSLIB/utilities.sh
85+# shellcheck source=tests/lib/utilities.sh
86+. "$TESTSLIB"/utilities.sh
87
88 echo "Wait for firstboot change to be ready"
89 while ! snap changes | grep -q "Done"; do
90@@ -10,9 +11,10 @@ while ! snap changes | grep -q "Done"; do
91 done
92
93 echo "Ensure fundamental snaps are still present"
94-. $TESTSLIB/snap-names.sh
95-for name in $gadget_name $kernel_name $core_name; do
96- if ! snap list | grep -q $name ; then
97+# shellcheck source=tests/lib/snap-names.sh
98+. "$TESTSLIB"/snap-names.sh
99+for name in "$gadget_name" "$kernel_name" "$core_name"; do
100+ if ! snap list | grep -q "$name" ; then
101 echo "Not all fundamental snaps are available, all-snap image not valid"
102 echo "Currently installed snaps:"
103 snap list
104@@ -22,13 +24,6 @@ done
105
106 install_snap_under_test
107
108-# Snapshot of the current snapd state for a later restore
109-if [ ! -f $SPREAD_PATH/snapd-state.tar.gz ] ; then
110- systemctl stop snapd.service snapd.socket
111- tar czf $SPREAD_PATH/snapd-state.tar.gz /var/lib/snapd /etc/netplan
112- systemctl start snapd.socket
113-fi
114-
115 # For debugging dump all snaps and connected slots/plugs
116 snap list
117-snap interfaces
118+snap connections --all
119diff --git a/tests/lib/restore-each.sh b/tests/lib/restore-each.sh
120index 1d6d412..15dbcb5 100644
121--- a/tests/lib/restore-each.sh
122+++ b/tests/lib/restore-each.sh
123@@ -1,12 +1,13 @@
124-#!/bin/bash
125+#!/bin/bash -ex
126
127-. $TESTSLIB/snap-names.sh
128+# shellcheck source=tests/lib/snap-names.sh
129+. "$TESTSLIB"/snap-names.sh
130
131 # Remove all snaps not being the core, gadget, kernel or snap we're testing
132 for snap in /snap/*; do
133 snap="${snap:6}"
134 case "$snap" in
135- "bin" | "$gadget_name" | "$kernel_name" | core* | "$SNAP_NAME")
136+ README | bin | "$gadget_name" | "$kernel_name" | core* | snapd | "$SNAP_NAME")
137 ;;
138 *)
139 snap remove "$snap"
140@@ -14,9 +15,3 @@ for snap in /snap/*; do
141 esac
142 done
143
144-# Ensure we have the same state for snapd as we had before
145-systemctl stop snapd.service snapd.socket
146-rm -rf /var/lib/snapd/*
147-tar xzf $SPREAD_PATH/snapd-state.tar.gz -C /
148-rm -rf /root/.snap
149-systemctl start snapd.service snapd.socket
150diff --git a/tests/lib/utilities.sh b/tests/lib/utilities.sh
151index 38220c9..6d46be8 100644
152--- a/tests/lib/utilities.sh
153+++ b/tests/lib/utilities.sh
154@@ -8,7 +8,7 @@ wait_for_bluez() {
155 }
156
157 stop_after_first_reboot() {
158- if [ $SPREAD_REBOOT -eq 1 ] ; then
159+ if [ "$SPREAD_REBOOT" -eq 1 ] ; then
160 exit 0
161 fi
162 }
163@@ -18,23 +18,22 @@ install_snap_under_test() {
164 # without any network connectivity after reboot.
165 if [ -n "$SNAP_CHANNEL" ] ; then
166 # Don't reinstall if we have it installed already
167- if ! snap list | grep $SNAP_NAME ; then
168- snap install --$SNAP_CHANNEL $SNAP_NAME
169+ if ! snap list | grep "$SNAP_NAME"; then
170+ snap install --"$SNAP_CHANNEL" "$SNAP_NAME"
171 fi
172 else
173 # Install first from store to avoid error when performing the connection
174- snap install $SNAP_NAME
175+ snap install "$SNAP_NAME"
176 # Install prebuilt snap
177- snap install --dangerous ${PROJECT_PATH}/${SNAP_NAME}_*_${SNAP_ARCH}.snap
178- snap connect bluez:uhid :uhid
179+ snap install --dangerous "$PROJECT_PATH"/"$SNAP_NAME"_*_"$SNAP_ARCH".snap
180 if [ -n "$SNAP_AUTO_ALIASES" ]; then
181 snapd_version=$(snap version | awk '/^snapd / {print $2; exit}')
182 for alias in $SNAP_AUTO_ALIASES ; do
183- target=$SNAP_NAME.$alias
184- if dpkg --compare-versions $snapd_version lt 2.25 ; then
185- target=$SNAP_NAME
186+ target="$SNAP_NAME".$alias
187+ if dpkg --compare-versions "$snapd_version" lt 2.25 ; then
188+ target="$SNAP_NAME"
189 fi
190- snap alias $target $alias
191+ snap alias "$target" "$alias"
192 done
193 fi
194 fi

Subscribers

People subscribed via source and target branches