Merge ~morphis/snappy-hwe-snaps/+git/wifi-ap:f/enable-default-conf-test into ~snappy-hwe-team/snappy-hwe-snaps/+git/wifi-ap:master

Proposed by Simon Fels
Status: Merged
Approved by: Matteo Croce
Approved revision: 3d0c86ca44e4361e6ac7709e04732e099a977285
Merged at revision: 9c570bdfa82a3121e509f81361eb79e87cbd0a98
Proposed branch: ~morphis/snappy-hwe-snaps/+git/wifi-ap:f/enable-default-conf-test
Merge into: ~snappy-hwe-team/snappy-hwe-snaps/+git/wifi-ap:master
Diff against target: 209 lines (+40/-44)
8 files modified
.tests_config (+1/-0)
run-tests.sh (+11/-14)
spread.yaml (+2/-0)
tests/lib/prepare-each.sh (+16/-0)
tests/lib/prepare.sh (+0/-2)
tests/lib/restore-each.sh (+1/-18)
tests/main/conf-wizard-disabled-from-gadget/task.yaml (+8/-9)
tests/main/utf8-ssid/task.yaml (+1/-1)
Reviewer Review Type Date Requested Status
Matteo Croce (community) Approve
System Enablement Bot continuous-integration Approve
Konrad Zapałowicz (community) code Approve
Review via email: mp+320156@code.launchpad.net

Description of the change

Enable gadget default configuration test case again now that we have a configure hook in stable

To post a comment you must log in.
Revision history for this message
Konrad Zapałowicz (kzapalowicz) wrote :

ack

