Merge lp:~canonical-platform-qa/ubuntu-system-tests/snap-channel-support into lp:ubuntu-system-tests
- snap-channel-support
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Santiago Baldassin |
Approved revision: | 524 |
Merged at revision: | 521 |
Proposed branch: | lp:~canonical-platform-qa/ubuntu-system-tests/snap-channel-support |
Merge into: | lp:ubuntu-system-tests |
Diff against target: |
398 lines (+213/-22) 6 files modified
ubuntu_system_tests/helpers/terminal/app.py (+36/-4) ubuntu_system_tests/host/commands.py (+55/-9) ubuntu_system_tests/host/target_setup.py (+44/-2) ubuntu_system_tests/host/targets.py (+11/-0) ubuntu_system_tests/selftests/test_commands.py (+60/-4) ubuntu_system_tests/tests/test_launch_apps.py (+7/-3) |
To merge this branch: | bzr merge lp:~canonical-platform-qa/ubuntu-system-tests/snap-channel-support |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Santiago Baldassin (community) | Approve | ||
platform-qa-bot | continuous-integration | Approve | |
Review via email: mp+320393@code.launchpad.net |
Commit message
Add support for installing snaps from beta and edge channels.
Description of the change
Changes include:
- Check the beta channel first and use this version, or use edge channel if beta is not found.
- Update target_setup.py to do this during snap install
- Update Target class to do this during test using --upgrade option
- Get the core series and architecture from target rather than using parameters
- Update command helpers to check for snap channel revisions when creating --setup-commands for upgrade
- Update the Terminal app classes to work with both deb and snap versions as snap version would be required when testing on snap based image.
- Update self tests and add new ones for checking snap channel
This should be landed in parallel with: https:/
platform-qa-bot (platform-qa-bot) wrote : | # |
- 524. By Richard Huddie
-
Merge from trunk.
platform-qa-bot (platform-qa-bot) wrote : | # |
PASSED: Continuous integration, rev:524
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Santiago Baldassin (sbaldassin) wrote : | # |
Looks good in general. I just have a couple of questions:
1. Why is beta the default channel? Once a "snap" silo is ready for QA, will the snap in question be automatically available in the beta channel?
2. I'm not sure yet about the workflow with Bileto but if the app is not available in the beta channel, I would just make the setup to fail. Installing the snap from --edge could lead us to test the wrong version of the app. right?
For example, let's say that there's a new silo for the calc snap v1.2, stable has 1.0 and edge has 1.1, if 1.2 is not uploaded to --beta, then we would end up executing the test cases against 1.1 and approving the 1.2 silo based on the 1.1 results
Thoughts?
Richard Huddie (rhuddie) wrote : | # |
> 1. Why is beta the default channel? Once a "snap" silo is ready for QA, will
> the snap in question be automatically available in the beta channel?
This change was requested due to the poor state of snap testing, so we could use more stable versions, rather than always taking the latest development version from edge which might not be fit for testing.
This doesn't take into account silos, I'm not sure how that process works for snaps. It would be possible to add a command option to force it to take a specific channel/revision for specific cases.
>
> 2. I'm not sure yet about the workflow with Bileto but if the app is not
> available in the beta channel, I would just make the setup to fail. Installing
> the snap from --edge could lead us to test the wrong version of the app.
> right?
>
> For example, let's say that there's a new silo for the calc snap v1.2, stable
> has 1.0 and edge has 1.1, if 1.2 is not uploaded to --beta, then we would end
> up executing the test cases against 1.1 and approving the 1.2 silo based on
> the 1.1 results
>
> Thoughts?
I'm also unsure how that process would work. But we could easily add some command options to force a specific channel and revision and fail if it can't find it.
These changes would also be related to the other app changes we're discussing about only having 1 version installed, so I think it would be better to look at adding these options again when we have that sorted.
Santiago Baldassin (sbaldassin) wrote : | # |
Looks good
Preview Diff
1 | === modified file 'ubuntu_system_tests/helpers/terminal/app.py' | |||
2 | --- ubuntu_system_tests/helpers/terminal/app.py 2017-03-13 14:28:26 +0000 | |||
3 | +++ ubuntu_system_tests/helpers/terminal/app.py 2017-03-30 18:35:16 +0000 | |||
4 | @@ -18,18 +18,50 @@ | |||
5 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
6 | 19 | # | 19 | # |
7 | 20 | 20 | ||
9 | 21 | from ubuntu_system_tests.helpers.application import Deb | 21 | from ubuntu_system_tests.helpers import autopilot |
10 | 22 | from ubuntu_system_tests.helpers.application import ( | ||
11 | 23 | Deb, | ||
12 | 24 | Snap, | ||
13 | 25 | ) | ||
14 | 26 | from ubuntu_system_tests.helpers.processes import get_process_id | ||
15 | 22 | 27 | ||
16 | 28 | APP = 'terminal' | ||
17 | 23 | APP_NAME = 'Terminal' | 29 | APP_NAME = 'Terminal' |
18 | 24 | APP_ID = 'com.ubuntu.terminal' | 30 | APP_ID = 'com.ubuntu.terminal' |
19 | 25 | APP_PACKAGE_ID = 'ubuntu-terminal-app' | 31 | APP_PACKAGE_ID = 'ubuntu-terminal-app' |
20 | 26 | 32 | ||
21 | 27 | 33 | ||
23 | 28 | class Terminal(Deb): | 34 | class TerminalDeb(Deb): |
24 | 29 | 35 | ||
25 | 30 | def __init__(self): | 36 | def __init__(self): |
26 | 31 | super().__init__(APP_NAME, APP_ID, APP_PACKAGE_ID) | 37 | super().__init__(APP_NAME, APP_ID, APP_PACKAGE_ID) |
27 | 32 | 38 | ||
28 | 33 | def get_main_view(self): | 39 | def get_main_view(self): |
31 | 34 | from ubuntu_system_tests.helpers.terminal import cpo # NOQA | 40 | return get_main_view() |
32 | 35 | return self.get_proxy_object().main_view | 41 | |
33 | 42 | |||
34 | 43 | class TerminalSnap(Snap): | ||
35 | 44 | |||
36 | 45 | def __init__(self): | ||
37 | 46 | super().__init__(APP_NAME, APP_ID) | ||
38 | 47 | |||
39 | 48 | def get_main_view(self): | ||
40 | 49 | return get_main_view() | ||
41 | 50 | |||
42 | 51 | |||
43 | 52 | def get_main_view(): | ||
44 | 53 | from ubuntu_system_tests.helpers.terminal import cpo # NOQA | ||
45 | 54 | pid = get_process_id(APP) | ||
46 | 55 | return autopilot.get_proxy_object(pid=pid).main_view | ||
47 | 56 | |||
48 | 57 | |||
49 | 58 | def get_terminal_app(mode): | ||
50 | 59 | """Return terminal application class of required type. | ||
51 | 60 | :param mode: Either 'snap' or 'deb'. | ||
52 | 61 | :return: Either TerminalDeb or TerminalSnap class reference. | ||
53 | 62 | """ | ||
54 | 63 | app_modes = { | ||
55 | 64 | 'deb': TerminalDeb, | ||
56 | 65 | 'snap': TerminalSnap | ||
57 | 66 | } | ||
58 | 67 | return app_modes[mode] | ||
59 | 36 | 68 | ||
60 | === modified file 'ubuntu_system_tests/host/commands.py' | |||
61 | --- ubuntu_system_tests/host/commands.py 2017-03-09 17:21:07 +0000 | |||
62 | +++ ubuntu_system_tests/host/commands.py 2017-03-30 18:35:16 +0000 | |||
63 | @@ -19,6 +19,7 @@ | |||
64 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
65 | 20 | # | 20 | # |
66 | 21 | 21 | ||
67 | 22 | import requests | ||
68 | 22 | import subprocess | 23 | import subprocess |
69 | 23 | 24 | ||
70 | 24 | from ubuntu_system_tests.common import ( | 25 | from ubuntu_system_tests.common import ( |
71 | @@ -44,6 +45,23 @@ | |||
72 | 44 | legacy_cmds = None | 45 | legacy_cmds = None |
73 | 45 | 46 | ||
74 | 46 | XENIAL = '16.04' | 47 | XENIAL = '16.04' |
75 | 48 | SNAP_STORE_QUERY_URL = ( | ||
76 | 49 | 'https://search.apps.ubuntu.com/api/v1/snaps/details/{n}?channel={c}' | ||
77 | 50 | ) | ||
78 | 51 | # List of apps to be installed as snaps on a deb based session. | ||
79 | 52 | # Anything else will be installed as a deb. | ||
80 | 53 | # This is used for upgrade command where a list of packages is | ||
81 | 54 | # specified which must be upgraded before running a test. | ||
82 | 55 | SNAP_APPS = [ | ||
83 | 56 | 'address-book-app', | ||
84 | 57 | 'camera-app', | ||
85 | 58 | 'gallery-app', | ||
86 | 59 | 'ubuntu-calculator-app', | ||
87 | 60 | 'ubuntu-calendar-app', | ||
88 | 61 | 'ubuntu-clock-app', | ||
89 | 62 | 'ubuntu-filemanager-app', | ||
90 | 63 | 'webbrowser-app', | ||
91 | 64 | ] | ||
92 | 47 | 65 | ||
93 | 48 | 66 | ||
94 | 49 | def use_legacy_commands(): | 67 | def use_legacy_commands(): |
95 | @@ -158,20 +176,48 @@ | |||
96 | 158 | def _get_upgrade_setup_command(target, upgrade): | 176 | def _get_upgrade_setup_command(target, upgrade): |
97 | 159 | """Return setup command to upgrade csv list of components.""" | 177 | """Return setup command to upgrade csv list of components.""" |
98 | 160 | if upgrade: | 178 | if upgrade: |
99 | 179 | upgrade_list = upgrade.split(',') | ||
100 | 180 | cmd = '' | ||
101 | 181 | series = target.core_series() | ||
102 | 182 | arch = target.architecture() | ||
103 | 161 | if target.snap_session(): | 183 | if target.snap_session(): |
108 | 162 | cmd = '' | 184 | # For a snap session all apps must be snaps |
109 | 163 | for name in upgrade.split(','): | 185 | for name in upgrade_list: |
110 | 164 | cmd += 'snap refresh --devmode --edge {}; '.format(name) | 186 | cmd += _get_snap_channel_upgrade_command(series, arch, name) |
107 | 165 | cmd = cmd.strip() | ||
111 | 166 | else: | 187 | else: |
117 | 167 | upgrade = upgrade.replace(',', ' ') | 188 | # For a deb session, the apps could be either deb or snap |
118 | 168 | cmd = ( | 189 | for name in upgrade_list: |
119 | 169 | 'apt-get -y --no-install-recommends install ' | 190 | if name in SNAP_APPS: |
120 | 170 | '{}'.format(upgrade)) | 191 | cmd += _get_snap_channel_upgrade_command( |
121 | 171 | return ['--setup-commands', _get_fs_rw_command(target) + cmd] | 192 | series, arch, name) |
122 | 193 | else: | ||
123 | 194 | cmd += _get_deb_upgrade_command(name) | ||
124 | 195 | return ['--setup-commands', _get_fs_rw_command(target) + cmd.strip()] | ||
125 | 172 | return [] | 196 | return [] |
126 | 173 | 197 | ||
127 | 174 | 198 | ||
128 | 199 | def _get_snap_channel_upgrade_command(series, arch, snap_name): | ||
129 | 200 | for channel in ['beta', 'edge']: | ||
130 | 201 | if _is_snap_published_for_channel(series, arch, snap_name, channel): | ||
131 | 202 | return _get_snap_upgrade_command(snap_name, channel) | ||
132 | 203 | raise RuntimeError('No channel found for {}.'.format(snap_name)) | ||
133 | 204 | |||
134 | 205 | |||
135 | 206 | def _get_snap_upgrade_command(app, channel): | ||
136 | 207 | return 'snap refresh --devmode --{c} {a}; '.format(c=channel, a=app) | ||
137 | 208 | |||
138 | 209 | |||
139 | 210 | def _get_deb_upgrade_command(app): | ||
140 | 211 | return 'apt-get -y --no-install-recommends install {}; '.format(app) | ||
141 | 212 | |||
142 | 213 | |||
143 | 214 | def _is_snap_published_for_channel(series, arch, snap, channel): | ||
144 | 215 | headers = {'X-Ubuntu-Series': series, 'X-Ubuntu-Architecture': arch} | ||
145 | 216 | url = SNAP_STORE_QUERY_URL.format(n=snap, c=channel) | ||
146 | 217 | response = requests.get(url, headers=headers) | ||
147 | 218 | return response.ok | ||
148 | 219 | |||
149 | 220 | |||
150 | 175 | def _get_fs_ro_setup_command(target): | 221 | def _get_fs_ro_setup_command(target): |
151 | 176 | """Return setup command to set file system read-only.""" | 222 | """Return setup command to set file system read-only.""" |
152 | 177 | if target.config.get('mount_fs_ro', False): | 223 | if target.config.get('mount_fs_ro', False): |
153 | 178 | 224 | ||
154 | === modified file 'ubuntu_system_tests/host/target_setup.py' | |||
155 | --- ubuntu_system_tests/host/target_setup.py 2017-03-13 14:28:26 +0000 | |||
156 | +++ ubuntu_system_tests/host/target_setup.py 2017-03-30 18:35:16 +0000 | |||
157 | @@ -24,7 +24,9 @@ | |||
158 | 24 | import dbus | 24 | import dbus |
159 | 25 | import json | 25 | import json |
160 | 26 | import os | 26 | import os |
161 | 27 | import platform | ||
162 | 27 | import pwd | 28 | import pwd |
163 | 29 | import requests | ||
164 | 28 | import shutil | 30 | import shutil |
165 | 29 | import subprocess | 31 | import subprocess |
166 | 30 | import sys | 32 | import sys |
167 | @@ -48,6 +50,10 @@ | |||
168 | 48 | XENIAL = 16.04 | 50 | XENIAL = 16.04 |
169 | 49 | YAKKETY = 16.10 | 51 | YAKKETY = 16.10 |
170 | 50 | 52 | ||
171 | 53 | SNAP_STORE_QUERY_URL = ( | ||
172 | 54 | 'https://search.apps.ubuntu.com/api/v1/snaps/details/{n}?channel={c}' | ||
173 | 55 | ) | ||
174 | 56 | |||
175 | 51 | 57 | ||
176 | 52 | class SetupRunner: | 58 | class SetupRunner: |
177 | 53 | 59 | ||
178 | @@ -57,6 +63,8 @@ | |||
179 | 57 | self.config = config | 63 | self.config = config |
180 | 58 | self.series = None | 64 | self.series = None |
181 | 59 | self.release = None | 65 | self.release = None |
182 | 66 | self.core_series = None | ||
183 | 67 | self.arch = None | ||
184 | 60 | self._set_cache_dir() | 68 | self._set_cache_dir() |
185 | 61 | 69 | ||
186 | 62 | def _set_cache_dir(self): | 70 | def _set_cache_dir(self): |
187 | @@ -95,6 +103,23 @@ | |||
188 | 95 | ['lsb_release', '-cs']).decode().strip() | 103 | ['lsb_release', '-cs']).decode().strip() |
189 | 96 | return self.series | 104 | return self.series |
190 | 97 | 105 | ||
191 | 106 | def get_core_series(self): | ||
192 | 107 | """Return the Ubuntu Core series.""" | ||
193 | 108 | if self.core_series is None: | ||
194 | 109 | self.core_series = subprocess.check_output( | ||
195 | 110 | 'snap version | grep series | tr -s " " | cut -d" " -f2', | ||
196 | 111 | shell=True).decode().strip() | ||
197 | 112 | return self.core_series | ||
198 | 113 | |||
199 | 114 | def get_architecture(self): | ||
200 | 115 | """Return the current architecture.""" | ||
201 | 116 | if self.arch is None: | ||
202 | 117 | if platform.architecture()[0] == '64bit': | ||
203 | 118 | self.arch = 'amd64' | ||
204 | 119 | else: | ||
205 | 120 | self.arch = 'i386' | ||
206 | 121 | return self.arch | ||
207 | 122 | |||
208 | 98 | def update_apt(self): | 123 | def update_apt(self): |
209 | 99 | """Return command to apt-get update.""" | 124 | """Return command to apt-get update.""" |
210 | 100 | if self.config['update_apt']: | 125 | if self.config['update_apt']: |
211 | @@ -182,9 +207,26 @@ | |||
212 | 182 | if snaps: | 207 | if snaps: |
213 | 183 | self.mount_fs_rw() | 208 | self.mount_fs_rw() |
214 | 184 | for snap in snaps: | 209 | for snap in snaps: |
215 | 210 | installed = False | ||
216 | 185 | cmd = 'refresh' if self.is_snap_installed(snap) else 'install' | 211 | cmd = 'refresh' if self.is_snap_installed(snap) else 'install' |
219 | 186 | subprocess.check_call( | 212 | for channel in ['beta', 'edge']: |
220 | 187 | ['snap', cmd, '--devmode', '--edge', snap]) | 213 | if self.is_snap_published_for_channel(snap, channel): |
221 | 214 | channel_arg = '--{}'.format(channel) | ||
222 | 215 | subprocess.check_call( | ||
223 | 216 | ['snap', cmd, '--devmode', channel_arg, snap]) | ||
224 | 217 | installed = True | ||
225 | 218 | break | ||
226 | 219 | if not installed: | ||
227 | 220 | raise RuntimeError( | ||
228 | 221 | 'Could not find channel for snap {}'.format(snap)) | ||
229 | 222 | |||
230 | 223 | def is_snap_published_for_channel(self, snap, channel): | ||
231 | 224 | arch = self.get_architecture() | ||
232 | 225 | series = self.get_core_series() | ||
233 | 226 | headers = {'X-Ubuntu-Series': series, 'X-Ubuntu-Architecture': arch} | ||
234 | 227 | url = SNAP_STORE_QUERY_URL.format(n=snap, c=channel) | ||
235 | 228 | response = requests.get(url, headers=headers) | ||
236 | 229 | return response.ok | ||
237 | 188 | 230 | ||
238 | 189 | def is_snap_installed(self, snap): | 231 | def is_snap_installed(self, snap): |
239 | 190 | return os.path.isdir(os.path.join('/snap', snap)) | 232 | return os.path.isdir(os.path.join('/snap', snap)) |
240 | 191 | 233 | ||
241 | === modified file 'ubuntu_system_tests/host/targets.py' | |||
242 | --- ubuntu_system_tests/host/targets.py 2017-03-07 16:30:47 +0000 | |||
243 | +++ ubuntu_system_tests/host/targets.py 2017-03-30 18:35:16 +0000 | |||
244 | @@ -131,6 +131,17 @@ | |||
245 | 131 | def release(self): | 131 | def release(self): |
246 | 132 | return self.run('lsb_release -rs', log_stdout=False).output.strip() | 132 | return self.run('lsb_release -rs', log_stdout=False).output.strip() |
247 | 133 | 133 | ||
248 | 134 | def core_series(self): | ||
249 | 135 | return self.run( | ||
250 | 136 | 'snap version | grep series | tr -s " " | cut -d" " -f2 ', | ||
251 | 137 | log_stdout=False).output.strip() | ||
252 | 138 | |||
253 | 139 | def architecture(self): | ||
254 | 140 | arch = self.run('uname --machine', log_stdout=False).output.strip() | ||
255 | 141 | if arch == 'x86_64': | ||
256 | 142 | return 'amd64' | ||
257 | 143 | return 'i386' | ||
258 | 144 | |||
259 | 134 | def user_id(self, user): | 145 | def user_id(self, user): |
260 | 135 | """Return user id for specified user name.""" | 146 | """Return user id for specified user name.""" |
261 | 136 | return self.run( | 147 | return self.run( |
262 | 137 | 148 | ||
263 | === modified file 'ubuntu_system_tests/selftests/test_commands.py' | |||
264 | --- ubuntu_system_tests/selftests/test_commands.py 2017-02-24 14:22:54 +0000 | |||
265 | +++ ubuntu_system_tests/selftests/test_commands.py 2017-03-30 18:35:16 +0000 | |||
266 | @@ -228,12 +228,20 @@ | |||
267 | 228 | class MockTarget: | 228 | class MockTarget: |
268 | 229 | 229 | ||
269 | 230 | def __init__(self, **kwargs): | 230 | def __init__(self, **kwargs): |
270 | 231 | self._core_series = '16' | ||
271 | 232 | self._architecture = 'amd64' | ||
272 | 231 | for arg in kwargs.keys(): | 233 | for arg in kwargs.keys(): |
273 | 232 | setattr(self, arg, kwargs[arg]) | 234 | setattr(self, arg, kwargs[arg]) |
274 | 233 | 235 | ||
275 | 234 | def snap_session(self): | 236 | def snap_session(self): |
276 | 235 | return self.snap | 237 | return self.snap |
277 | 236 | 238 | ||
278 | 239 | def core_series(self): | ||
279 | 240 | return self._core_series | ||
280 | 241 | |||
281 | 242 | def architecture(self): | ||
282 | 243 | return self._architecture | ||
283 | 244 | |||
284 | 237 | 245 | ||
285 | 238 | class TestUpgradeSetupCommands(ConfigBaseTestCase): | 246 | class TestUpgradeSetupCommands(ConfigBaseTestCase): |
286 | 239 | 247 | ||
287 | @@ -241,14 +249,20 @@ | |||
288 | 241 | super().setUp() | 249 | super().setUp() |
289 | 242 | self.args = DummyArgs(upgrade='package1,package2') | 250 | self.args = DummyArgs(upgrade='package1,package2') |
290 | 243 | 251 | ||
292 | 244 | def test_get_upgrade_setup_command_snap(self): | 252 | @mock.patch('ubuntu_system_tests.host.commands.' |
293 | 253 | '_is_snap_published_for_channel', | ||
294 | 254 | return_value=True) | ||
295 | 255 | def test_get_upgrade_setup_command_snap(self, mock_is_snap_published): | ||
296 | 245 | target = MockTarget(snap=True, config={'mount_fs_rw': False}) | 256 | target = MockTarget(snap=True, config={'mount_fs_rw': False}) |
297 | 246 | cmd = commands._get_upgrade_setup_command(target, self.args.upgrade) | 257 | cmd = commands._get_upgrade_setup_command(target, self.args.upgrade) |
298 | 258 | mock_is_snap_published.assert_has_calls([ | ||
299 | 259 | mock.call('16', 'amd64', 'package1', 'beta'), | ||
300 | 260 | mock.call('16', 'amd64', 'package2', 'beta')]) | ||
301 | 247 | self.assertEqual( | 261 | self.assertEqual( |
302 | 248 | cmd, | 262 | cmd, |
303 | 249 | ['--setup-commands', | 263 | ['--setup-commands', |
306 | 250 | 'snap refresh --devmode --edge package1; ' | 264 | 'snap refresh --devmode --beta package1; ' |
307 | 251 | 'snap refresh --devmode --edge package2;']) | 265 | 'snap refresh --devmode --beta package2;']) |
308 | 252 | 266 | ||
309 | 253 | def test_get_upgrade_setup_command_deb(self): | 267 | def test_get_upgrade_setup_command_deb(self): |
310 | 254 | target = MockTarget(snap=False, config={'mount_fs_rw': False}) | 268 | target = MockTarget(snap=False, config={'mount_fs_rw': False}) |
311 | @@ -256,9 +270,51 @@ | |||
312 | 256 | self.assertEqual( | 270 | self.assertEqual( |
313 | 257 | cmd, | 271 | cmd, |
314 | 258 | ['--setup-commands', | 272 | ['--setup-commands', |
316 | 259 | 'apt-get -y --no-install-recommends install package1 package2']) | 273 | 'apt-get -y --no-install-recommends install package1; ' |
317 | 274 | 'apt-get -y --no-install-recommends install package2;']) | ||
318 | 260 | 275 | ||
319 | 261 | def test_get_upgrade_setup_includes_fs_rw(self): | 276 | def test_get_upgrade_setup_includes_fs_rw(self): |
320 | 262 | target = MockTarget(snap=False, config={'mount_fs_rw': True}) | 277 | target = MockTarget(snap=False, config={'mount_fs_rw': True}) |
321 | 263 | cmd = commands._get_upgrade_setup_command(target, self.args.upgrade) | 278 | cmd = commands._get_upgrade_setup_command(target, self.args.upgrade) |
322 | 264 | self.assertIn('mount -o remount,rw /', cmd[1]) | 279 | self.assertIn('mount -o remount,rw /', cmd[1]) |
323 | 280 | |||
324 | 281 | |||
325 | 282 | class TestSnapUpgradeChannelSelection(ConfigBaseTestCase): | ||
326 | 283 | |||
327 | 284 | @mock.patch('ubuntu_system_tests.host.commands.' | ||
328 | 285 | '_is_snap_published_for_channel', | ||
329 | 286 | return_value=True) | ||
330 | 287 | def test_beta_channel_first_priority(self, mock_is_snap_published): | ||
331 | 288 | target = MockTarget(snap=True, config={'mount_fs_rw': False}) | ||
332 | 289 | cmd = commands._get_upgrade_setup_command(target, 'pkg1') | ||
333 | 290 | self.assertEqual( | ||
334 | 291 | cmd, | ||
335 | 292 | ['--setup-commands', | ||
336 | 293 | 'snap refresh --devmode --beta pkg1;']) | ||
337 | 294 | mock_is_snap_published.assert_has_calls([ | ||
338 | 295 | mock.call('16', 'amd64', 'pkg1', 'beta')]) | ||
339 | 296 | |||
340 | 297 | @mock.patch('ubuntu_system_tests.host.commands.' | ||
341 | 298 | '_is_snap_published_for_channel', | ||
342 | 299 | side_effect=[False, True]) | ||
343 | 300 | def test_edge_channel_second_priority(self, mock_is_snap_published): | ||
344 | 301 | target = MockTarget(snap=True, config={'mount_fs_rw': False}) | ||
345 | 302 | cmd = commands._get_upgrade_setup_command(target, 'pkg1') | ||
346 | 303 | self.assertEqual( | ||
347 | 304 | cmd, | ||
348 | 305 | ['--setup-commands', | ||
349 | 306 | 'snap refresh --devmode --edge pkg1;']) | ||
350 | 307 | mock_is_snap_published.assert_has_calls([ | ||
351 | 308 | mock.call('16', 'amd64', 'pkg1', 'beta'), | ||
352 | 309 | mock.call('16', 'amd64', 'pkg1', 'edge')]) | ||
353 | 310 | |||
354 | 311 | @mock.patch('ubuntu_system_tests.host.commands.' | ||
355 | 312 | '_is_snap_published_for_channel', | ||
356 | 313 | side_effect=[False, False]) | ||
357 | 314 | def test_raises_on_no_channel_found(self, mock_is_snap_published): | ||
358 | 315 | target = MockTarget(snap=True, config={'mount_fs_rw': False}) | ||
359 | 316 | with self.assertRaises(RuntimeError): | ||
360 | 317 | commands._get_upgrade_setup_command(target, 'pkg1') | ||
361 | 318 | mock_is_snap_published.assert_has_calls([ | ||
362 | 319 | mock.call('16', 'amd64', 'pkg1', 'beta'), | ||
363 | 320 | mock.call('16', 'amd64', 'pkg1', 'edge')]) | ||
364 | 265 | 321 | ||
365 | === modified file 'ubuntu_system_tests/tests/test_launch_apps.py' | |||
366 | --- ubuntu_system_tests/tests/test_launch_apps.py 2017-03-14 17:05:13 +0000 | |||
367 | +++ ubuntu_system_tests/tests/test_launch_apps.py 2017-03-30 18:35:16 +0000 | |||
368 | @@ -31,7 +31,9 @@ | |||
369 | 31 | from ubuntu_system_tests.helpers.clock.app import Clock | 31 | from ubuntu_system_tests.helpers.clock.app import Clock |
370 | 32 | from ubuntu_system_tests.helpers.filemanager.app import FileManager | 32 | from ubuntu_system_tests.helpers.filemanager.app import FileManager |
371 | 33 | from ubuntu_system_tests.helpers.gallery.app import Gallery | 33 | from ubuntu_system_tests.helpers.gallery.app import Gallery |
373 | 34 | from ubuntu_system_tests.helpers.terminal.app import Terminal | 34 | from ubuntu_system_tests.helpers.terminal.app import ( |
374 | 35 | get_terminal_app, | ||
375 | 36 | ) | ||
376 | 35 | from ubuntu_system_tests.helpers.system_settings.app import ( | 37 | from ubuntu_system_tests.helpers.system_settings.app import ( |
377 | 36 | get_system_settings_app, | 38 | get_system_settings_app, |
378 | 37 | ) | 39 | ) |
379 | @@ -96,7 +98,8 @@ | |||
380 | 96 | self.check_app_launch(FileManager, 1) | 98 | self.check_app_launch(FileManager, 1) |
381 | 97 | 99 | ||
382 | 98 | def test_launch_terminal_app(self): | 100 | def test_launch_terminal_app(self): |
384 | 99 | self.check_app_launch(Terminal, 1) | 101 | app = get_terminal_app(self.config_stack.get('unity8_mode')) |
385 | 102 | self.check_app_launch(app, 1) | ||
386 | 100 | 103 | ||
387 | 101 | def test_launch_webbrowser_app(self): | 104 | def test_launch_webbrowser_app(self): |
388 | 102 | self.check_app_launch(WebBrowser, 1) | 105 | self.check_app_launch(WebBrowser, 1) |
389 | @@ -131,7 +134,8 @@ | |||
390 | 131 | self.check_app_launch(FileManager, 2) | 134 | self.check_app_launch(FileManager, 2) |
391 | 132 | 135 | ||
392 | 133 | def test_launch_terminal_app_twice(self): | 136 | def test_launch_terminal_app_twice(self): |
394 | 134 | self.check_app_launch(Terminal, 2) | 137 | app = get_terminal_app(self.config_stack.get('unity8_mode')) |
395 | 138 | self.check_app_launch(app, 2) | ||
396 | 135 | 139 | ||
397 | 136 | def test_launch_webbrowser_app_twice(self): | 140 | def test_launch_webbrowser_app_twice(self): |
398 | 137 | self.check_app_launch(WebBrowser, 2) | 141 | self.check_app_launch(WebBrowser, 2) |
PASSED: Continuous integration, rev:523 /platform- qa-jenkins. ubuntu. com/job/ ubuntu- system- tests-ci/ 1189/ /platform- qa-jenkins. ubuntu. com/job/ generic- update- mp/2167/ console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /platform- qa-jenkins. ubuntu. com/job/ ubuntu- system- tests-ci/ 1189/rebuild
https:/