Merge ~jocave/plainbox-provider-snappy:modify-for-refresh-control into plainbox-provider-snappy:master

Proposed by Jonathan Cave
Status: Merged
Approved by: Sylvain Pineau
Approved revision: 9bb26ec24215a06ce3529c6bc1a2a8b3c91a995d
Merged at revision: 394c9d369b5a4254cee06f618965caf17f98a4a8
Proposed branch: ~jocave/plainbox-provider-snappy:modify-for-refresh-control
Merge into: plainbox-provider-snappy:master
Diff against target: 352 lines (+182/-87)
4 files modified
dev/null (+0/-82)
plainbox-provider-snappy/bin/snap_tests (+83/-0)
plainbox-provider-snappy/units/snappy/snappy.pxu (+67/-5)
plainbox-provider-snappy/units/snappy/test-plan.pxu (+32/-0)
Reviewer Review Type Date Requested Status
Paul Larson Approve
Review via email: mp+323792@code.launchpad.net

Description of the change

Add copies of manual jobs that should work on devices that are refresh controlled.

To post a comment you must log in.
Revision history for this message
Paul Larson (pwlars) wrote :

I was thinking there may be some points in time where it could fail if the version in edge hasn't been updated yet. However, I think their release process has been mostly ensuring there's always a newer version in edge for the most part, so probably not a big enough concern to worry about.
+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/plainbox-provider-snappy/bin/snap_tests b/plainbox-provider-snappy/bin/snap_tests
2new file mode 100755
3index 0000000..955e535
4--- /dev/null
5+++ b/plainbox-provider-snappy/bin/snap_tests
6@@ -0,0 +1,83 @@
7+#!/usr/bin/env python3
8+# Copyright 2015-2017 Canonical Ltd.
9+# All rights reserved.
10+#
11+# Written by:
12+# Authors: Jonathan Cave <jonathan.cave@canonical.com>
13+
14+
15+import subprocess
16+
17+from guacamole import Command
18+
19+
20+class SnapList(Command):
21+
22+ """snap list sub-command."""
23+
24+ def invoked(self, ctx):
25+ """snap list should show the core package is installed."""
26+ cmd = ['snap', 'list']
27+ output = subprocess.check_output(cmd)
28+ if 'core' not in str(output):
29+ print("String not found")
30+ return 1
31+
32+
33+class SnapSearch(Command):
34+
35+ """snap search sub-command."""
36+
37+ def invoked(self, ctx):
38+ """snap search for 'hello'."""
39+ cmd = ['snap', 'find', 'hello']
40+ output = subprocess.check_output(cmd)
41+ if 'hello-world' not in str(output):
42+ print("String not found")
43+ return 1
44+
45+
46+class SnapInstall(Command):
47+
48+ """snap install sub-command."""
49+
50+ def invoked(self, ctx):
51+ """Test install of test-snapd-tools snap."""
52+ cmd = ['sudo', 'snap', 'install', 'test-snapd-tools']
53+ subprocess.check_call(cmd)
54+ cmd = ['snap', 'list']
55+ output = subprocess.check_output(cmd)
56+ if 'test-snapd-tools' not in str(output):
57+ print("Didn't find package name")
58+ return 1
59+
60+
61+class SnapRemove(Command):
62+
63+ """snap remove sub-command."""
64+
65+ def invoked(self, ctx):
66+ """Test remove of test-snapd-tools snap."""
67+ cmd = ['sudo', 'snap', 'remove', 'test-snapd-tools']
68+ subprocess.check_call(cmd)
69+ cmd = ['snap', 'list']
70+ output = subprocess.check_output(cmd)
71+ if 'test-snapd-tools' in str(output):
72+ print("Found package name")
73+ return 1
74+
75+
76+class Snap(Command):
77+
78+ """Fake snap like command."""
79+
80+ sub_commands = (
81+ ('list', SnapList),
82+ ('search', SnapSearch),
83+ ('install', SnapInstall),
84+ ('remove', SnapRemove),
85+ )
86+
87+
88+if __name__ == '__main__':
89+ Snap().main()
90diff --git a/plainbox-provider-snappy/bin/snappy_tests b/plainbox-provider-snappy/bin/snappy_tests
91deleted file mode 100755
92index 6c21f40..0000000
93--- a/plainbox-provider-snappy/bin/snappy_tests
94+++ /dev/null
95@@ -1,82 +0,0 @@
96-#!/usr/bin/env python3
97-# Copyright 2015 Canonical Ltd.
98-# All rights reserved.
99-#
100-# Written by:
101-# Authors: Jonathan Cave <jonathan.cave@canonical.com>
102-
103-
104-import subprocess
105-
106-from guacamole import Command
107-
108-
109-class SnappyList(Command):
110-
111- """snappy list sub-command."""
112-
113- def invoked(self, ctx):
114- """Snappy list should show the ubuntu-core package is installed."""
115- cmd = ['snap', 'list']
116- output = subprocess.check_output(cmd)
117- if 'core' not in str(output):
118- print("String not found")
119- return 1
120-
121-
122-class SnappySearch(Command):
123-
124- """snappy search sub-command."""
125-
126- def invoked(self, ctx):
127- """Snappy search for 'hello'."""
128- cmd = ['snap', 'find', 'hello']
129- output = subprocess.check_output(cmd)
130- if 'hello-world' not in str(output):
131- print("String not found")
132- return 1
133-
134-
135-class SnappyInstall(Command):
136-
137- """snappy install sub-command."""
138-
139- def invoked(self, ctx):
140- """Test install of test-snapd-tools snap."""
141- cmd = ['sudo', 'snap', 'install', 'test-snapd-tools']
142- subprocess.check_call(cmd)
143- cmd = ['snap', 'list']
144- output = subprocess.check_output(cmd)
145- if 'test-snapd-tools' not in str(output):
146- print("Didn't find package name")
147- return 1
148-
149-
150-class SnappyRemove(Command):
151-
152- """snappy remove sub-command."""
153-
154- def invoked(self, ctx):
155- """Test remove of test-snapd-tools snap."""
156- cmd = ['sudo', 'snap', 'remove', 'test-snapd-tools']
157- subprocess.check_call(cmd)
158- cmd = ['snap', 'list']
159- output = subprocess.check_output(cmd)
160- if 'test-snapd-tools' in str(output):
161- print("Found package name")
162- return 1
163-
164-
165-class Snappy(Command):
166-
167- """Fake snappy like command."""
168-
169- sub_commands = (
170- ('list', SnappyList),
171- ('search', SnappySearch),
172- ('install', SnappyInstall),
173- ('remove', SnappyRemove),
174- )
175-
176-if __name__ == '__main__':
177- Snappy().main()
178diff --git a/plainbox-provider-snappy/units/snappy/snappy.pxu b/plainbox-provider-snappy/units/snappy/snappy.pxu
179index 313b0d5..774c2d2 100644
180--- a/plainbox-provider-snappy/units/snappy/snappy.pxu
181+++ b/plainbox-provider-snappy/units/snappy/snappy.pxu
182@@ -3,7 +3,7 @@ _summary: Test that the snap list command is working.
183 _purpose: If snap list command is working then should at least find the
184 ubuntu-core package.
185 plugin: shell
186-command: snappy_tests list
187+command: snap_tests list
188 category_id: snappy
189 estimated_duration: 10s
190 flags: preserve-locale
191@@ -13,7 +13,7 @@ _summary: Test that the snap find command is working.
192 _purpose: If snap find command is working then should find hello-world
193 in the store.
194 plugin: shell
195-command: snappy_tests search
196+command: snap_tests search
197 category_id: snappy
198 estimated_duration: 10s
199 flags: preserve-locale
200@@ -24,7 +24,7 @@ _purpose:
201 The store should contain the basic test-snapd-tools snap makes sure this
202 can be downloaded and installed on the system.
203 plugin: shell
204-command: snappy_tests install
205+command: snap_tests install
206 category_id: snappy
207 estimated_duration: 10s
208 flags: preserve-locale
209@@ -33,7 +33,7 @@ id: snappy/snap-remove
210 _summary: Test the snap remove command is able to remove the test-snapd-tools snap.
211 _purpose: After having installed the test-snapd-tools snap, check it can removed.
212 plugin: shell
213-command: snappy_tests remove
214+command: snap_tests remove
215 category_id: snappy
216 estimated_duration: 10s
217 depends: snappy/snap-install
218@@ -109,7 +109,25 @@ _steps:
219 _verification:
220 Check core version is newer using the edge channel
221 plugin: manual
222-after: snappy/snap-reupdate
223+category_id: snappy
224+estimated_duration: 400
225+
226+id: snappy/os-refresh-with-refresh-control
227+_summary: Refresh the system using the snap tool
228+_purpose:
229+ Check "core" can be refreshed by snap refresh
230+_steps:
231+ 1. Check version number
232+ snap list core
233+ 2. Update
234+ snap refresh core --edge --ignore-validation
235+ 3. Reboot the system and log in
236+ sudo reboot
237+ 4. Check version number
238+ snap list core
239+_verification:
240+ Check core version is newer using the edge channel
241+plugin: manual
242 category_id: snappy
243 estimated_duration: 400
244
245@@ -133,6 +151,26 @@ depends: snappy/os-refresh
246 category_id: snappy
247 estimated_duration: 400
248
249+id: snappy/os-revert-with-refresh-control
250+_summary: Rollback system update using the snap tool
251+_purpose:
252+ Check core can be reverted by snap revert
253+_steps:
254+ 1. Check version number
255+ snap list core
256+ 2. Revert
257+ snap revert core
258+ 3. Reboot the system and log in
259+ sudo reboot
260+ 4. Check version number
261+ snap list core
262+_verification:
263+ Check core version is back to its stable version
264+plugin: manual
265+depends: snappy/os-refresh-with-refresh-control
266+category_id: snappy
267+estimated_duration: 400
268+
269 id: snappy/os-fail-boot
270 _summary: Automatically rollback after failed boot after upgrade
271 _purpose:
272@@ -157,6 +195,30 @@ category_id: snappy
273 depends: snappy/os-revert
274 estimated_duration: 500
275
276+id: snappy/os-fail-boot-with-refresh-control
277+_summary: Automatically rollback after failed boot after upgrade
278+_purpose:
279+ Check system will rollback to original core snap if failed to boot the updated one
280+_steps:
281+ 1. Remove reverted version (and associated data)
282+ snap remove core --revision=<edge_revision>
283+ 2. Check that the edge revision is back in the refresh list
284+ snap refresh --list core
285+ 3. Update
286+ snap refresh core --edge --ignore-validation
287+ 4. Modify the GRUB Environment Block to simulate a failed boot
288+ sudo /usr/bin/grub-editenv /boot/grub/grubenv set snap_mode=trying
289+ 5. Reboot the system and log in
290+ sudo reboot
291+ 6. Check version number
292+ snap list core
293+_verification:
294+ Check system is currently booting the stable core version
295+plugin: manual
296+category_id: snappy
297+depends: snappy/os-revert-with-refresh-control
298+estimated_duration: 500
299+
300 id: snappy/sshd
301 _summary: SSH is enabled and operational
302 _purpose:
303diff --git a/plainbox-provider-snappy/units/snappy/test-plan.pxu b/plainbox-provider-snappy/units/snappy/test-plan.pxu
304index 3aeb033..fb03450 100644
305--- a/plainbox-provider-snappy/units/snappy/test-plan.pxu
306+++ b/plainbox-provider-snappy/units/snappy/test-plan.pxu
307@@ -10,6 +10,18 @@ nested_part:
308 snappy-snap-manual
309 snappy-snap-automated
310
311+id: snappy-snap-full-with-refresh-control
312+unit: test plan
313+_name: Tests for snap command
314+_description:
315+ QA test plan that includes generic tests for the snap command for Snappy
316+ Ubuntu Core devices.
317+estimated_duration: 5m
318+include:
319+nested_part:
320+ snappy-snap-manual-with-refresh-control
321+ snappy-snap-automated
322+
323 id: snappy-snap-manual
324 unit: test plan
325 _name: QA tests for snap command
326@@ -30,6 +42,26 @@ include:
327 mandatory_include:
328 snap
329
330+id: snappy-snap-manual-with-refresh-control
331+unit: test plan
332+_name: QA tests for snap command on refresh controlled stores
333+_description:
334+ QA test that includes manual tests for the snap command for Snappy Ubuntu
335+ Core devices.
336+include:
337+ snappy/snap-refresh
338+ snappy/snap-revert
339+ snappy/snap-reupdate
340+ snappy/os-refresh-with-refresh-control
341+ snappy/os-revert-with-refresh-control
342+ snappy/os-fail-boot-with-refresh-control
343+ snappy/sshd
344+ snappy/snapweb
345+ snappy/snapweb-search
346+ snappy/snapweb-install
347+mandatory_include:
348+ snap
349+
350 id: snappy-snap-automated
351 unit: test plan
352 _name: Automated tests for snap command

Subscribers

People subscribed via source and target branches