review: Approve (code)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Matteo Croce (teknoraver) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/.tests_config b/.tests_config
2new file mode 100644
3index 0000000..67b8724
4--- /dev/null
5+++ b/.tests_config
6@@ -0,0 +1 @@
7+EXTRA_ARGS="--image-unsigned-gadget"
8diff --git a/run-tests.sh b/run-tests.sh
9index 0b0679d..3e02fc5 100755
10--- a/run-tests.sh
11+++ b/run-tests.sh
12@@ -19,10 +19,6 @@ set -e
13 TESTS_EXTRAS_URL="https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/tests-extras"
14 TESTS_EXTRAS_PATH=".tests-extras"
15
16-# Display help.
17-# This has to be in sync with the tests-extras/test-runner.sh script
18-# functionalities as the parameters to this one are passed directly there
19-# this function will quit the script because of the 'exec' keyword
20 show_help() {
21 exec cat <<'EOF'
22 Usage: run-tests.sh [OPTIONS]
23@@ -31,13 +27,9 @@ This is fetch & forget script and what it does is to fetch the
24 tests-extras repository and execute the run-tests.sh script from
25 there passing arguments as-is.
26
27-optional arguments:
28- --help Show this help message and exit
29- --channel Select another channel to build the base image from (default: stable)
30- --snap Extra snap to install
31- --debug Enable verbose debugging output
32- --test-from-channel Pull network-manager snap from the specified channel instead of building it from source
33- --force-new-image Force generating a new image used for testing
34+When you see this message you don't have the tests-extras repository
35+successfully populated in your workspace yet. Please rerun without
36+specifying --help to proceed with the initial clone of the git repository.
37 EOF
38 }
39
40@@ -66,8 +58,7 @@ restore_and_update_tests_extras() {
41 # The tests-extras repository ends up checked out in the snap tree but as a
42 # hidden directory which is re-used since then.
43
44-# Display help w/o fetching anything and exit
45-[ "$1" = "--help" ] && show_help
46+[ ! -d "$TESTS_EXTRAS_PATH" ] && [ "$1" = "--help" ] && show_help
47
48 if [ -d "$TESTS_EXTRAS_PATH" ]; then
49 restore_and_update_tests_extras
50@@ -75,5 +66,11 @@ else
51 clone_tests_extras
52 fi
53
54+# Any project-specific options for test-runner should be specified in
55+# .tests_config under EXTRA_ARGS
56+if [ -e ".tests_config" ]; then
57+ . $PWD/.tests_config
58+fi
59+
60 echo "INFO: Executing tests runner"
61-cd $TESTS_EXTRAS_PATH && ./tests-runner.sh "$@"
62+cd $TESTS_EXTRAS_PATH && ./tests-runner.sh "$@" "$EXTRA_ARGS"
63diff --git a/spread.yaml b/spread.yaml
64index 4bea33a..7836458 100644
65--- a/spread.yaml
66+++ b/spread.yaml
67@@ -60,5 +60,7 @@ suites:
68 - ubuntu-core-16
69 prepare: |
70 . $TESTSLIB/prepare.sh
71+ prepare-each: |
72+ . $TESTSLIB/prepare-each.sh
73 restore-each: |
74 . $TESTSLIB/restore-each.sh
75diff --git a/tests/lib/prepare-each.sh b/tests/lib/prepare-each.sh
76new file mode 100644
77index 0000000..7c9426a
78--- /dev/null
79+++ b/tests/lib/prepare-each.sh
80@@ -0,0 +1,16 @@
81+#!/bin/sh
82+. $TESTSLIB/utilities.sh
83+
84+# Powercycle both interface to get them back into a sane state before
85+# we install the wifi-ap snap
86+snap install --devmode wireless-tools
87+for d in wlan0 wlan1 ; do
88+ phy=$(iw dev $d info | awk '/wiphy/{print $2}')
89+ /snap/bin/wireless-tools.rfkill block $phy
90+ /snap/bin/wireless-tools.rfkill unblock $phy
91+done
92+snap remove wireless-tools
93+
94+install_snap_under_test
95+# Give wifi-ap a bit time to settle down to avoid clashed
96+sleep 5
97diff --git a/tests/lib/prepare.sh b/tests/lib/prepare.sh
98index d4b7020..7e27528 100644
99--- a/tests/lib/prepare.sh
100+++ b/tests/lib/prepare.sh
101@@ -23,8 +23,6 @@ done
102 echo "Kernel has a store revision"
103 snap list | grep ^${kernel_name} | grep -E " [0-9]+\s+canonical"
104
105-install_snap_under_test
106-
107 # Snapshot of the current snapd state for a later restore
108 if [ ! -f $SPREAD_PATH/snapd-state.tar.gz ] ; then
109 systemctl stop snapd.service snapd.socket
110diff --git a/tests/lib/restore-each.sh b/tests/lib/restore-each.sh
111index fa474b4..b0d1902 100644
112--- a/tests/lib/restore-each.sh
113+++ b/tests/lib/restore-each.sh
114@@ -7,7 +7,7 @@
115 for snap in /snap/*; do
116 snap="${snap:6}"
117 case "$snap" in
118- "bin" | "$gadget_name" | "$kernel_name" | "$core_name" | "$SNAP_NAME" )
119+ "bin" | "$gadget_name" | "$kernel_name" | "$core_name" )
120 ;;
121 *)
122 snap remove "$snap"
123@@ -15,15 +15,6 @@ for snap in /snap/*; do
124 esac
125 done
126
127-# Cleanup all configuration files from the snap so that we have
128-# a fresh start for the next test
129-rm -rf /var/snap/$SNAP_NAME/common/*
130-rm -rf /var/snap/$SNAP_NAME/current/*
131-# Depending on what the test did both services are not meant to be
132-# running here.
133-systemctl stop snap.wifi-ap.management-service || true
134-wait_for_systemd_service_exit snap.wifi-ap.management-service
135-
136 # Drop any generated or modified netplan configuration files. The original
137 # ones will be restored below.
138 rm -f /etc/netplan/*
139@@ -39,16 +30,8 @@ systemctl start snapd.service snapd.socket
140 netplan generate
141 netplan apply
142
143-# Start services again now that the system is restored
144-systemctl start snap.wifi-ap.management-service
145-wait_for_systemd_service snap.wifi-ap.management-service
146-
147 # remove and reinsert the module to refresh all the wifi network settings
148 rmmod mac80211_hwsim || true
149 modprobe mac80211_hwsim radios=2
150 wait_until_interface_is_available wlan0
151 wait_until_interface_is_available wlan1
152-
153-# Wizard should run after snap install
154-systemctl restart snap.wifi-ap.automatic-setup
155-wait_for_systemd_service_exit snap.wifi-ap.automatic-setup
156diff --git a/tests/main/conf-wizard-disabled-from-gadget/task.yaml b/tests/main/conf-wizard-disabled-from-gadget/task.yaml
157index 227ecfb..66496a6 100644
158--- a/tests/main/conf-wizard-disabled-from-gadget/task.yaml
159+++ b/tests/main/conf-wizard-disabled-from-gadget/task.yaml
160@@ -1,21 +1,16 @@
161 summary: Verify the wizard can be disabled by default from a gadget snap
162
163-# FIXME: This test needs to stay manual until a snap is in edge which
164-# contains a configure hook. Otherwise the snap installation will
165-# always fail.
166-manual: true
167-
168 prepare: |
169 . $TESTSLIB/snap-names.sh
170- snap list | grep $gadget_name | awk '{print $2}' > /tmp/gadget_version
171+ echo $(readlink /snap/$gadget_name/current) > /tmp/gadget_version
172
173 restore: |
174 . $TESTSLIB/snap-names.sh
175 # Restore the original gadget snap so that any following tests don't suffer
176 # from our modified gadget.
177- original_revision=`cat /tmp/gadget_version`
178- current_revision=`snap list | grep $gadget_name | awk '{print $2}'`
179- if [ $current_revision -ne $original_revision ]; then
180+ original_revision="$(cat /tmp/gadget_version)"
181+ current_revision="$(readlink /snap/$gadget_name/current)"
182+ if [ "$current_revision" != "$original_revision" ]; then
183 snap revert --revision=$original_revision $gadget_name
184 fi
185
186@@ -45,6 +40,10 @@ execute: |
187 snap install --edge wifi-ap
188
189 test "$(snap get wifi-ap automatic-setup.disable)" = true
190+
191+ # Wait until we can talk to the service
192+ while ! /snap/bin/wifi-ap.status; do sleep .1 ; done
193+
194 test "$(/snap/bin/wifi-ap.config get disabled)" = true
195 /snap/bin/wifi-ap.status | grep "ap.active: false"
196 ! pgrep dnsmasq
197diff --git a/tests/main/utf8-ssid/task.yaml b/tests/main/utf8-ssid/task.yaml
198index 9b6faa6..ad9e594 100644
199--- a/tests/main/utf8-ssid/task.yaml
200+++ b/tests/main/utf8-ssid/task.yaml
201@@ -7,7 +7,7 @@ execute: |
202 . $TESTSLIB/utilities.sh
203
204 # Default configuration will use wlan0 which we just created
205- /snap/bin/wifi-ap.config set 'wifi.ssid=Ubuntu👍' disabled=false
206+ /snap/bin/wifi-ap.config set 'wifi.ssid=Ubuntu👍' debug=true
207
208 # Ensure the wizard picked the right interface
209 test "`/snap/bin/wifi-ap.config get 'wifi.interface'`" = "wlan0"

Subscribers

People subscribed via source and target branches

to all changes: