Merge ~chad.smith/curtin:ubuntu/devel into curtin:ubuntu/devel
- Git
- lp:~chad.smith/curtin
- ubuntu/devel
- Merge into ubuntu/devel
Proposed by
Chad Smith
Status: | Merged |
---|---|
Merged at revision: | cfa2da2bd7a47b5bd585d04f824be7e3c22ccd5e |
Proposed branch: | ~chad.smith/curtin:ubuntu/devel |
Merge into: | curtin:ubuntu/devel |
Diff against target: |
2225 lines (+662/-342) 51 files modified
bin/curtin (+1/-1) curtin/__main__.py (+4/-0) curtin/block/__init__.py (+14/-10) curtin/block/clear_holders.py (+24/-2) curtin/block/mkfs.py (+2/-2) curtin/commands/__main__.py (+4/-0) curtin/commands/curthooks.py (+3/-1) curtin/commands/features.py (+20/-0) curtin/commands/main.py (+3/-3) debian/changelog (+25/-0) doc/topics/integration-testing.rst (+4/-0) doc/topics/storage.rst (+79/-3) examples/tests/install_disable_unmount.yaml (+2/-2) examples/tests/mirrorboot-msdos-partition.yaml (+2/-2) examples/tests/mirrorboot-uefi.yaml (+4/-4) examples/tests/vmtest_pollinate.yaml (+10/-0) tests/unittests/test_clear_holders.py (+94/-38) tests/vmtests/__init__.py (+201/-73) tests/vmtests/releases.py (+19/-20) tests/vmtests/test_apt_config_cmd.py (+2/-2) tests/vmtests/test_basic.py (+20/-10) tests/vmtests/test_bcache_basic.py (+2/-2) tests/vmtests/test_bcache_bug1718699.py (+2/-2) tests/vmtests/test_fs_battery.py (+4/-0) tests/vmtests/test_iscsi.py (+2/-2) tests/vmtests/test_journald_reporter.py (+2/-2) tests/vmtests/test_lvm.py (+3/-2) tests/vmtests/test_lvm_iscsi.py (+2/-2) tests/vmtests/test_lvm_root.py (+5/-35) tests/vmtests/test_mdadm_bcache.py (+17/-21) tests/vmtests/test_mdadm_iscsi.py (+2/-2) tests/vmtests/test_multipath.py (+2/-2) tests/vmtests/test_network.py (+2/-2) tests/vmtests/test_network_alias.py (+2/-2) tests/vmtests/test_network_bonding.py (+15/-26) tests/vmtests/test_network_bridging.py (+18/-26) tests/vmtests/test_network_ipv6.py (+2/-2) tests/vmtests/test_network_ipv6_static.py (+2/-2) tests/vmtests/test_network_ipv6_vlan.py (+2/-2) tests/vmtests/test_network_mtu.py (+4/-12) tests/vmtests/test_network_static.py (+2/-2) tests/vmtests/test_network_static_routes.py (+2/-2) tests/vmtests/test_network_vlan.py (+3/-3) tests/vmtests/test_nvme.py (+5/-4) tests/vmtests/test_pollinate_useragent.py (+3/-0) tests/vmtests/test_raid5_bcache.py (+2/-2) tests/vmtests/test_simple.py (+2/-2) tests/vmtests/test_uefi_basic.py (+4/-4) tests/vmtests/test_zfsroot.py (+6/-2) tools/xkvm (+5/-1) tox.ini (+1/-1) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Server Team CI bot | continuous-integration | Approve | |
Scott Moser (community) | Approve | ||
Review via email: mp+352901@code.launchpad.net |
Commit message
Sync new-upstream-
Description of the change
To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote : | # |
PASSED: Continuous integration, rev:cfa2da2bd7a
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
review:
Approve
(continuous-integration)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/bin/curtin b/bin/curtin |
2 | index 6c4e457..793fbcb 100755 |
3 | --- a/bin/curtin |
4 | +++ b/bin/curtin |
5 | @@ -1,7 +1,7 @@ |
6 | #!/bin/sh |
7 | # This file is part of curtin. See LICENSE file for copyright and license info. |
8 | |
9 | -PY3OR2_MAIN="curtin.commands.main" |
10 | +PY3OR2_MAIN="curtin" |
11 | PY3OR2_MCHECK="curtin.deps.check" |
12 | PY3OR2_PYTHONS=${PY3OR2_PYTHONS:-"python3:python"} |
13 | PYTHON=${PY3OR2_PYTHON} |
14 | diff --git a/curtin/__main__.py b/curtin/__main__.py |
15 | new file mode 100644 |
16 | index 0000000..5b6aeca |
17 | --- /dev/null |
18 | +++ b/curtin/__main__.py |
19 | @@ -0,0 +1,4 @@ |
20 | +if __name__ == '__main__': |
21 | + from .commands.main import main |
22 | + import sys |
23 | + sys.exit(main()) |
24 | diff --git a/curtin/block/__init__.py b/curtin/block/__init__.py |
25 | index a8ee8a6..b49b9d3 100644 |
26 | --- a/curtin/block/__init__.py |
27 | +++ b/curtin/block/__init__.py |
28 | @@ -378,24 +378,28 @@ def stop_all_unused_multipath_devices(): |
29 | LOG.warn("Failed to stop multipath devices: %s", e) |
30 | |
31 | |
32 | -def rescan_block_devices(warn_on_fail=True): |
33 | +def rescan_block_devices(devices=None, warn_on_fail=True): |
34 | """ |
35 | run 'blockdev --rereadpt' for all block devices not currently mounted |
36 | """ |
37 | - unused = get_unused_blockdev_info() |
38 | - devices = [] |
39 | - for devname, data in unused.items(): |
40 | - if data.get('RM') == "1": |
41 | - continue |
42 | - if data.get('RO') != "0" or data.get('TYPE') != "disk": |
43 | - continue |
44 | - devices.append(data['device_path']) |
45 | + if not devices: |
46 | + unused = get_unused_blockdev_info() |
47 | + devices = [] |
48 | + for devname, data in unused.items(): |
49 | + if data.get('RM') == "1": |
50 | + continue |
51 | + if data.get('RO') != "0" or data.get('TYPE') != "disk": |
52 | + continue |
53 | + devices.append(data['device_path']) |
54 | |
55 | if not devices: |
56 | LOG.debug("no devices found to rescan") |
57 | return |
58 | |
59 | - cmd = ['blockdev', '--rereadpt'] + devices |
60 | + # blockdev needs /dev/ parameters, convert if needed |
61 | + cmd = ['blockdev', '--rereadpt'] + [dev if dev.startswith('/dev/') |
62 | + else sysfs_to_devpath(dev) |
63 | + for dev in devices] |
64 | try: |
65 | util.subp(cmd, capture=True) |
66 | except util.ProcessExecutionError as e: |
67 | diff --git a/curtin/block/clear_holders.py b/curtin/block/clear_holders.py |
68 | index 20c572b..9d73b28 100644 |
69 | --- a/curtin/block/clear_holders.py |
70 | +++ b/curtin/block/clear_holders.py |
71 | @@ -300,6 +300,9 @@ def wipe_superblock(device): |
72 | else: |
73 | raise e |
74 | |
75 | + # gather any partitions |
76 | + partitions = block.get_sysfs_partitions(device) |
77 | + |
78 | # release zfs member by exporting the pool |
79 | if block.is_zfs_member(blockdev): |
80 | poolname = zfs.device_to_poolname(blockdev) |
81 | @@ -325,6 +328,27 @@ def wipe_superblock(device): |
82 | |
83 | _wipe_superblock(blockdev) |
84 | |
85 | + # if we had partitions, make sure they've been removed |
86 | + if partitions: |
87 | + LOG.debug('%s had partitions, issuing partition reread', device) |
88 | + retries = [.5, .5, 1, 2, 5, 7] |
89 | + for attempt, wait in enumerate(retries): |
90 | + try: |
91 | + # only rereadpt on wiped device |
92 | + block.rescan_block_devices(devices=[blockdev]) |
93 | + # may raise IOError, OSError due to wiped partition table |
94 | + curparts = block.get_sysfs_partitions(device) |
95 | + if len(curparts) == 0: |
96 | + return |
97 | + except (IOError, OSError): |
98 | + if attempt + 1 >= len(retries): |
99 | + raise |
100 | + |
101 | + LOG.debug("%s partitions still present, rereading pt" |
102 | + " (%s/%s). sleeping %ss before retry", |
103 | + device, attempt + 1, len(retries), wait) |
104 | + time.sleep(wait) |
105 | + |
106 | |
107 | def _wipe_superblock(blockdev, exclusive=True): |
108 | """ No checks, just call wipe_volume """ |
109 | @@ -579,8 +603,6 @@ def clear_holders(base_paths, try_preserve=False): |
110 | dev_info['dev_type']) |
111 | continue |
112 | |
113 | - # scan before we check |
114 | - block.rescan_block_devices(warn_on_fail=False) |
115 | if os.path.exists(dev_info['device']): |
116 | LOG.info("shutdown running on holder type: '%s' syspath: '%s'", |
117 | dev_info['dev_type'], dev_info['device']) |
118 | diff --git a/curtin/block/mkfs.py b/curtin/block/mkfs.py |
119 | index a199d05..f39017c 100644 |
120 | --- a/curtin/block/mkfs.py |
121 | +++ b/curtin/block/mkfs.py |
122 | @@ -8,7 +8,7 @@ from curtin import block |
123 | |
124 | import string |
125 | import os |
126 | -from uuid import uuid1 |
127 | +from uuid import uuid4 |
128 | |
129 | mkfs_commands = { |
130 | "btrfs": "mkfs.btrfs", |
131 | @@ -191,7 +191,7 @@ def mkfs(path, fstype, strict=False, label=None, uuid=None, force=False): |
132 | |
133 | # If uuid is not specified, generate one and try to use it |
134 | if uuid is None: |
135 | - uuid = str(uuid1()) |
136 | + uuid = str(uuid4()) |
137 | cmd.extend(get_flag_mapping("uuid", fs_family, param=uuid, strict=strict)) |
138 | |
139 | if fs_family == "fat": |
140 | diff --git a/curtin/commands/__main__.py b/curtin/commands/__main__.py |
141 | new file mode 100644 |
142 | index 0000000..41c6d17 |
143 | --- /dev/null |
144 | +++ b/curtin/commands/__main__.py |
145 | @@ -0,0 +1,4 @@ |
146 | +if __name__ == '__main__': |
147 | + from .main import main |
148 | + import sys |
149 | + sys.exit(main()) |
150 | diff --git a/curtin/commands/curthooks.py b/curtin/commands/curthooks.py |
151 | index a514560..f9a5a66 100644 |
152 | --- a/curtin/commands/curthooks.py |
153 | +++ b/curtin/commands/curthooks.py |
154 | @@ -679,7 +679,9 @@ def install_missing_packages(cfg, target): |
155 | needed_packages.add(pkg) |
156 | |
157 | # Filter out ifupdown network packages on netplan enabled systems. |
158 | - if 'ifupdown' not in installed_packages and 'nplan' in installed_packages: |
159 | + has_netplan = ('nplan' in installed_packages or |
160 | + 'netplan.io' in installed_packages) |
161 | + if 'ifupdown' not in installed_packages and has_netplan: |
162 | drops = set(['bridge-utils', 'ifenslave', 'vlan']) |
163 | if needed_packages.union(drops): |
164 | LOG.debug("Skipping install of %s. Not needed on netplan system.", |
165 | diff --git a/curtin/commands/features.py b/curtin/commands/features.py |
166 | new file mode 100644 |
167 | index 0000000..0f6085b |
168 | --- /dev/null |
169 | +++ b/curtin/commands/features.py |
170 | @@ -0,0 +1,20 @@ |
171 | +# This file is part of curtin. See LICENSE file for copyright and license info. |
172 | +"""List the supported feature names to stdout.""" |
173 | + |
174 | +import sys |
175 | +from .. import FEATURES |
176 | +from . import populate_one_subcmd |
177 | + |
178 | +CMD_ARGUMENTS = ((tuple())) |
179 | + |
180 | + |
181 | +def features_main(args): |
182 | + sys.stdout.write("\n".join(sorted(FEATURES)) + "\n") |
183 | + sys.exit(0) |
184 | + |
185 | + |
186 | +def POPULATE_SUBCMD(parser): |
187 | + populate_one_subcmd(parser, CMD_ARGUMENTS, features_main) |
188 | + parser.description = __doc__ |
189 | + |
190 | +# vi: ts=4 expandtab syntax=python |
191 | diff --git a/curtin/commands/main.py b/curtin/commands/main.py |
192 | index 779bb03..bccfc51 100644 |
193 | --- a/curtin/commands/main.py |
194 | +++ b/curtin/commands/main.py |
195 | @@ -16,9 +16,9 @@ VERSIONSTR = version.version_string() |
196 | SUB_COMMAND_MODULES = [ |
197 | 'apply_net', 'apt-config', 'block-attach-iscsi', 'block-detach-iscsi', |
198 | 'block-info', 'block-meta', 'block-wipe', 'clear-holders', 'curthooks', |
199 | - 'collect-logs', 'extract', 'hook', 'install', 'mkfs', 'in-target', |
200 | - 'net-meta', 'pack', 'swap', 'system-install', 'system-upgrade', 'unmount', |
201 | - 'version', |
202 | + 'collect-logs', 'extract', 'features', |
203 | + 'hook', 'install', 'mkfs', 'in-target', 'net-meta', 'pack', 'swap', |
204 | + 'system-install', 'system-upgrade', 'unmount', 'version', |
205 | ] |
206 | |
207 | |
208 | diff --git a/debian/changelog b/debian/changelog |
209 | index dfd5560..8f013e6 100644 |
210 | --- a/debian/changelog |
211 | +++ b/debian/changelog |
212 | @@ -1,3 +1,28 @@ |
213 | +curtin (18.1-44-g2b12b8fc-0ubuntu1) cosmic; urgency=medium |
214 | + |
215 | + * New upstream snapshot. |
216 | + - Add main so that 'python3 -m curtin' does the right thing. |
217 | + - Add subcommand 'features'. |
218 | + - block: use uuid4 (random) when autogenerating UUIDS for filesystems |
219 | + - vmtests: Increase size of root filesystems. |
220 | + - clear-holders: reread ptable after wiping disks with partitions |
221 | + - vmtest: Skip proposed pocket on dev release when 'proposed' in ADD_REPOS. |
222 | + - tests: remove Ubuntu Artful [Joshua Powers] |
223 | + - vmtests: Let a raised SkipTest go through skip_by_date. |
224 | + - vmtests: Increase root fs to give upgrades to -proposed more space. |
225 | + - vmtest: Order the vmtest_pollinate late_command earlier. |
226 | + - vmtest: always add 'curtin/vmtest' to installed pollinate user_agent. |
227 | + - vmtests: make skip_by_date a decorator that runs and reports. |
228 | + - vmtests: always declare certain attributes and remove redundant tests. |
229 | + - vmtests: Add Cosmic release to tests [Joshua Powers] |
230 | + - vmtests: skip TrustyTestMdadmBcache until 2019-01-22. |
231 | + - tox: use simplestreams from git repository rather than bzr. |
232 | + - document that you can set ptable on raids [Michael Hudson-Doyle] |
233 | + - vmtests: move skip-by date of xfs root and xfs boot out 1 year. |
234 | + - vmtests: network_mtu move fixby date out 4 months from last value |
235 | + |
236 | + -- Chad Smith <chad.smith@canonical.com> Fri, 10 Aug 2018 09:22:12 -0600 |
237 | + |
238 | curtin (18.1-25-g9d0e557e-0ubuntu1) cosmic; urgency=medium |
239 | |
240 | * New upstream snapshot. |
241 | diff --git a/doc/topics/integration-testing.rst b/doc/topics/integration-testing.rst |
242 | index 7753068..6093b55 100644 |
243 | --- a/doc/topics/integration-testing.rst |
244 | +++ b/doc/topics/integration-testing.rst |
245 | @@ -314,6 +314,10 @@ Some environment variables affect the running of vmtest |
246 | setting (auto), then a upgrade will be done to make sure to include |
247 | any new packages. |
248 | |
249 | + The string 'proposed' is handled specially. It will enable the |
250 | + Ubuntu -proposed pocket for non-devel releases. If you wish to test |
251 | + the -proposed pocket for a devel release, use 'PROPOSED'. |
252 | + |
253 | - ``CURTIN_VMTEST_SYSTEM_UPGRADE``: default 'auto' |
254 | The default setting of 'auto' means to do a system upgrade if |
255 | there are additional repos added. To enable this explicitly, set |
256 | diff --git a/doc/topics/storage.rst b/doc/topics/storage.rst |
257 | index ca6253c..b28964b 100644 |
258 | --- a/doc/topics/storage.rst |
259 | +++ b/doc/topics/storage.rst |
260 | @@ -60,9 +60,9 @@ table. A disk command may contain all or some of the following keys: |
261 | |
262 | **ptable**: *msdos, gpt* |
263 | |
264 | -If the ``ptable`` key is present and a valid type of partition table, curtin |
265 | -will create an empty partition table of that type on the disk. At the moment, |
266 | -msdos and gpt partition tables are supported. |
267 | +If the ``ptable`` key is present and a curtin will create an empty |
268 | +partition table of that type on the disk. Curtin supports msdos and |
269 | +gpt partition tables. |
270 | |
271 | **serial**: *<serial number>* |
272 | |
273 | @@ -613,6 +613,11 @@ The ``spare_devices`` key specifies a list of the devices that will be used for |
274 | spares in the raid array. Each device must be referenced by ``id`` and the |
275 | device must be previously defined in the storage configuration. May be empty. |
276 | |
277 | +**ptable**: *msdos, gpt* |
278 | + |
279 | +To partition the array rather than mounting it directly, the |
280 | +``ptable`` key must be present and a valid type of partition table, |
281 | +i.e. msdos or gpt. |
282 | |
283 | **Config Example**:: |
284 | |
285 | @@ -801,6 +806,7 @@ Learn by examples. |
286 | - LVM |
287 | - Bcache |
288 | - RAID Boot |
289 | +- Partitioned RAID |
290 | - RAID5 + Bcache |
291 | - ZFS Root Simple |
292 | - ZFS Root |
293 | @@ -1045,6 +1051,76 @@ RAID Boot |
294 | path: / |
295 | device: md_root |
296 | |
297 | +Partitioned RAID |
298 | +~~~~~~~~~~~~~~~~ |
299 | + |
300 | +:: |
301 | + |
302 | + storage: |
303 | + config: |
304 | + - type: disk |
305 | + id: disk-0 |
306 | + ptable: gpt |
307 | + path: /dev/vda |
308 | + wipe: superblock |
309 | + grub_device: true |
310 | + - type: disk |
311 | + id: disk-1 |
312 | + path: /dev/vdb |
313 | + wipe: superblock |
314 | + - type: disk |
315 | + id: disk-2 |
316 | + path: /dev/vdc |
317 | + wipe: superblock |
318 | + - type: partition |
319 | + id: part-0 |
320 | + device: disk-0 |
321 | + size: 1048576 |
322 | + flag: bios_grub |
323 | + - type: partition |
324 | + id: part-1 |
325 | + device: disk-0 |
326 | + size: 21471690752 |
327 | + - id: raid-0 |
328 | + type: raid |
329 | + name: md0 |
330 | + raidlevel: 1 |
331 | + devices: [disk-2, disk-1] |
332 | + ptable: gpt |
333 | + - type: partition |
334 | + id: part-2 |
335 | + device: raid-0 |
336 | + size: 10737418240 |
337 | + - type: partition |
338 | + id: part-3 |
339 | + device: raid-0 |
340 | + size: 10735321088, |
341 | + - type: format |
342 | + id: fs-0 |
343 | + fstype: ext4 |
344 | + volume: part-1 |
345 | + - type: format |
346 | + id: fs-1 |
347 | + fstype: xfs |
348 | + volume: part-2 |
349 | + - type: format |
350 | + id: fs-2 |
351 | + fstype: ext4 |
352 | + volume: part-3 |
353 | + - type: mount |
354 | + id: mount-0 |
355 | + device: fs-0 |
356 | + path: / |
357 | + - type: mount |
358 | + id: mount-1 |
359 | + device: fs-1 |
360 | + path: /srv |
361 | + - type: mount |
362 | + id: mount-2 |
363 | + device: fs-2 |
364 | + path: /home |
365 | + version: 1 |
366 | + |
367 | |
368 | RAID5 + Bcache |
369 | ~~~~~~~~~~~~~~ |
370 | diff --git a/examples/tests/install_disable_unmount.yaml b/examples/tests/install_disable_unmount.yaml |
371 | index d3e583f..c0cd759 100644 |
372 | --- a/examples/tests/install_disable_unmount.yaml |
373 | +++ b/examples/tests/install_disable_unmount.yaml |
374 | @@ -14,5 +14,5 @@ post_cmds: |
375 | late_commands: |
376 | 01_get_proc_mounts: [sh, -c, *cat_proc_mounts] |
377 | 02_write_out_target: [sh, -c, *echo_target_mp] |
378 | - 03_unmount_target: [curtin, unmount] |
379 | - 04_get_proc_mounts: [cat, /proc/mounts] |
380 | + 99a_unmount_target: [curtin, unmount] |
381 | + 99b_get_proc_mounts: [cat, /proc/mounts] |
382 | diff --git a/examples/tests/mirrorboot-msdos-partition.yaml b/examples/tests/mirrorboot-msdos-partition.yaml |
383 | index 1a418fa..2b111a7 100644 |
384 | --- a/examples/tests/mirrorboot-msdos-partition.yaml |
385 | +++ b/examples/tests/mirrorboot-msdos-partition.yaml |
386 | @@ -47,7 +47,7 @@ storage: |
387 | name: md0-part1 |
388 | number: 1 |
389 | offset: 4194304B |
390 | - size: 2GB |
391 | + size: 3GB |
392 | type: partition |
393 | uuid: 4f4fa336-2762-48e4-ae54-9451141665cd |
394 | wipe: superblock |
395 | @@ -55,7 +55,7 @@ storage: |
396 | id: md0-part2 |
397 | name: md0-part2 |
398 | number: 2 |
399 | - size: 2GB |
400 | + size: 1.5GB |
401 | type: partition |
402 | uuid: c2d21fd3-3cde-4432-8eab-f08594bbe76e |
403 | wipe: superblock |
404 | diff --git a/examples/tests/mirrorboot-uefi.yaml b/examples/tests/mirrorboot-uefi.yaml |
405 | index e1f393f..ca55be9 100644 |
406 | --- a/examples/tests/mirrorboot-uefi.yaml |
407 | +++ b/examples/tests/mirrorboot-uefi.yaml |
408 | @@ -30,7 +30,7 @@ storage: |
409 | id: sda-part2 |
410 | name: sda-part2 |
411 | number: 2 |
412 | - size: 2G |
413 | + size: 3G |
414 | type: partition |
415 | uuid: 47c97eae-f35d-473f-8f3d-d64161d571f1 |
416 | wipe: superblock |
417 | @@ -38,7 +38,7 @@ storage: |
418 | id: sda-part3 |
419 | name: sda-part3 |
420 | number: 3 |
421 | - size: 2G |
422 | + size: 1G |
423 | type: partition |
424 | uuid: e3202633-841c-4936-a520-b18d1f7938ea |
425 | wipe: superblock |
426 | @@ -56,7 +56,7 @@ storage: |
427 | id: sdb-part2 |
428 | name: sdb-part2 |
429 | number: 2 |
430 | - size: 2G |
431 | + size: 3G |
432 | type: partition |
433 | uuid: a33a83dd-d1bf-4940-bf3e-6d931de85dbc |
434 | wipe: superblock |
435 | @@ -72,7 +72,7 @@ storage: |
436 | id: sdb-part3 |
437 | name: sdb-part3 |
438 | number: 3 |
439 | - size: 2G |
440 | + size: 1G |
441 | type: partition |
442 | uuid: 27e29758-fdcf-4c6a-8578-c92f907a8a9d |
443 | wipe: superblock |
444 | diff --git a/examples/tests/vmtest_pollinate.yaml b/examples/tests/vmtest_pollinate.yaml |
445 | new file mode 100644 |
446 | index 0000000..e4fac06 |
447 | --- /dev/null |
448 | +++ b/examples/tests/vmtest_pollinate.yaml |
449 | @@ -0,0 +1,10 @@ |
450 | +# this updates pollinate in the installed target to add a vmtest identifier. |
451 | +# specifically pollinate's user-agent should contain 'curtin/vmtest'. |
452 | +_vmtest_pollinate: |
453 | + - &pvmtest | |
454 | + cfg="/etc/pollinate/add-user-agent" |
455 | + [ -d "${cfg%/*}" ] || exit 0 |
456 | + echo curtin/vmtest >> "$cfg" |
457 | + |
458 | +late_commands: |
459 | + 01_vmtest_pollinate: ['curtin', 'in-target', '--', 'sh', '-c', *pvmtest] |
460 | diff --git a/tests/unittests/test_clear_holders.py b/tests/unittests/test_clear_holders.py |
461 | index ceb5615..6c29171 100644 |
462 | --- a/tests/unittests/test_clear_holders.py |
463 | +++ b/tests/unittests/test_clear_holders.py |
464 | @@ -10,7 +10,7 @@ from .helpers import CiTestCase |
465 | |
466 | |
467 | class TestClearHolders(CiTestCase): |
468 | - test_blockdev = '/dev/null' |
469 | + test_blockdev = '/wark/dev/null' |
470 | test_syspath = '/sys/class/block/null' |
471 | remove_retries = [0.2] * 150 # clear_holders defaults to 30 seconds |
472 | example_holders_trees = [ |
473 | @@ -153,7 +153,7 @@ class TestClearHolders(CiTestCase): |
474 | # |
475 | |
476 | device = self.test_syspath |
477 | - mock_block.sys_block_path.return_value = '/dev/null' |
478 | + mock_block.sys_block_path.return_value = self.test_blockdev |
479 | bcache_cset_uuid = 'c08ae789-a964-46fb-a66e-650f0ae78f94' |
480 | |
481 | mock_os.path.exists.return_value = True |
482 | @@ -189,9 +189,8 @@ class TestClearHolders(CiTestCase): |
483 | def test_shutdown_bcache_non_sysfs_device(self, mock_get_bcache, mock_log, |
484 | mock_os, mock_util, |
485 | mock_get_bcache_block): |
486 | - device = "/dev/fakenull" |
487 | with self.assertRaises(ValueError): |
488 | - clear_holders.shutdown_bcache(device) |
489 | + clear_holders.shutdown_bcache(self.test_blockdev) |
490 | |
491 | self.assertEqual(0, len(mock_get_bcache.call_args_list)) |
492 | self.assertEqual(0, len(mock_log.call_args_list)) |
493 | @@ -208,11 +207,10 @@ class TestClearHolders(CiTestCase): |
494 | def test_shutdown_bcache_no_device(self, mock_get_bcache, mock_log, |
495 | mock_os, mock_util, |
496 | mock_get_bcache_block, mock_block): |
497 | - device = "/sys/class/block/null" |
498 | - mock_block.sysfs_to_devpath.return_value = '/dev/null' |
499 | + mock_block.sysfs_to_devpath.return_value = self.test_blockdev |
500 | mock_os.path.exists.return_value = False |
501 | |
502 | - clear_holders.shutdown_bcache(device) |
503 | + clear_holders.shutdown_bcache(self.test_syspath) |
504 | |
505 | self.assertEqual(3, len(mock_log.info.call_args_list)) |
506 | self.assertEqual(1, len(mock_os.path.exists.call_args_list)) |
507 | @@ -229,18 +227,17 @@ class TestClearHolders(CiTestCase): |
508 | def test_shutdown_bcache_no_cset(self, mock_get_bcache, mock_log, |
509 | mock_os, mock_util, |
510 | mock_get_bcache_block, mock_block): |
511 | - device = "/sys/class/block/null" |
512 | - mock_block.sysfs_to_devpath.return_value = '/dev/null' |
513 | + mock_block.sysfs_to_devpath.return_value = self.test_blockdev |
514 | mock_os.path.exists.side_effect = iter([ |
515 | True, # backing device exists |
516 | False, # cset device not present (already removed) |
517 | True, # backing device (still) exists |
518 | ]) |
519 | mock_get_bcache.return_value = '/sys/fs/bcache/fake' |
520 | - mock_get_bcache_block.return_value = device + '/bcache' |
521 | + mock_get_bcache_block.return_value = self.test_syspath + '/bcache' |
522 | mock_os.path.join.side_effect = os.path.join |
523 | |
524 | - clear_holders.shutdown_bcache(device) |
525 | + clear_holders.shutdown_bcache(self.test_syspath) |
526 | |
527 | self.assertEqual(4, len(mock_log.info.call_args_list)) |
528 | self.assertEqual(3, len(mock_os.path.exists.call_args_list)) |
529 | @@ -249,14 +246,15 @@ class TestClearHolders(CiTestCase): |
530 | self.assertEqual(1, len(mock_util.write_file.call_args_list)) |
531 | self.assertEqual(2, len(mock_util.wait_for_removal.call_args_list)) |
532 | |
533 | - mock_get_bcache.assert_called_with(device, strict=False) |
534 | - mock_get_bcache_block.assert_called_with(device, strict=False) |
535 | - mock_util.write_file.assert_called_with(device + '/bcache/stop', |
536 | - '1', mode=None) |
537 | + mock_get_bcache.assert_called_with(self.test_syspath, strict=False) |
538 | + mock_get_bcache_block.assert_called_with(self.test_syspath, |
539 | + strict=False) |
540 | + mock_util.write_file.assert_called_with( |
541 | + self.test_syspath + '/bcache/stop', '1', mode=None) |
542 | retries = self.remove_retries |
543 | mock_util.wait_for_removal.assert_has_calls([ |
544 | - mock.call(device, retries=retries), |
545 | - mock.call(device + '/bcache', retries=retries)]) |
546 | + mock.call(self.test_syspath, retries=retries), |
547 | + mock.call(self.test_syspath + '/bcache', retries=retries)]) |
548 | |
549 | @mock.patch('curtin.block.clear_holders.block') |
550 | @mock.patch('curtin.block.clear_holders.udev.udevadm_settle') |
551 | @@ -271,8 +269,7 @@ class TestClearHolders(CiTestCase): |
552 | mock_get_bcache_block, |
553 | mock_udevadm_settle, |
554 | mock_block): |
555 | - device = "/sys/class/block/null" |
556 | - mock_block.sysfs_to_devpath.return_value = '/dev/null' |
557 | + mock_block.sysfs_to_devpath.return_value = self.test_blockdev |
558 | mock_os.path.exists.side_effect = iter([ |
559 | True, # backing device exists |
560 | True, # cset device not present (already removed) |
561 | @@ -280,10 +277,10 @@ class TestClearHolders(CiTestCase): |
562 | ]) |
563 | cset = '/sys/fs/bcache/fake' |
564 | mock_get_bcache.return_value = cset |
565 | - mock_get_bcache_block.return_value = device + '/bcache' |
566 | + mock_get_bcache_block.return_value = self.test_syspath + '/bcache' |
567 | mock_os.path.join.side_effect = os.path.join |
568 | |
569 | - clear_holders.shutdown_bcache(device) |
570 | + clear_holders.shutdown_bcache(self.test_syspath) |
571 | |
572 | self.assertEqual(4, len(mock_log.info.call_args_list)) |
573 | self.assertEqual(3, len(mock_os.path.exists.call_args_list)) |
574 | @@ -292,14 +289,15 @@ class TestClearHolders(CiTestCase): |
575 | self.assertEqual(2, len(mock_util.write_file.call_args_list)) |
576 | self.assertEqual(3, len(mock_util.wait_for_removal.call_args_list)) |
577 | |
578 | - mock_get_bcache.assert_called_with(device, strict=False) |
579 | - mock_get_bcache_block.assert_called_with(device, strict=False) |
580 | + mock_get_bcache.assert_called_with(self.test_syspath, strict=False) |
581 | + mock_get_bcache_block.assert_called_with(self.test_syspath, |
582 | + strict=False) |
583 | mock_util.write_file.assert_has_calls([ |
584 | mock.call(cset + '/stop', '1', mode=None), |
585 | - mock.call(device + '/bcache/stop', '1', mode=None)]) |
586 | + mock.call(self.test_syspath + '/bcache/stop', '1', mode=None)]) |
587 | mock_util.wait_for_removal.assert_has_calls([ |
588 | mock.call(cset, retries=self.remove_retries), |
589 | - mock.call(device, retries=self.remove_retries) |
590 | + mock.call(self.test_syspath, retries=self.remove_retries) |
591 | ]) |
592 | |
593 | @mock.patch('curtin.block.clear_holders.block') |
594 | @@ -315,8 +313,7 @@ class TestClearHolders(CiTestCase): |
595 | mock_get_bcache_block, |
596 | mock_udevadm_settle, |
597 | mock_block): |
598 | - device = "/sys/class/block/null" |
599 | - mock_block.sysfs_to_devpath.return_value = '/dev/null' |
600 | + mock_block.sysfs_to_devpath.return_value = self.test_blockdev |
601 | mock_os.path.exists.side_effect = iter([ |
602 | True, # backing device exists |
603 | True, # cset device not present (already removed) |
604 | @@ -324,10 +321,10 @@ class TestClearHolders(CiTestCase): |
605 | ]) |
606 | cset = '/sys/fs/bcache/fake' |
607 | mock_get_bcache.return_value = cset |
608 | - mock_get_bcache_block.return_value = device + '/bcache' |
609 | + mock_get_bcache_block.return_value = self.test_syspath + '/bcache' |
610 | mock_os.path.join.side_effect = os.path.join |
611 | |
612 | - clear_holders.shutdown_bcache(device) |
613 | + clear_holders.shutdown_bcache(self.test_syspath) |
614 | |
615 | self.assertEqual(4, len(mock_log.info.call_args_list)) |
616 | self.assertEqual(3, len(mock_os.path.exists.call_args_list)) |
617 | @@ -336,7 +333,7 @@ class TestClearHolders(CiTestCase): |
618 | self.assertEqual(1, len(mock_util.write_file.call_args_list)) |
619 | self.assertEqual(1, len(mock_util.wait_for_removal.call_args_list)) |
620 | |
621 | - mock_get_bcache.assert_called_with(device, strict=False) |
622 | + mock_get_bcache.assert_called_with(self.test_syspath, strict=False) |
623 | mock_util.write_file.assert_has_calls([ |
624 | mock.call(cset + '/stop', '1', mode=None), |
625 | ]) |
626 | @@ -361,8 +358,7 @@ class TestClearHolders(CiTestCase): |
627 | mock_wipe, |
628 | mock_block): |
629 | """Test writes sysfs write failures pass if file not present""" |
630 | - device = "/sys/class/block/null" |
631 | - mock_block.sysfs_to_devpath.return_value = '/dev/null' |
632 | + mock_block.sysfs_to_devpath.return_value = self.test_blockdev |
633 | mock_os.path.exists.side_effect = iter([ |
634 | True, # backing device exists |
635 | True, # cset device not present (already removed) |
636 | @@ -371,14 +367,14 @@ class TestClearHolders(CiTestCase): |
637 | ]) |
638 | cset = '/sys/fs/bcache/fake' |
639 | mock_get_bcache.return_value = cset |
640 | - mock_get_bcache_block.return_value = device + '/bcache' |
641 | + mock_get_bcache_block.return_value = self.test_syspath + '/bcache' |
642 | mock_os.path.join.side_effect = os.path.join |
643 | |
644 | # make writes to sysfs fail |
645 | mock_util.write_file.side_effect = IOError(errno.ENOENT, |
646 | "File not found") |
647 | |
648 | - clear_holders.shutdown_bcache(device) |
649 | + clear_holders.shutdown_bcache(self.test_syspath) |
650 | |
651 | self.assertEqual(4, len(mock_log.info.call_args_list)) |
652 | self.assertEqual(3, len(mock_os.path.exists.call_args_list)) |
653 | @@ -387,7 +383,7 @@ class TestClearHolders(CiTestCase): |
654 | self.assertEqual(1, len(mock_util.write_file.call_args_list)) |
655 | self.assertEqual(1, len(mock_util.wait_for_removal.call_args_list)) |
656 | |
657 | - mock_get_bcache.assert_called_with(device, strict=False) |
658 | + mock_get_bcache.assert_called_with(self.test_syspath, strict=False) |
659 | mock_util.write_file.assert_has_calls([ |
660 | mock.call(cset + '/stop', '1', mode=None), |
661 | ]) |
662 | @@ -528,10 +524,15 @@ class TestClearHolders(CiTestCase): |
663 | self.assertTrue(mock_log.debug.called) |
664 | self.assertTrue(mock_log.critical.called) |
665 | |
666 | + @mock.patch('curtin.block.clear_holders.is_swap_device') |
667 | + @mock.patch('curtin.block.clear_holders.os.path.exists') |
668 | @mock.patch('curtin.block.clear_holders.LOG') |
669 | @mock.patch('curtin.block.clear_holders.block') |
670 | - def test_clear_holders_wipe_superblock(self, mock_block, mock_log): |
671 | + def test_clear_holders_wipe_superblock(self, mock_block, mock_log, |
672 | + mock_os_path, mock_swap): |
673 | """test clear_holders.wipe_superblock handles errors right""" |
674 | + mock_swap.return_value = False |
675 | + mock_os_path.return_value = False |
676 | mock_block.sysfs_to_devpath.return_value = self.test_blockdev |
677 | mock_block.is_extended_partition.return_value = True |
678 | clear_holders.wipe_superblock(self.test_syspath) |
679 | @@ -543,12 +544,14 @@ class TestClearHolders(CiTestCase): |
680 | mock_block.wipe_volume.assert_called_with( |
681 | self.test_blockdev, exclusive=True, mode='superblock') |
682 | |
683 | + @mock.patch('curtin.block.clear_holders.is_swap_device') |
684 | @mock.patch('curtin.block.clear_holders.zfs') |
685 | @mock.patch('curtin.block.clear_holders.LOG') |
686 | @mock.patch('curtin.block.clear_holders.block') |
687 | def test_clear_holders_wipe_superblock_zfs(self, mock_block, mock_log, |
688 | - mock_zfs): |
689 | + mock_zfs, mock_swap): |
690 | """test clear_holders.wipe_superblock handles zfs member""" |
691 | + mock_swap.return_value = False |
692 | mock_block.sysfs_to_devpath.return_value = self.test_blockdev |
693 | mock_block.is_extended_partition.return_value = True |
694 | clear_holders.wipe_superblock(self.test_syspath) |
695 | @@ -563,6 +566,59 @@ class TestClearHolders(CiTestCase): |
696 | mock_block.wipe_volume.assert_called_with( |
697 | self.test_blockdev, exclusive=True, mode='superblock') |
698 | |
699 | + @mock.patch('curtin.block.clear_holders.is_swap_device') |
700 | + @mock.patch('curtin.block.clear_holders.time') |
701 | + @mock.patch('curtin.block.clear_holders.LOG') |
702 | + @mock.patch('curtin.block.clear_holders.block') |
703 | + def test_clear_holders_wipe_superblock_rereads_pt(self, mock_block, |
704 | + mock_log, m_time, |
705 | + mock_swap): |
706 | + """test clear_holders.wipe_superblock re-reads partition table""" |
707 | + mock_swap.return_value = False |
708 | + mock_block.sysfs_to_devpath.return_value = self.test_blockdev |
709 | + mock_block.is_extended_partition.return_value = False |
710 | + mock_block.is_zfs_member.return_value = False |
711 | + mock_block.get_sysfs_partitions.side_effect = iter([ |
712 | + ['p1', 'p2'], # has partitions before wipe |
713 | + ['p1', 'p2'], # still has partitions after wipe |
714 | + [], # partitions are now gone |
715 | + ]) |
716 | + clear_holders.wipe_superblock(self.test_syspath) |
717 | + mock_block.sysfs_to_devpath.assert_called_with(self.test_syspath) |
718 | + mock_block.wipe_volume.assert_called_with( |
719 | + self.test_blockdev, exclusive=True, mode='superblock') |
720 | + mock_block.get_sysfs_partitions.assert_has_calls( |
721 | + [mock.call(self.test_syspath)] * 3) |
722 | + mock_block.rescan_block_devices.assert_has_calls( |
723 | + [mock.call(devices=[self.test_blockdev])] * 2) |
724 | + |
725 | + @mock.patch('curtin.block.clear_holders.is_swap_device') |
726 | + @mock.patch('curtin.block.clear_holders.time') |
727 | + @mock.patch('curtin.block.clear_holders.LOG') |
728 | + @mock.patch('curtin.block.clear_holders.block') |
729 | + def test_clear_holders_wipe_superblock_rereads_pt_oserr(self, mock_block, |
730 | + mock_log, m_time, |
731 | + mock_swap): |
732 | + """test clear_holders.wipe_superblock re-reads ptable handles oserr""" |
733 | + mock_swap.return_value = False |
734 | + mock_block.sysfs_to_devpath.return_value = self.test_blockdev |
735 | + mock_block.is_extended_partition.return_value = False |
736 | + mock_block.is_zfs_member.return_value = False |
737 | + mock_block.get_sysfs_partitions.side_effect = iter([ |
738 | + ['p1', 'p2'], # has partitions before wipe |
739 | + OSError('No sysfs path for partition'), |
740 | + [], # partitions are now gone |
741 | + ]) |
742 | + clear_holders.wipe_superblock(self.test_syspath) |
743 | + mock_block.sysfs_to_devpath.assert_called_with(self.test_syspath) |
744 | + mock_block.wipe_volume.assert_called_with( |
745 | + self.test_blockdev, exclusive=True, mode='superblock') |
746 | + mock_block.get_sysfs_partitions.assert_has_calls( |
747 | + [mock.call(self.test_syspath)] * 3) |
748 | + mock_block.rescan_block_devices.assert_has_calls( |
749 | + [mock.call(devices=[self.test_blockdev])] * 2) |
750 | + self.assertEqual(1, m_time.sleep.call_count) |
751 | + |
752 | @mock.patch('curtin.block.clear_holders.LOG') |
753 | @mock.patch('curtin.block.clear_holders.block') |
754 | @mock.patch('curtin.block.clear_holders.os') |
755 | @@ -716,7 +772,7 @@ class TestClearHolders(CiTestCase): |
756 | def test_assert_clear(self, mock_gen_holders_tree, mock_syspath): |
757 | mock_gen_holders_tree.return_value = self.example_holders_trees[0][0] |
758 | mock_syspath.side_effect = lambda x: x |
759 | - device = '/dev/null' |
760 | + device = self.test_blockdev |
761 | with self.assertRaises(OSError): |
762 | clear_holders.assert_clear(device) |
763 | mock_gen_holders_tree.assert_called_with(device) |
764 | diff --git a/tests/vmtests/__init__.py b/tests/vmtests/__init__.py |
765 | index 0c3d17e..68b7442 100644 |
766 | --- a/tests/vmtests/__init__.py |
767 | +++ b/tests/vmtests/__init__.py |
768 | @@ -26,6 +26,7 @@ from .image_sync import query as imagesync_query |
769 | from .image_sync import mirror as imagesync_mirror |
770 | from .image_sync import (IMAGE_SRC_URL, IMAGE_DIR, ITEM_NAME_FILTERS) |
771 | from .helpers import check_call, TimeoutExpired, ip_a_to_dict |
772 | +from functools import wraps |
773 | from unittest import TestCase, SkipTest |
774 | |
775 | try: |
776 | @@ -55,6 +56,7 @@ SYSTEM_UPGRADE = os.environ.get("CURTIN_VMTEST_SYSTEM_UPGRADE", "auto") |
777 | |
778 | |
779 | _UNSUPPORTED_UBUNTU = None |
780 | +_DEVEL_UBUNTU = None |
781 | |
782 | _TOPDIR = None |
783 | |
784 | @@ -354,6 +356,7 @@ def skip_if_flag(flag): |
785 | def decorator(func): |
786 | """the name test_wrapper below has to start with test, or nose's |
787 | filter will not run it.""" |
788 | + @wraps(func) |
789 | def test_wrapper(self, *args, **kwargs): |
790 | val = getattr(self, flag, None) |
791 | if val: |
792 | @@ -364,6 +367,132 @@ def skip_if_flag(flag): |
793 | return decorator |
794 | |
795 | |
796 | +def skip_by_date(bugnum, fixby, removeby=None, skips=None, install=True): |
797 | + """A decorator to skip a test or test class based on current date. |
798 | + |
799 | + @param bugnum: A bug number with which to identify the action. |
800 | + @param fixby: string: A date string in the format of YYYY-MM-DD |
801 | + tuple (YYYY,MM,DD). Raises SkipTest with testcase results until |
802 | + the current date is >= fixby value. |
803 | + @param removeby: string: A date string in the format of YYYY-MM-DD |
804 | + or (YYYY,MM,DD). Raises RuntimeError with testcase results |
805 | + if current date is >= removeby value. |
806 | + Default value is 3 weeks past fixby value. |
807 | + @param skips: list of test cases (string method names) to be skipped. |
808 | + If None, all class testcases will be skipped per evaluation of |
809 | + fixby and removeby params. This is ignored when decorating a method. |
810 | + Example skips=["test_test1", "test_test2"] |
811 | + @param install: boolean: When True, setUpClass raises skipTest |
812 | + exception while "today" < "fixby" date. Useful for handling |
813 | + testcases where the install or boot would hang. |
814 | + install parameter is ignored when decorating a method.""" |
815 | + def as_dtdate(date): |
816 | + if not isinstance(date, str): |
817 | + return date |
818 | + return datetime.date(*map(int, date.split("-"))) |
819 | + |
820 | + def as_str(dtdate): |
821 | + return "%s-%02d-%02d" % (dtdate.year, dtdate.month, dtdate.day) |
822 | + |
823 | + d_today = datetime.date.today() |
824 | + d_fixby = as_dtdate(fixby) |
825 | + if removeby is None: |
826 | + # give 3 weeks by default. |
827 | + d_removeby = d_fixby + datetime.timedelta(21) |
828 | + else: |
829 | + d_removeby = as_dtdate(removeby) |
830 | + |
831 | + envname = 'CURTIN_VMTEST_SKIP_BY_DATE_BUGS' |
832 | + envval = os.environ.get(envname, "") |
833 | + skip_bugs = envval.replace(",", " ").split() |
834 | + _setUpClass = "setUpClass" |
835 | + |
836 | + def decorator(test): |
837 | + def decorate_callable(mycallable, classname=test.__name__): |
838 | + funcname = mycallable.__name__ |
839 | + name = '.'.join((classname, funcname)) |
840 | + bmsg = ("skip_by_date({name}) LP: #{bug} " |
841 | + "fixby={fixby} removeby={removeby}: ".format( |
842 | + name=name, bug=bugnum, |
843 | + fixby=as_str(d_fixby), removeby=as_str(d_removeby))) |
844 | + |
845 | + @wraps(mycallable) |
846 | + def wrapper(*args, **kwargs): |
847 | + skip_reason = None |
848 | + if "*" in skip_bugs or bugnum in skip_bugs: |
849 | + skip_reason = "skip per %s=%s" % (envname, envval) |
850 | + elif (funcname == _setUpClass and |
851 | + (not install and d_today < d_fixby)): |
852 | + skip_reason = "skip per install=%s" % install |
853 | + |
854 | + if skip_reason: |
855 | + logger.info(bmsg + skip_reason) |
856 | + raise SkipTest(bmsg + skip_reason) |
857 | + |
858 | + if d_today < d_fixby: |
859 | + tmsg = "NOT_YET_FIXBY" |
860 | + elif d_today > d_removeby: |
861 | + tmsg = "REMOVE_WORKAROUND" |
862 | + else: |
863 | + tmsg = "PAST_FIXBY" |
864 | + |
865 | + if funcname == _setUpClass: |
866 | + logger.info(bmsg + "Running test (%s)", tmsg) |
867 | + |
868 | + exc = None |
869 | + try: |
870 | + mycallable(*args, **kwargs) |
871 | + except SkipTest: |
872 | + raise |
873 | + except Exception as e: |
874 | + exc = e |
875 | + |
876 | + if exc is None: |
877 | + result = "Passed." |
878 | + elif isinstance(exc, SkipTest): |
879 | + result = "Skipped: %s" % exc |
880 | + else: |
881 | + result = "Failed: %s" % exc |
882 | + |
883 | + msg = (bmsg + "(%s)" % tmsg + " " + result) |
884 | + |
885 | + logger.info(msg) |
886 | + if d_today < d_fixby: |
887 | + if funcname != _setUpClass: |
888 | + raise SkipTest(msg) |
889 | + else: |
890 | + # Expected fixed. |
891 | + if d_today > d_removeby: |
892 | + raise RuntimeError(msg) |
893 | + elif exc: |
894 | + raise RuntimeError(msg) |
895 | + |
896 | + return wrapper |
897 | + |
898 | + def decorate_test_methods(klass): |
899 | + for attr in dir(klass): |
900 | + attr_value = getattr(klass, attr) |
901 | + if not hasattr(attr_value, "__call__"): |
902 | + continue |
903 | + |
904 | + if attr != _setUpClass: |
905 | + if not attr.startswith('test_'): |
906 | + continue |
907 | + elif not (skips is None or attr in skips): |
908 | + continue |
909 | + |
910 | + setattr(klass, attr, |
911 | + decorate_callable(attr_value, |
912 | + classname=klass.__name__)) |
913 | + return klass |
914 | + |
915 | + if isinstance(test, (type,)): |
916 | + return decorate_test_methods(klass=test) |
917 | + return decorate_callable(test) |
918 | + |
919 | + return decorator |
920 | + |
921 | + |
922 | class VMBaseClass(TestCase): |
923 | __test__ = False |
924 | expected_failure = False |
925 | @@ -450,8 +579,8 @@ class VMBaseClass(TestCase): |
926 | else: |
927 | target_img_verstr, target_ftypes = get_images( |
928 | IMAGE_SRC_URL, IMAGE_DIR, |
929 | - cls.target_distro if cls.target_distro else cls.distro, |
930 | - cls.target_release if cls.target_release else cls.release, |
931 | + cls.target_distro, |
932 | + cls.target_release, |
933 | cls.arch, subarch=cls.subarch if cls.subarch else None, |
934 | kflavor=cls.kflavor if cls.kflavor else None, |
935 | krel=cls.target_krel, sync=CURTIN_VMTEST_IMAGE_SYNC, |
936 | @@ -566,61 +695,6 @@ class VMBaseClass(TestCase): |
937 | return disks |
938 | |
939 | @classmethod |
940 | - def skip_by_date(cls, bugnum, fixby, removeby=None, |
941 | - release=None, name=None): |
942 | - """Raise SkipTest with bug message until 'fixby'. |
943 | - Raise RutimeError after removeby. |
944 | - fixby and removeby support string (2018-01-01) or tuple(2018,01,01) |
945 | - removeby defaults to 3 weeks after fixby. |
946 | - """ |
947 | - def as_dtdate(date): |
948 | - if not isinstance(date, str): |
949 | - return date |
950 | - return datetime.date(*map(int, date.split("-"))) |
951 | - |
952 | - def as_str(dtdate): |
953 | - return "%s-%02d-%02d" % (dtdate.year, dtdate.month, dtdate.day) |
954 | - |
955 | - if name is None: |
956 | - name = cls.__name__ |
957 | - |
958 | - if release is None: |
959 | - release = cls.release |
960 | - |
961 | - d_today = datetime.date.today() |
962 | - d_fixby = as_dtdate(fixby) |
963 | - if removeby is None: |
964 | - # give 3 weeks by default. |
965 | - d_removeby = d_fixby + datetime.timedelta(21) |
966 | - else: |
967 | - d_removeby = as_dtdate(removeby) |
968 | - |
969 | - bmsg = ("[{name}/{rel}] skip_by_date LP: #{bug} " |
970 | - "fixby={fixby} removeby={removeby}: ".format( |
971 | - name=name, rel=release, bug=bugnum, |
972 | - fixby=as_str(d_fixby), removeby=as_str(d_removeby))) |
973 | - |
974 | - envname = 'CURTIN_VMTEST_SKIP_BY_DATE_BUGS' |
975 | - envval = os.environ.get(envname, "") |
976 | - skip_bugs = envval.replace(",", " ").split() |
977 | - |
978 | - result = None |
979 | - msg = bmsg + "Not skipping." |
980 | - if "*" in skip_bugs or bugnum in skip_bugs: |
981 | - msg = bmsg + "skip per %s=%s" % (envname, envval) |
982 | - result = SkipTest |
983 | - elif d_today < d_fixby: |
984 | - msg = bmsg + "skip (today < fixby)" |
985 | - result = SkipTest |
986 | - elif d_today > d_removeby: |
987 | - msg = bmsg + "Remove workaround." |
988 | - result = RuntimeError |
989 | - |
990 | - logger.info(msg) |
991 | - if result: |
992 | - raise result(msg) |
993 | - |
994 | - @classmethod |
995 | def get_config_smp(cls): |
996 | """Get number of cpus to use for guest""" |
997 | |
998 | @@ -670,6 +744,12 @@ class VMBaseClass(TestCase): |
999 | return {'kernel': {'fallback-package': package}} |
1000 | |
1001 | @classmethod |
1002 | + def skip_by_date(cls, *args, **kwargs): |
1003 | + """skip_by_date wrapper. this way other modules do not have |
1004 | + to add an import of skip_by_date to start skipping.""" |
1005 | + return skip_by_date(*args, **kwargs) |
1006 | + |
1007 | + @classmethod |
1008 | def setUpClass(cls): |
1009 | # initialize global logger with class name to help make sense of |
1010 | # parallel vmtest runs which intermingle output. |
1011 | @@ -677,6 +757,13 @@ class VMBaseClass(TestCase): |
1012 | logger = _initialize_logging(name=cls.__name__) |
1013 | cls.logger = logger |
1014 | |
1015 | + req_attrs = ('target_distro', 'target_release', 'release', 'distro') |
1016 | + missing = [a for a in req_attrs if not getattr(cls, a)] |
1017 | + if missing: |
1018 | + raise ValueError( |
1019 | + "Class %s does not have required attrs set: %s" % |
1020 | + (cls.__name__, missing)) |
1021 | + |
1022 | if is_unsupported_ubuntu(cls.release): |
1023 | raise SkipTest('"%s" is unsupported release.' % cls.release) |
1024 | |
1025 | @@ -687,7 +774,14 @@ class VMBaseClass(TestCase): |
1026 | raise SkipTest(reason) |
1027 | |
1028 | setup_start = time.time() |
1029 | - logger.info('Starting setup for testclass: {}'.format(cls.__name__)) |
1030 | + logger.info( |
1031 | + ('Starting setup for testclass: {__name__} ' |
1032 | + '({distro}/{release} -> ' |
1033 | + '{target_distro}/{target_release})').format( |
1034 | + **{k: getattr(cls, k) |
1035 | + for k in ('__name__', 'distro', 'release', |
1036 | + 'target_distro', 'target_release')})) |
1037 | + |
1038 | # set up tempdir |
1039 | cls.td = TempDir( |
1040 | name=cls.__name__, |
1041 | @@ -823,7 +917,7 @@ class VMBaseClass(TestCase): |
1042 | disks.extend(cls.build_iscsi_disks()) |
1043 | |
1044 | # proxy config |
1045 | - configs = [cls.conf_file] |
1046 | + configs = [cls.conf_file, 'examples/tests/vmtest_pollinate.yaml'] |
1047 | cls.proxy = get_apt_proxy() |
1048 | if cls.proxy is not None and not cls.td.restored: |
1049 | proxy_config = os.path.join(cls.td.install, 'proxy.cfg') |
1050 | @@ -864,14 +958,19 @@ class VMBaseClass(TestCase): |
1051 | system_upgrade = SYSTEM_UPGRADE |
1052 | upgrade_packages = UPGRADE_PACKAGES |
1053 | if add_repos: |
1054 | - # enable if user has set a value here |
1055 | - if system_upgrade == "auto": |
1056 | - system_upgrade = True |
1057 | - logger.info('Adding apt repositories: %s', add_repos) |
1058 | - repo_cfg = os.path.join(cls.td.install, 'add_repos.cfg') |
1059 | - util.write_file(repo_cfg, |
1060 | - generate_repo_config(add_repos.split(","))) |
1061 | - configs.append(repo_cfg) |
1062 | + cfg_repos = generate_repo_config(add_repos.split(","), |
1063 | + release=cls.target_release) |
1064 | + if cfg_repos: |
1065 | + logger.info('Adding apt repositories: %s', add_repos) |
1066 | + # enable if user has set a value here |
1067 | + if system_upgrade == "auto": |
1068 | + system_upgrade = True |
1069 | + repo_cfg = os.path.join(cls.td.install, 'add_repos.cfg') |
1070 | + util.write_file(repo_cfg, cfg_repos) |
1071 | + configs.append(repo_cfg) |
1072 | + else: |
1073 | + logger.info("add_repos=%s processed to empty config.", |
1074 | + add_repos) |
1075 | elif system_upgrade == "auto": |
1076 | system_upgrade = False |
1077 | |
1078 | @@ -1146,7 +1245,7 @@ class VMBaseClass(TestCase): |
1079 | """Return install uri and a list of files needed to be published.""" |
1080 | # if release (install environment) is the same as target |
1081 | # target (thing to install) then install via cp:// |
1082 | - if cls.target_release in (None, cls.release): |
1083 | + if cls.target_release == cls.release: |
1084 | install_src = "cp:///media/root-ro" |
1085 | return install_src, [] |
1086 | |
1087 | @@ -1339,7 +1438,7 @@ class VMBaseClass(TestCase): |
1088 | |
1089 | @skip_if_flag('expected_failure') |
1090 | def test_dname(self, disk_to_check=None): |
1091 | - if "trusty" in [self.release, self.target_release]: |
1092 | + if self.target_release == "trusty": |
1093 | raise SkipTest( |
1094 | "(LP: #1523037): dname does not work on trusty kernels") |
1095 | |
1096 | @@ -1393,7 +1492,7 @@ class VMBaseClass(TestCase): |
1097 | def test_installed_correct_kernel_package(self): |
1098 | """ Test curtin installs the correct kernel package. """ |
1099 | # target_distro is set for non-ubuntu targets |
1100 | - if self.target_distro is not None: |
1101 | + if self.target_distro != "ubuntu": |
1102 | raise SkipTest("Can't check non-ubuntu kernel packages") |
1103 | |
1104 | kpackage = self.get_kernel_package() |
1105 | @@ -1849,7 +1948,25 @@ def is_unsupported_ubuntu(release): |
1106 | return release in _UNSUPPORTED_UBUNTU |
1107 | |
1108 | |
1109 | -def generate_repo_config(repos): |
1110 | +def is_devel_release(release): |
1111 | + global _DEVEL_UBUNTU |
1112 | + if _DEVEL_UBUNTU is None: |
1113 | + udi = 'ubuntu-distro-info' |
1114 | + env = os.environ.get('_DEVEL_UBUNTU') |
1115 | + if env: |
1116 | + # allow it to be , or " " separated. |
1117 | + _DEVEL_UBUNTU = env.replace(",", " ").split() |
1118 | + elif util.which(udi): |
1119 | + _DEVEL_UBUNTU = util.subp( |
1120 | + [udi, '--devel'], capture=True)[0].splitlines() |
1121 | + else: |
1122 | + # no way to tell. |
1123 | + _DEVEL_UBUNTU = [] |
1124 | + |
1125 | + return release in _DEVEL_UBUNTU |
1126 | + |
1127 | + |
1128 | +def generate_repo_config(repos, release=None): |
1129 | """Generate apt yaml configuration to add specified repositories. |
1130 | |
1131 | @param repos: A list of add-apt-repository strings. |
1132 | @@ -1857,8 +1974,19 @@ def generate_repo_config(repos): |
1133 | pocket of a particular release. |
1134 | @returns: string: A yaml string |
1135 | """ |
1136 | - sources = {"add_repos_%02d" % idx: {'source': v} |
1137 | - for idx, v in enumerate(repos)} |
1138 | + sources = {} |
1139 | + for idx, v in enumerate(repos): |
1140 | + if v == 'proposed' and is_devel_release(release): |
1141 | + # lower case 'proposed' is magically handled by apt repo |
1142 | + # processing. But dev release's -proposed is "known broken". |
1143 | + # if you want to test development release, then use 'PROPOSED'. |
1144 | + continue |
1145 | + if v == 'PROPOSED': |
1146 | + v = 'proposed' |
1147 | + sources['add_repos_%02d' % idx] = {'source': v} |
1148 | + if not sources: |
1149 | + return None |
1150 | + |
1151 | return yaml.dump({'apt': {'sources': sources}}) |
1152 | |
1153 | |
1154 | diff --git a/tests/vmtests/releases.py b/tests/vmtests/releases.py |
1155 | index 18a5e75..02cbfe5 100644 |
1156 | --- a/tests/vmtests/releases.py |
1157 | +++ b/tests/vmtests/releases.py |
1158 | @@ -11,6 +11,7 @@ class _ReleaseBase(object): |
1159 | class _UbuntuBase(_ReleaseBase): |
1160 | distro = "ubuntu" |
1161 | kflavor = "generic" |
1162 | + target_distro = "ubuntu" |
1163 | |
1164 | |
1165 | class _CentosFromUbuntuBase(_UbuntuBase): |
1166 | @@ -39,6 +40,7 @@ class _UbuntuCore16FromXenialBase(_UbuntuCoreUbuntuBase): |
1167 | release = "xenial" |
1168 | # release for target |
1169 | target_release = "ubuntu-core-16" |
1170 | + target_distro = "ubuntu-core" |
1171 | |
1172 | |
1173 | class _Centos66FromXenialBase(_CentosFromUbuntuBase): |
1174 | @@ -59,59 +61,56 @@ class _PreciseHWET(_PreciseBase): |
1175 | |
1176 | class _TrustyBase(_UbuntuBase): |
1177 | release = "trusty" |
1178 | + target_release = "trusty" |
1179 | |
1180 | |
1181 | -class _TrustyHWEU(_UbuntuBase): |
1182 | - release = "trusty" |
1183 | +class _TrustyHWEU(_TrustyBase): |
1184 | krel = "utopic" |
1185 | |
1186 | |
1187 | -class _TrustyHWEV(_UbuntuBase): |
1188 | - release = "trusty" |
1189 | +class _TrustyHWEV(_TrustyBase): |
1190 | krel = "vivid" |
1191 | |
1192 | |
1193 | -class _TrustyHWEW(_UbuntuBase): |
1194 | - release = "trusty" |
1195 | +class _TrustyHWEW(_TrustyBase): |
1196 | krel = "wily" |
1197 | |
1198 | |
1199 | -class _TrustyHWEX(_UbuntuBase): |
1200 | - release = "trusty" |
1201 | +class _TrustyHWEX(_TrustyBase): |
1202 | krel = "xenial" |
1203 | |
1204 | |
1205 | -class _TrustyFromXenial(_UbuntuBase): |
1206 | +class _TrustyFromXenial(_TrustyBase): |
1207 | release = "xenial" |
1208 | target_release = "trusty" |
1209 | |
1210 | |
1211 | class _XenialBase(_UbuntuBase): |
1212 | release = "xenial" |
1213 | + target_release = "xenial" |
1214 | subarch = "ga-16.04" |
1215 | |
1216 | |
1217 | -class _XenialGA(_UbuntuBase): |
1218 | - release = "xenial" |
1219 | +class _XenialGA(_XenialBase): |
1220 | subarch = "ga-16.04" |
1221 | |
1222 | |
1223 | -class _XenialHWE(_UbuntuBase): |
1224 | - release = "xenial" |
1225 | +class _XenialHWE(_XenialBase): |
1226 | subarch = "hwe-16.04" |
1227 | |
1228 | |
1229 | -class _XenialEdge(_UbuntuBase): |
1230 | - release = "xenial" |
1231 | +class _XenialEdge(_XenialBase): |
1232 | subarch = "hwe-16.04-edge" |
1233 | |
1234 | |
1235 | -class _ArtfulBase(_UbuntuBase): |
1236 | - release = "artful" |
1237 | - |
1238 | - |
1239 | class _BionicBase(_UbuntuBase): |
1240 | release = "bionic" |
1241 | + target_release = "bionic" |
1242 | + |
1243 | + |
1244 | +class _CosmicBase(_UbuntuBase): |
1245 | + release = "cosmic" |
1246 | + target_release = "cosmic" |
1247 | |
1248 | |
1249 | class _Releases(object): |
1250 | @@ -127,8 +126,8 @@ class _Releases(object): |
1251 | xenial_ga = _XenialGA |
1252 | xenial_hwe = _XenialHWE |
1253 | xenial_edge = _XenialEdge |
1254 | - artful = _ArtfulBase |
1255 | bionic = _BionicBase |
1256 | + cosmic = _CosmicBase |
1257 | |
1258 | |
1259 | class _CentosReleases(object): |
1260 | diff --git a/tests/vmtests/test_apt_config_cmd.py b/tests/vmtests/test_apt_config_cmd.py |
1261 | index 2c135c4..efd04f3 100644 |
1262 | --- a/tests/vmtests/test_apt_config_cmd.py |
1263 | +++ b/tests/vmtests/test_apt_config_cmd.py |
1264 | @@ -57,11 +57,11 @@ class XenialTestAptConfigCMDCMD(relbase.xenial, TestAptConfigCMD): |
1265 | __test__ = True |
1266 | |
1267 | |
1268 | -class ArtfulTestAptConfigCMDCMD(relbase.artful, TestAptConfigCMD): |
1269 | +class BionicTestAptConfigCMDCMD(relbase.bionic, TestAptConfigCMD): |
1270 | __test__ = True |
1271 | |
1272 | |
1273 | -class BionicTestAptConfigCMDCMD(relbase.bionic, TestAptConfigCMD): |
1274 | +class CosmicTestAptConfigCMDCMD(relbase.cosmic, TestAptConfigCMD): |
1275 | __test__ = True |
1276 | |
1277 | # vi: ts=4 expandtab syntax=python |
1278 | diff --git a/tests/vmtests/test_basic.py b/tests/vmtests/test_basic.py |
1279 | index 2e47cb6..01ffc89 100644 |
1280 | --- a/tests/vmtests/test_basic.py |
1281 | +++ b/tests/vmtests/test_basic.py |
1282 | @@ -23,8 +23,13 @@ class TestBasicAbs(VMBaseClass): |
1283 | blkid -o export /dev/vda > blkid_output_vda |
1284 | blkid -o export /dev/vda1 > blkid_output_vda1 |
1285 | blkid -o export /dev/vda2 > blkid_output_vda2 |
1286 | - f="btrfs_uuid_vdd" |
1287 | - btrfs-debug-tree -r /dev/vdd | awk '/^uuid/ {print $2}' | grep "-" > $f |
1288 | + dev="/dev/vdd"; f="btrfs_uuid_${dev#/dev/*}"; |
1289 | + if command -v btrfs-debug-tree >/dev/null; then |
1290 | + btrfs-debug-tree -r $dev | awk '/^uuid/ {print $2}' | grep "-" |
1291 | + else |
1292 | + btrfs inspect-internal dump-super $dev | |
1293 | + awk '/^dev_item.fsid/ {print $2}' |
1294 | + fi > $f |
1295 | cat /proc/partitions > proc_partitions |
1296 | ls -al /dev/disk/by-uuid/ > ls_uuid |
1297 | cat /etc/fstab > fstab |
1298 | @@ -60,7 +65,7 @@ class TestBasicAbs(VMBaseClass): |
1299 | "root/curtin-install.log", "root/curtin-install-cfg.yaml"]) |
1300 | |
1301 | def test_ptable(self, disk_to_check=None): |
1302 | - if "trusty" in [self.release, self.target_release]: |
1303 | + if self.target_release == "trusty": |
1304 | raise SkipTest("No PTTYPE blkid output on trusty") |
1305 | |
1306 | blkid_info = self.get_blkid_data("blkid_output_vda") |
1307 | @@ -169,11 +174,11 @@ class XenialEdgeTestBasic(relbase.xenial_edge, TestBasicAbs): |
1308 | __test__ = True |
1309 | |
1310 | |
1311 | -class ArtfulTestBasic(relbase.artful, TestBasicAbs): |
1312 | +class BionicTestBasic(relbase.bionic, TestBasicAbs): |
1313 | __test__ = True |
1314 | |
1315 | |
1316 | -class BionicTestBasic(relbase.bionic, TestBasicAbs): |
1317 | +class CosmicTestBasic(relbase.cosmic, TestBasicAbs): |
1318 | __test__ = True |
1319 | |
1320 | |
1321 | @@ -187,8 +192,13 @@ class TestBasicScsiAbs(TestBasicAbs): |
1322 | blkid -o export /dev/sda > blkid_output_sda |
1323 | blkid -o export /dev/sda1 > blkid_output_sda1 |
1324 | blkid -o export /dev/sda2 > blkid_output_sda2 |
1325 | - f="btrfs_uuid_sdc" |
1326 | - btrfs-debug-tree -r /dev/sdc | awk '/^uuid/ {print $2}' | grep "-" > $f |
1327 | + dev="/dev/sdc"; f="btrfs_uuid_${dev#/dev/*}"; |
1328 | + if command -v btrfs-debug-tree >/dev/null; then |
1329 | + btrfs-debug-tree -r $dev | awk '/^uuid/ {print $2}' | grep "-" |
1330 | + else |
1331 | + btrfs inspect-internal dump-super $dev | |
1332 | + awk '/^dev_item.fsid/ {print $2}' |
1333 | + fi > $f |
1334 | cat /proc/partitions > proc_partitions |
1335 | ls -al /dev/disk/by-uuid/ > ls_uuid |
1336 | ls -al /dev/disk/by-id/ > ls_disk_id |
1337 | @@ -210,7 +220,7 @@ class TestBasicScsiAbs(TestBasicAbs): |
1338 | "ls_disk_id", "proc_partitions"]) |
1339 | |
1340 | def test_ptable(self): |
1341 | - if "trusty" in [self.release, self.target_release]: |
1342 | + if self.target_release == "trusty": |
1343 | raise SkipTest("No PTTYPE blkid output on trusty") |
1344 | |
1345 | blkid_info = self.get_blkid_data("blkid_output_sda") |
1346 | @@ -289,11 +299,11 @@ class XenialEdgeTestScsiBasic(relbase.xenial_edge, TestBasicScsiAbs): |
1347 | __test__ = True |
1348 | |
1349 | |
1350 | -class ArtfulTestScsiBasic(relbase.artful, TestBasicScsiAbs): |
1351 | +class BionicTestScsiBasic(relbase.bionic, TestBasicScsiAbs): |
1352 | __test__ = True |
1353 | |
1354 | |
1355 | -class BionicTestScsiBasic(relbase.bionic, TestBasicScsiAbs): |
1356 | +class CosmicTestScsiBasic(relbase.cosmic, TestBasicScsiAbs): |
1357 | __test__ = True |
1358 | |
1359 | # vi: ts=4 expandtab syntax=python |
1360 | diff --git a/tests/vmtests/test_bcache_basic.py b/tests/vmtests/test_bcache_basic.py |
1361 | index 1844bc6..4989c8e 100644 |
1362 | --- a/tests/vmtests/test_bcache_basic.py |
1363 | +++ b/tests/vmtests/test_bcache_basic.py |
1364 | @@ -65,11 +65,11 @@ class XenialEdgeBcacheBasic(relbase.xenial_edge, TestBcacheBasic): |
1365 | __test__ = True |
1366 | |
1367 | |
1368 | -class ArtfulBcacheBasic(relbase.artful, TestBcacheBasic): |
1369 | +class BionicBcacheBasic(relbase.bionic, TestBcacheBasic): |
1370 | __test__ = True |
1371 | |
1372 | |
1373 | -class BionicBcacheBasic(relbase.bionic, TestBcacheBasic): |
1374 | +class CosmicBcacheBasic(relbase.cosmic, TestBcacheBasic): |
1375 | __test__ = True |
1376 | |
1377 | # vi: ts=4 expandtab syntax=python |
1378 | diff --git a/tests/vmtests/test_bcache_bug1718699.py b/tests/vmtests/test_bcache_bug1718699.py |
1379 | index bb1b32f..bc0f1e0 100644 |
1380 | --- a/tests/vmtests/test_bcache_bug1718699.py |
1381 | +++ b/tests/vmtests/test_bcache_bug1718699.py |
1382 | @@ -15,11 +15,11 @@ class XenialTestBcacheBug1718699(relbase.xenial, TestBcacheBug1718699): |
1383 | __test__ = True |
1384 | |
1385 | |
1386 | -class ArtfulTestBcacheBug1718699(relbase.artful, TestBcacheBug1718699): |
1387 | +class BionicTestBcacheBug1718699(relbase.bionic, TestBcacheBug1718699): |
1388 | __test__ = True |
1389 | |
1390 | |
1391 | -class BionicTestBcacheBug1718699(relbase.bionic, TestBcacheBug1718699): |
1392 | +class CosmicTestBcacheBug1718699(relbase.cosmic, TestBcacheBug1718699): |
1393 | __test__ = True |
1394 | |
1395 | # vi: ts=4 expandtab syntax=python |
1396 | diff --git a/tests/vmtests/test_fs_battery.py b/tests/vmtests/test_fs_battery.py |
1397 | index 423cc1e..3e41717 100644 |
1398 | --- a/tests/vmtests/test_fs_battery.py |
1399 | +++ b/tests/vmtests/test_fs_battery.py |
1400 | @@ -225,4 +225,8 @@ class BionicTestFsBattery(relbase.bionic, TestFsBattery): |
1401 | __test__ = True |
1402 | |
1403 | |
1404 | +class CosmicTestFsBattery(relbase.cosmic, TestFsBattery): |
1405 | + __test__ = True |
1406 | + |
1407 | + |
1408 | # vi: ts=4 expandtab syntax=python |
1409 | diff --git a/tests/vmtests/test_iscsi.py b/tests/vmtests/test_iscsi.py |
1410 | index bddd78c..1ac9660 100644 |
1411 | --- a/tests/vmtests/test_iscsi.py |
1412 | +++ b/tests/vmtests/test_iscsi.py |
1413 | @@ -65,11 +65,11 @@ class XenialEdgeTestIscsiBasic(relbase.xenial_edge, TestBasicIscsiAbs): |
1414 | __test__ = True |
1415 | |
1416 | |
1417 | -class ArtfulTestIscsiBasic(relbase.artful, TestBasicIscsiAbs): |
1418 | +class BionicTestIscsiBasic(relbase.bionic, TestBasicIscsiAbs): |
1419 | __test__ = True |
1420 | |
1421 | |
1422 | -class BionicTestIscsiBasic(relbase.bionic, TestBasicIscsiAbs): |
1423 | +class CosmicTestIscsiBasic(relbase.cosmic, TestBasicIscsiAbs): |
1424 | __test__ = True |
1425 | |
1426 | # vi: ts=4 expandtab syntax=python |
1427 | diff --git a/tests/vmtests/test_journald_reporter.py b/tests/vmtests/test_journald_reporter.py |
1428 | index 35ece6d..ad34d52 100644 |
1429 | --- a/tests/vmtests/test_journald_reporter.py |
1430 | +++ b/tests/vmtests/test_journald_reporter.py |
1431 | @@ -35,11 +35,11 @@ class XenialTestJournaldReporter(relbase.xenial, TestJournaldReporter): |
1432 | __test__ = True |
1433 | |
1434 | |
1435 | -class ArtfulTestJournaldReporter(relbase.artful, TestJournaldReporter): |
1436 | +class BionicTestJournaldReporter(relbase.bionic, TestJournaldReporter): |
1437 | __test__ = True |
1438 | |
1439 | |
1440 | -class BionicTestJournaldReporter(relbase.bionic, TestJournaldReporter): |
1441 | +class CosmicTestJournaldReporter(relbase.cosmic, TestJournaldReporter): |
1442 | __test__ = True |
1443 | |
1444 | # vi: ts=4 expandtab syntax=python |
1445 | diff --git a/tests/vmtests/test_lvm.py b/tests/vmtests/test_lvm.py |
1446 | index ed708fd..8972ae4 100644 |
1447 | --- a/tests/vmtests/test_lvm.py |
1448 | +++ b/tests/vmtests/test_lvm.py |
1449 | @@ -66,11 +66,12 @@ class XenialEdgeTestLvm(relbase.xenial_edge, TestLvmAbs): |
1450 | __test__ = True |
1451 | |
1452 | |
1453 | -class ArtfulTestLvm(relbase.artful, TestLvmAbs): |
1454 | +class BionicTestLvm(relbase.bionic, TestLvmAbs): |
1455 | __test__ = True |
1456 | |
1457 | |
1458 | -class BionicTestLvm(relbase.bionic, TestLvmAbs): |
1459 | +class CosmicTestLvm(relbase.cosmic, TestLvmAbs): |
1460 | __test__ = True |
1461 | |
1462 | + |
1463 | # vi: ts=4 expandtab syntax=python |
1464 | diff --git a/tests/vmtests/test_lvm_iscsi.py b/tests/vmtests/test_lvm_iscsi.py |
1465 | index 2a11d6e..cb5f33c 100644 |
1466 | --- a/tests/vmtests/test_lvm_iscsi.py |
1467 | +++ b/tests/vmtests/test_lvm_iscsi.py |
1468 | @@ -75,11 +75,11 @@ class XenialEdgeTestIscsiLvm(relbase.xenial_edge, TestLvmIscsiAbs): |
1469 | __test__ = True |
1470 | |
1471 | |
1472 | -class ArtfulTestIscsiLvm(relbase.artful, TestLvmIscsiAbs): |
1473 | +class BionicTestIscsiLvm(relbase.bionic, TestLvmIscsiAbs): |
1474 | __test__ = True |
1475 | |
1476 | |
1477 | -class BionicTestIscsiLvm(relbase.bionic, TestLvmIscsiAbs): |
1478 | +class CosmicTestIscsiLvm(relbase.cosmic, TestLvmIscsiAbs): |
1479 | __test__ = True |
1480 | |
1481 | # vi: ts=4 expandtab syntax=python |
1482 | diff --git a/tests/vmtests/test_lvm_root.py b/tests/vmtests/test_lvm_root.py |
1483 | index 24ecb41..8ca69d4 100644 |
1484 | --- a/tests/vmtests/test_lvm_root.py |
1485 | +++ b/tests/vmtests/test_lvm_root.py |
1486 | @@ -92,20 +92,6 @@ class XenialTestLvmRootXfs(relbase.xenial, TestLvmRootAbs): |
1487 | } |
1488 | |
1489 | |
1490 | -class ArtfulTestLvmRootExt4(relbase.artful, TestLvmRootAbs): |
1491 | - __test__ = True |
1492 | - conf_replace = { |
1493 | - '__ROOTFS_FORMAT__': 'ext4', |
1494 | - } |
1495 | - |
1496 | - |
1497 | -class ArtfulTestLvmRootXfs(relbase.artful, TestLvmRootAbs): |
1498 | - __test__ = True |
1499 | - conf_replace = { |
1500 | - '__ROOTFS_FORMAT__': 'xfs', |
1501 | - } |
1502 | - |
1503 | - |
1504 | class TestUefiLvmRootAbs(TestLvmRootAbs): |
1505 | conf_file = "examples/tests/uefi_lvmroot.yaml" |
1506 | uefi = True |
1507 | @@ -127,31 +113,15 @@ class XenialTestUefiLvmRootXfs(relbase.xenial, TestUefiLvmRootAbs): |
1508 | } |
1509 | |
1510 | |
1511 | +@VMBaseClass.skip_by_date("1652822", fixby="2019-06-01") |
1512 | class XenialTestUefiLvmRootXfsBootXfs(relbase.xenial, TestUefiLvmRootAbs): |
1513 | - __test__ = True |
1514 | - conf_replace = { |
1515 | - '__BOOTFS_FORMAT__': 'xfs', # Expected to fail until LP: #1652822 |
1516 | - '__ROOTFS_FORMAT__': 'xfs', |
1517 | - } |
1518 | - |
1519 | - @classmethod |
1520 | - def setUpClass(cls): |
1521 | - cls.skip_by_date("1652822", fixby="2018-05-26") |
1522 | - super().setUpClass() |
1523 | + """This tests xfs root and xfs boot with uefi. |
1524 | |
1525 | - |
1526 | -class ArtfulTestUefiLvmRootExt4(relbase.artful, TestUefiLvmRootAbs): |
1527 | + It is known broken (LP: #1652822) and unlikely to be fixed without pushing, |
1528 | + so we skip-by for a long time.""" |
1529 | __test__ = True |
1530 | conf_replace = { |
1531 | - '__BOOTFS_FORMAT__': 'ext4', |
1532 | - '__ROOTFS_FORMAT__': 'ext4', |
1533 | - } |
1534 | - |
1535 | - |
1536 | -class ArtfulTestUefiLvmRootXfs(relbase.artful, TestUefiLvmRootAbs): |
1537 | - __test__ = True |
1538 | - conf_replace = { |
1539 | - '__BOOTFS_FORMAT__': 'ext4', |
1540 | + '__BOOTFS_FORMAT__': 'xfs', |
1541 | '__ROOTFS_FORMAT__': 'xfs', |
1542 | } |
1543 | |
1544 | diff --git a/tests/vmtests/test_mdadm_bcache.py b/tests/vmtests/test_mdadm_bcache.py |
1545 | index 49d4782..21cf45f 100644 |
1546 | --- a/tests/vmtests/test_mdadm_bcache.py |
1547 | +++ b/tests/vmtests/test_mdadm_bcache.py |
1548 | @@ -129,14 +129,10 @@ class TestMdadmBcacheAbs(TestMdadmAbs): |
1549 | self.test_dname(disk_to_check=self.bcache_dnames) |
1550 | |
1551 | |
1552 | +@VMBaseClass.skip_by_date("1754581", fixby="2019-01-22", install=False) |
1553 | class TrustyTestMdadmBcache(relbase.trusty, TestMdadmBcacheAbs): |
1554 | __test__ = True |
1555 | |
1556 | - @classmethod |
1557 | - def setUpClass(cls): |
1558 | - cls.skip_by_date("1754581", fixby="2018-06-22") |
1559 | - super().setUpClass() |
1560 | - |
1561 | |
1562 | class TrustyHWEXTestMdadmBcache(relbase.trusty_hwe_x, TestMdadmBcacheAbs): |
1563 | __test__ = True |
1564 | @@ -154,11 +150,11 @@ class XenialEdgeTestMdadmBcache(relbase.xenial_edge, TestMdadmBcacheAbs): |
1565 | __test__ = True |
1566 | |
1567 | |
1568 | -class ArtfulTestMdadmBcache(relbase.artful, TestMdadmBcacheAbs): |
1569 | +class BionicTestMdadmBcache(relbase.bionic, TestMdadmBcacheAbs): |
1570 | __test__ = True |
1571 | |
1572 | |
1573 | -class BionicTestMdadmBcache(relbase.bionic, TestMdadmBcacheAbs): |
1574 | +class CosmicTestMdadmBcache(relbase.cosmic, TestMdadmBcacheAbs): |
1575 | __test__ = True |
1576 | |
1577 | |
1578 | @@ -194,11 +190,11 @@ class XenialEdgeTestMirrorboot(relbase.xenial_edge, TestMirrorbootAbs): |
1579 | __test__ = True |
1580 | |
1581 | |
1582 | -class ArtfulTestMirrorboot(relbase.artful, TestMirrorbootAbs): |
1583 | +class BionicTestMirrorboot(relbase.bionic, TestMirrorbootAbs): |
1584 | __test__ = True |
1585 | |
1586 | |
1587 | -class BionicTestMirrorboot(relbase.bionic, TestMirrorbootAbs): |
1588 | +class CosmicTestMirrorboot(relbase.cosmic, TestMirrorbootAbs): |
1589 | __test__ = True |
1590 | |
1591 | |
1592 | @@ -238,12 +234,12 @@ class XenialEdgeTestMirrorbootPartitions(relbase.xenial_edge, |
1593 | __test__ = True |
1594 | |
1595 | |
1596 | -class ArtfulTestMirrorbootPartitions(relbase.artful, |
1597 | +class BionicTestMirrorbootPartitions(relbase.bionic, |
1598 | TestMirrorbootPartitionsAbs): |
1599 | __test__ = True |
1600 | |
1601 | |
1602 | -class BionicTestMirrorbootPartitions(relbase.bionic, |
1603 | +class CosmicTestMirrorbootPartitions(relbase.cosmic, |
1604 | TestMirrorbootPartitionsAbs): |
1605 | __test__ = True |
1606 | |
1607 | @@ -283,12 +279,12 @@ class XenialEdgeTestMirrorbootPartitionsUEFI(relbase.xenial_edge, |
1608 | __test__ = True |
1609 | |
1610 | |
1611 | -class ArtfulTestMirrorbootPartitionsUEFI(relbase.artful, |
1612 | +class BionicTestMirrorbootPartitionsUEFI(relbase.bionic, |
1613 | TestMirrorbootPartitionsUEFIAbs): |
1614 | __test__ = True |
1615 | |
1616 | |
1617 | -class BionicTestMirrorbootPartitionsUEFI(relbase.bionic, |
1618 | +class CosmicTestMirrorbootPartitionsUEFI(relbase.cosmic, |
1619 | TestMirrorbootPartitionsUEFIAbs): |
1620 | __test__ = True |
1621 | |
1622 | @@ -326,11 +322,11 @@ class XenialEdgeTestRaid5boot(relbase.xenial_edge, TestRaid5bootAbs): |
1623 | __test__ = True |
1624 | |
1625 | |
1626 | -class ArtfulTestRaid5boot(relbase.artful, TestRaid5bootAbs): |
1627 | +class BionicTestRaid5boot(relbase.bionic, TestRaid5bootAbs): |
1628 | __test__ = True |
1629 | |
1630 | |
1631 | -class BionicTestRaid5boot(relbase.bionic, TestRaid5bootAbs): |
1632 | +class CosmicTestRaid5boot(relbase.cosmic, TestRaid5bootAbs): |
1633 | __test__ = True |
1634 | |
1635 | |
1636 | @@ -379,11 +375,11 @@ class XenialEdgeTestRaid6boot(relbase.xenial_edge, TestRaid6bootAbs): |
1637 | __test__ = True |
1638 | |
1639 | |
1640 | -class ArtfulTestRaid6boot(relbase.artful, TestRaid6bootAbs): |
1641 | +class BionicTestRaid6boot(relbase.bionic, TestRaid6bootAbs): |
1642 | __test__ = True |
1643 | |
1644 | |
1645 | -class BionicTestRaid6boot(relbase.bionic, TestRaid6bootAbs): |
1646 | +class CosmicTestRaid6boot(relbase.cosmic, TestRaid6bootAbs): |
1647 | __test__ = True |
1648 | |
1649 | |
1650 | @@ -420,11 +416,11 @@ class XenialEdgeTestRaid10boot(relbase.xenial_edge, TestRaid10bootAbs): |
1651 | __test__ = True |
1652 | |
1653 | |
1654 | -class ArtfulTestRaid10boot(relbase.artful, TestRaid10bootAbs): |
1655 | +class BionicTestRaid10boot(relbase.bionic, TestRaid10bootAbs): |
1656 | __test__ = True |
1657 | |
1658 | |
1659 | -class BionicTestRaid10boot(relbase.bionic, TestRaid10bootAbs): |
1660 | +class CosmicTestRaid10boot(relbase.cosmic, TestRaid10bootAbs): |
1661 | __test__ = True |
1662 | |
1663 | |
1664 | @@ -521,11 +517,11 @@ class XenialEdgeTestAllindata(relbase.xenial_edge, TestAllindataAbs): |
1665 | __test__ = True |
1666 | |
1667 | |
1668 | -class ArtfulTestAllindata(relbase.artful, TestAllindataAbs): |
1669 | +class BionicTestAllindata(relbase.bionic, TestAllindataAbs): |
1670 | __test__ = True |
1671 | |
1672 | |
1673 | -class BionicTestAllindata(relbase.bionic, TestAllindataAbs): |
1674 | +class CosmicTestAllindata(relbase.cosmic, TestAllindataAbs): |
1675 | __test__ = True |
1676 | |
1677 | # vi: ts=4 expandtab syntax=python |
1678 | diff --git a/tests/vmtests/test_mdadm_iscsi.py b/tests/vmtests/test_mdadm_iscsi.py |
1679 | index 3c8e6ef..eba200a 100644 |
1680 | --- a/tests/vmtests/test_mdadm_iscsi.py |
1681 | +++ b/tests/vmtests/test_mdadm_iscsi.py |
1682 | @@ -41,11 +41,11 @@ class XenialEdgeTestIscsiMdadm(relbase.xenial_edge, TestMdadmIscsiAbs): |
1683 | __test__ = True |
1684 | |
1685 | |
1686 | -class ArtfulTestIscsiMdadm(relbase.artful, TestMdadmIscsiAbs): |
1687 | +class BionicTestIscsiMdadm(relbase.bionic, TestMdadmIscsiAbs): |
1688 | __test__ = True |
1689 | |
1690 | |
1691 | -class BionicTestIscsiMdadm(relbase.bionic, TestMdadmIscsiAbs): |
1692 | +class CosmicTestIscsiMdadm(relbase.cosmic, TestMdadmIscsiAbs): |
1693 | __test__ = True |
1694 | |
1695 | # vi: ts=4 expandtab syntax=python |
1696 | diff --git a/tests/vmtests/test_multipath.py b/tests/vmtests/test_multipath.py |
1697 | index ffb78b8..0bf63b7 100644 |
1698 | --- a/tests/vmtests/test_multipath.py |
1699 | +++ b/tests/vmtests/test_multipath.py |
1700 | @@ -66,11 +66,11 @@ class XenialEdgeTestMultipathBasic(relbase.xenial_edge, TestMultipathBasicAbs): |
1701 | __test__ = True |
1702 | |
1703 | |
1704 | -class ArtfulTestMultipathBasic(relbase.artful, TestMultipathBasicAbs): |
1705 | +class BionicTestMultipathBasic(relbase.bionic, TestMultipathBasicAbs): |
1706 | __test__ = True |
1707 | |
1708 | |
1709 | -class BionicTestMultipathBasic(relbase.bionic, TestMultipathBasicAbs): |
1710 | +class CosmicTestMultipathBasic(relbase.cosmic, TestMultipathBasicAbs): |
1711 | __test__ = True |
1712 | |
1713 | # vi: ts=4 expandtab syntax=python |
1714 | diff --git a/tests/vmtests/test_network.py b/tests/vmtests/test_network.py |
1715 | index 59a25fe..6532841 100644 |
1716 | --- a/tests/vmtests/test_network.py |
1717 | +++ b/tests/vmtests/test_network.py |
1718 | @@ -480,11 +480,11 @@ class XenialTestNetworkBasic(relbase.xenial, TestNetworkBasicAbs): |
1719 | __test__ = True |
1720 | |
1721 | |
1722 | -class ArtfulTestNetworkBasic(relbase.artful, TestNetworkBasicAbs): |
1723 | +class BionicTestNetworkBasic(relbase.bionic, TestNetworkBasicAbs): |
1724 | __test__ = True |
1725 | |
1726 | |
1727 | -class BionicTestNetworkBasic(relbase.bionic, TestNetworkBasicAbs): |
1728 | +class CosmicTestNetworkBasic(relbase.cosmic, TestNetworkBasicAbs): |
1729 | __test__ = True |
1730 | |
1731 | |
1732 | diff --git a/tests/vmtests/test_network_alias.py b/tests/vmtests/test_network_alias.py |
1733 | index 903b395..d466299 100644 |
1734 | --- a/tests/vmtests/test_network_alias.py |
1735 | +++ b/tests/vmtests/test_network_alias.py |
1736 | @@ -69,11 +69,11 @@ class XenialTestNetworkAlias(relbase.xenial, TestNetworkAliasAbs): |
1737 | __test__ = True |
1738 | |
1739 | |
1740 | -class ArtfulTestNetworkAlias(relbase.artful, TestNetworkAliasAbs): |
1741 | +class BionicTestNetworkAlias(relbase.bionic, TestNetworkAliasAbs): |
1742 | __test__ = True |
1743 | |
1744 | |
1745 | -class BionicTestNetworkAlias(relbase.bionic, TestNetworkAliasAbs): |
1746 | +class CosmicTestNetworkAlias(relbase.cosmic, TestNetworkAliasAbs): |
1747 | __test__ = True |
1748 | |
1749 | # vi: ts=4 expandtab syntax=python |
1750 | diff --git a/tests/vmtests/test_network_bonding.py b/tests/vmtests/test_network_bonding.py |
1751 | index 7d07413..9dba07b 100644 |
1752 | --- a/tests/vmtests/test_network_bonding.py |
1753 | +++ b/tests/vmtests/test_network_bonding.py |
1754 | @@ -10,9 +10,18 @@ import textwrap |
1755 | class TestNetworkBondingAbs(TestNetworkBaseTestsAbs): |
1756 | conf_file = "examples/tests/bonding_network.yaml" |
1757 | |
1758 | - def test_ifenslave_installed(self): |
1759 | - self.assertIn("ifenslave", self.debian_packages, |
1760 | - "ifenslave deb not installed") |
1761 | + def test_ifenslave_package_status(self): |
1762 | + """ifenslave is expected installed in Ubuntu < artful.""" |
1763 | + rel = self.target_release |
1764 | + pkg = "ifenslave" |
1765 | + if rel in ("precise", "trusty", "xenial"): |
1766 | + self.assertIn( |
1767 | + pkg, self.debian_packages, |
1768 | + "%s package expected in %s but not found" % (pkg, rel)) |
1769 | + else: |
1770 | + self.assertNotIn( |
1771 | + pkg, self.debian_packages, |
1772 | + "%s package found but not expected in %s" % (pkg, rel)) |
1773 | |
1774 | |
1775 | class CentosTestNetworkBondingAbs(TestNetworkBondingAbs): |
1776 | @@ -26,7 +35,7 @@ class CentosTestNetworkBondingAbs(TestNetworkBondingAbs): |
1777 | rpm -qf `which ifenslave` |tee ifenslave_installed |
1778 | """)] |
1779 | |
1780 | - def test_ifenslave_installed(self): |
1781 | + def test_ifenslave_package_status(self): |
1782 | status = self.load_collect_file("ifenslave_installed") |
1783 | self.logger.debug('ifenslave installed: {}'.format(status)) |
1784 | self.assertTrue('iputils' in status) |
1785 | @@ -62,32 +71,12 @@ class XenialTestBonding(relbase.xenial, TestNetworkBondingAbs): |
1786 | __test__ = True |
1787 | |
1788 | |
1789 | -class ArtfulTestBonding(relbase.artful, TestNetworkBondingAbs): |
1790 | - __test__ = True |
1791 | - |
1792 | - def test_ifenslave_installed(self): |
1793 | - """Artful should not have ifenslave installed.""" |
1794 | - pass |
1795 | - |
1796 | - def test_ifenslave_not_installed(self): |
1797 | - """Confirm that ifenslave is not installed on artful""" |
1798 | - self.assertNotIn('ifenslave', self.debian_packages, |
1799 | - "ifenslave is not expected in artful: %s" % |
1800 | - self.debian_packages.get('ifenslave')) |
1801 | - |
1802 | - |
1803 | class BionicTestBonding(relbase.bionic, TestNetworkBondingAbs): |
1804 | __test__ = True |
1805 | |
1806 | - def test_ifenslave_installed(self): |
1807 | - """Bionic should not have ifenslave installed.""" |
1808 | - pass |
1809 | |
1810 | - def test_ifenslave_not_installed(self): |
1811 | - """Confirm that ifenslave is not installed on bionic""" |
1812 | - self.assertNotIn('ifenslave', self.debian_packages, |
1813 | - "ifenslave is not expected in bionic: %s" % |
1814 | - self.debian_packages.get('ifenslave')) |
1815 | +class CosmicTestBonding(relbase.cosmic, TestNetworkBondingAbs): |
1816 | + __test__ = True |
1817 | |
1818 | |
1819 | class Centos66TestNetworkBonding(centos_relbase.centos66fromxenial, |
1820 | diff --git a/tests/vmtests/test_network_bridging.py b/tests/vmtests/test_network_bridging.py |
1821 | index ca8964e..91df02e 100644 |
1822 | --- a/tests/vmtests/test_network_bridging.py |
1823 | +++ b/tests/vmtests/test_network_bridging.py |
1824 | @@ -109,9 +109,18 @@ class TestBridgeNetworkAbs(TestNetworkBaseTestsAbs): |
1825 | "sysfs_br0_eth1", |
1826 | "sysfs_br0_eth2"]) |
1827 | |
1828 | - def test_bridge_utils_installed(self): |
1829 | - self.assertIn("bridge-utils", self.debian_packages, |
1830 | - "bridge-utilsi deb not installed") |
1831 | + def test_bridge_package_status(self): |
1832 | + """bridge-utils is expected installed in Ubuntu < artful.""" |
1833 | + rel = self.target_release |
1834 | + pkg = "bridge-utils" |
1835 | + if rel in ("precise", "trusty", "xenial"): |
1836 | + self.assertIn( |
1837 | + pkg, self.debian_packages, |
1838 | + "%s package expected in %s but not found" % (pkg, rel)) |
1839 | + else: |
1840 | + self.assertNotIn( |
1841 | + pkg, self.debian_packages, |
1842 | + "%s package found but not expected in %s" % (pkg, rel)) |
1843 | |
1844 | def test_bridge_params(self): |
1845 | |
1846 | @@ -132,11 +141,10 @@ class TestBridgeNetworkAbs(TestNetworkBaseTestsAbs): |
1847 | return br0 |
1848 | |
1849 | def _get_bridge_params(br): |
1850 | - release = ( |
1851 | - self.target_release if self.target_release else self.release) |
1852 | bridge_params_uncheckable = default_bridge_params_uncheckable |
1853 | bridge_params_uncheckable.extend( |
1854 | - release_to_bridge_params_uncheckable.get(release, [])) |
1855 | + release_to_bridge_params_uncheckable.get( |
1856 | + self.target_release, [])) |
1857 | return [p for p in br.keys() |
1858 | if (p.startswith('bridge_') and |
1859 | p not in bridge_params_uncheckable)] |
1860 | @@ -200,7 +208,8 @@ class CentosTestBridgeNetworkAbs(TestBridgeNetworkAbs): |
1861 | def test_etc_resolvconf(self): |
1862 | pass |
1863 | |
1864 | - def test_bridge_utils_installed(self): |
1865 | + def test_bridge_package_status(self): |
1866 | + """bridge-utils is expected installed in centos.""" |
1867 | self.output_files_exist(["bridge-utils_installed"]) |
1868 | status = self.load_collect_file("bridge-utils_installed").strip() |
1869 | self.logger.debug('bridge-utils installed: {}'.format(status)) |
1870 | @@ -219,29 +228,12 @@ class Centos70TestBridgeNetwork(centos_relbase.centos70fromxenial, |
1871 | |
1872 | # only testing Yakkety or newer as older releases do not yet |
1873 | # have updated ifupdown/bridge-utils packages; |
1874 | -class ArtfulTestBridging(relbase.artful, TestBridgeNetworkAbs): |
1875 | +class BionicTestBridging(relbase.bionic, TestBridgeNetworkAbs): |
1876 | __test__ = True |
1877 | |
1878 | - def test_bridge_utils_installed(self): |
1879 | - """bridge-utils not needed in artful.""" |
1880 | - pass |
1881 | - |
1882 | - def test_bridge_utils_not_installed(self): |
1883 | - self.assertNotIn("bridge-utils", self.debian_packages, |
1884 | - "bridge-utils is not expected in artful: %s" % |
1885 | - self.debian_packages.get('bridge-utils')) |
1886 | - |
1887 | |
1888 | -class BionicTestBridging(relbase.bionic, TestBridgeNetworkAbs): |
1889 | +class CosmicTestBridging(relbase.cosmic, TestBridgeNetworkAbs): |
1890 | __test__ = True |
1891 | |
1892 | - def test_bridge_utils_installed(self): |
1893 | - """bridge-utils not needed in bionic.""" |
1894 | - pass |
1895 | - |
1896 | - def test_bridge_utils_not_installed(self): |
1897 | - self.assertNotIn("bridge-utils", self.debian_packages, |
1898 | - "bridge-utils is not expected in bionic: %s" % |
1899 | - self.debian_packages.get('bridge-utils')) |
1900 | |
1901 | # vi: ts=4 expandtab syntax=python |
1902 | diff --git a/tests/vmtests/test_network_ipv6.py b/tests/vmtests/test_network_ipv6.py |
1903 | index 6d87dcf..d3c34a5 100644 |
1904 | --- a/tests/vmtests/test_network_ipv6.py |
1905 | +++ b/tests/vmtests/test_network_ipv6.py |
1906 | @@ -64,11 +64,11 @@ class XenialTestNetworkIPV6(relbase.xenial, TestNetworkIPV6Abs): |
1907 | __test__ = True |
1908 | |
1909 | |
1910 | -class ArtfulTestNetworkIPV6(relbase.artful, TestNetworkIPV6Abs): |
1911 | +class BionicTestNetworkIPV6(relbase.bionic, TestNetworkIPV6Abs): |
1912 | __test__ = True |
1913 | |
1914 | |
1915 | -class BionicTestNetworkIPV6(relbase.bionic, TestNetworkIPV6Abs): |
1916 | +class CosmicTestNetworkIPV6(relbase.cosmic, TestNetworkIPV6Abs): |
1917 | __test__ = True |
1918 | |
1919 | |
1920 | diff --git a/tests/vmtests/test_network_ipv6_static.py b/tests/vmtests/test_network_ipv6_static.py |
1921 | index 81fee8f..0396e43 100644 |
1922 | --- a/tests/vmtests/test_network_ipv6_static.py |
1923 | +++ b/tests/vmtests/test_network_ipv6_static.py |
1924 | @@ -46,11 +46,11 @@ class XenialTestNetworkIPV6Static(relbase.xenial, TestNetworkIPV6StaticAbs): |
1925 | __test__ = True |
1926 | |
1927 | |
1928 | -class ArtfulTestNetworkIPV6Static(relbase.artful, TestNetworkIPV6StaticAbs): |
1929 | +class BionicTestNetworkIPV6Static(relbase.bionic, TestNetworkIPV6StaticAbs): |
1930 | __test__ = True |
1931 | |
1932 | |
1933 | -class BionicTestNetworkIPV6Static(relbase.bionic, TestNetworkIPV6StaticAbs): |
1934 | +class CosmicTestNetworkIPV6Static(relbase.cosmic, TestNetworkIPV6StaticAbs): |
1935 | __test__ = True |
1936 | |
1937 | |
1938 | diff --git a/tests/vmtests/test_network_ipv6_vlan.py b/tests/vmtests/test_network_ipv6_vlan.py |
1939 | index 68cf6e0..e001da9 100644 |
1940 | --- a/tests/vmtests/test_network_ipv6_vlan.py |
1941 | +++ b/tests/vmtests/test_network_ipv6_vlan.py |
1942 | @@ -27,11 +27,11 @@ class XenialTestNetworkIPV6Vlan(relbase.xenial, TestNetworkIPV6VlanAbs): |
1943 | __test__ = True |
1944 | |
1945 | |
1946 | -class ArtfulTestNetworkIPV6Vlan(relbase.artful, TestNetworkIPV6VlanAbs): |
1947 | +class BionicTestNetworkIPV6Vlan(relbase.bionic, TestNetworkIPV6VlanAbs): |
1948 | __test__ = True |
1949 | |
1950 | |
1951 | -class BionicTestNetworkIPV6Vlan(relbase.bionic, TestNetworkIPV6VlanAbs): |
1952 | +class CosmicTestNetworkIPV6Vlan(relbase.cosmic, TestNetworkIPV6VlanAbs): |
1953 | __test__ = True |
1954 | |
1955 | |
1956 | diff --git a/tests/vmtests/test_network_mtu.py b/tests/vmtests/test_network_mtu.py |
1957 | index 41b1383..7a10bf1 100644 |
1958 | --- a/tests/vmtests/test_network_mtu.py |
1959 | +++ b/tests/vmtests/test_network_mtu.py |
1960 | @@ -189,23 +189,15 @@ class TestNetworkMtu(relbase.xenial, TestNetworkMtuAbs): |
1961 | __test__ = True |
1962 | |
1963 | |
1964 | -class ArtfulTestNetworkMtu(relbase.artful, TestNetworkMtuAbs): |
1965 | +@TestNetworkMtuAbs.skip_by_date("1671951", fixby="2018-09-26") |
1966 | +class BionicTestNetworkMtu(relbase.bionic, TestNetworkMtuAbs): |
1967 | __test__ = True |
1968 | |
1969 | - @classmethod |
1970 | - def setUpClass(cls): |
1971 | - cls.skip_by_date("1671951", fixby="2018-05-26") |
1972 | - super().setUpClass() |
1973 | - |
1974 | |
1975 | -class BionicTestNetworkMtu(relbase.bionic, TestNetworkMtuAbs): |
1976 | +@TestNetworkMtuAbs.skip_by_date("1671951", fixby="2018-09-26") |
1977 | +class CosmicTestNetworkMtu(relbase.cosmic, TestNetworkMtuAbs): |
1978 | __test__ = True |
1979 | |
1980 | - @classmethod |
1981 | - def setUpClass(cls): |
1982 | - cls.skip_by_date("1671951", fixby="2018-05-26") |
1983 | - super().setUpClass() |
1984 | - |
1985 | |
1986 | class Centos66TestNetworkMtu(centos_relbase.centos66fromxenial, |
1987 | CentosTestNetworkMtuAbs): |
1988 | diff --git a/tests/vmtests/test_network_static.py b/tests/vmtests/test_network_static.py |
1989 | index d96d3eb..40468f3 100644 |
1990 | --- a/tests/vmtests/test_network_static.py |
1991 | +++ b/tests/vmtests/test_network_static.py |
1992 | @@ -60,11 +60,11 @@ class XenialTestNetworkStatic(relbase.xenial, TestNetworkStaticAbs): |
1993 | __test__ = True |
1994 | |
1995 | |
1996 | -class ArtfulTestNetworkStatic(relbase.artful, TestNetworkStaticAbs): |
1997 | +class BionicTestNetworkStatic(relbase.bionic, TestNetworkStaticAbs): |
1998 | __test__ = True |
1999 | |
2000 | |
2001 | -class BionicTestNetworkStatic(relbase.bionic, TestNetworkStaticAbs): |
2002 | +class CosmicTestNetworkStatic(relbase.cosmic, TestNetworkStaticAbs): |
2003 | __test__ = True |
2004 | |
2005 | |
2006 | diff --git a/tests/vmtests/test_network_static_routes.py b/tests/vmtests/test_network_static_routes.py |
2007 | index 92ff267..9fa89ff 100644 |
2008 | --- a/tests/vmtests/test_network_static_routes.py |
2009 | +++ b/tests/vmtests/test_network_static_routes.py |
2010 | @@ -49,12 +49,12 @@ class XenialTestNetworkStaticRoutes(relbase.xenial, |
2011 | __test__ = True |
2012 | |
2013 | |
2014 | -class ArtfulTestNetworkStaticRoutes(relbase.artful, |
2015 | +class BionicTestNetworkStaticRoutes(relbase.bionic, |
2016 | TestNetworkStaticRoutesAbs): |
2017 | __test__ = True |
2018 | |
2019 | |
2020 | -class BionicTestNetworkStaticRoutes(relbase.bionic, |
2021 | +class CosmicTestNetworkStaticRoutes(relbase.cosmic, |
2022 | TestNetworkStaticRoutesAbs): |
2023 | __test__ = True |
2024 | |
2025 | diff --git a/tests/vmtests/test_network_vlan.py b/tests/vmtests/test_network_vlan.py |
2026 | index 3cb6eae..94e2966 100644 |
2027 | --- a/tests/vmtests/test_network_vlan.py |
2028 | +++ b/tests/vmtests/test_network_vlan.py |
2029 | @@ -35,7 +35,7 @@ class TestNetworkVlanAbs(TestNetworkBaseTestsAbs): |
2030 | self.output_files_exist(link_files) |
2031 | |
2032 | def test_vlan_installed(self): |
2033 | - release = self.target_release if self.target_release else self.release |
2034 | + release = self.target_release |
2035 | if release not in ('precise', 'trusty', 'xenial', 'artful'): |
2036 | raise SkipTest("release '%s' does not need the vlan package" % |
2037 | release) |
2038 | @@ -86,11 +86,11 @@ class XenialTestNetworkVlan(relbase.xenial, TestNetworkVlanAbs): |
2039 | __test__ = True |
2040 | |
2041 | |
2042 | -class ArtfulTestNetworkVlan(relbase.artful, TestNetworkVlanAbs): |
2043 | +class BionicTestNetworkVlan(relbase.bionic, TestNetworkVlanAbs): |
2044 | __test__ = True |
2045 | |
2046 | |
2047 | -class BionicTestNetworkVlan(relbase.bionic, TestNetworkVlanAbs): |
2048 | +class CosmicTestNetworkVlan(relbase.cosmic, TestNetworkVlanAbs): |
2049 | __test__ = True |
2050 | |
2051 | |
2052 | diff --git a/tests/vmtests/test_nvme.py b/tests/vmtests/test_nvme.py |
2053 | index a9e3bc3..80d9cbf 100644 |
2054 | --- a/tests/vmtests/test_nvme.py |
2055 | +++ b/tests/vmtests/test_nvme.py |
2056 | @@ -75,11 +75,11 @@ class XenialEdgeTestNvme(relbase.xenial_edge, TestNvmeAbs): |
2057 | __test__ = True |
2058 | |
2059 | |
2060 | -class ArtfulTestNvme(relbase.artful, TestNvmeAbs): |
2061 | +class BionicTestNvme(relbase.bionic, TestNvmeAbs): |
2062 | __test__ = True |
2063 | |
2064 | |
2065 | -class BionicTestNvme(relbase.bionic, TestNvmeAbs): |
2066 | +class CosmicTestNvme(relbase.cosmic, TestNvmeAbs): |
2067 | __test__ = True |
2068 | |
2069 | |
2070 | @@ -164,11 +164,12 @@ class XenialEdgeTestNvmeBcache(relbase.xenial_edge, TestNvmeBcacheAbs): |
2071 | __test__ = True |
2072 | |
2073 | |
2074 | -class ArtfulTestNvmeBcache(relbase.artful, TestNvmeBcacheAbs): |
2075 | +class BionicTestNvmeBcache(relbase.bionic, TestNvmeBcacheAbs): |
2076 | __test__ = True |
2077 | |
2078 | |
2079 | -class BionicTestNvmeBcache(relbase.bionic, TestNvmeBcacheAbs): |
2080 | +class CosmicTestNvmeBcache(relbase.cosmic, TestNvmeBcacheAbs): |
2081 | __test__ = True |
2082 | |
2083 | + |
2084 | # vi: ts=4 expandtab syntax=python |
2085 | diff --git a/tests/vmtests/test_pollinate_useragent.py b/tests/vmtests/test_pollinate_useragent.py |
2086 | index abd6daf..201cca1 100644 |
2087 | --- a/tests/vmtests/test_pollinate_useragent.py |
2088 | +++ b/tests/vmtests/test_pollinate_useragent.py |
2089 | @@ -63,4 +63,7 @@ class BionicTestPollinateUserAgent(relbase.bionic, TestPollinateUserAgent): |
2090 | __test__ = True |
2091 | |
2092 | |
2093 | +class CosmicTestPollinateUserAgent(relbase.cosmic, TestPollinateUserAgent): |
2094 | + __test__ = True |
2095 | + |
2096 | # vi: ts=4 expandtab syntax=python |
2097 | diff --git a/tests/vmtests/test_raid5_bcache.py b/tests/vmtests/test_raid5_bcache.py |
2098 | index aa2bebf..bb00b65 100644 |
2099 | --- a/tests/vmtests/test_raid5_bcache.py |
2100 | +++ b/tests/vmtests/test_raid5_bcache.py |
2101 | @@ -99,11 +99,11 @@ class XenialEdgeTestRaid5Bcache(relbase.xenial_edge, TestMdadmBcacheAbs): |
2102 | __test__ = True |
2103 | |
2104 | |
2105 | -class ArtfulTestRaid5Bcache(relbase.artful, TestMdadmBcacheAbs): |
2106 | +class BionicTestRaid5Bcache(relbase.bionic, TestMdadmBcacheAbs): |
2107 | __test__ = True |
2108 | |
2109 | |
2110 | -class BionicTestRaid5Bcache(relbase.bionic, TestMdadmBcacheAbs): |
2111 | +class CosmicTestRaid5Bcache(relbase.cosmic, TestMdadmBcacheAbs): |
2112 | __test__ = True |
2113 | |
2114 | # vi: ts=4 expandtab syntax=python |
2115 | diff --git a/tests/vmtests/test_simple.py b/tests/vmtests/test_simple.py |
2116 | index 54fa24d..de1c675 100644 |
2117 | --- a/tests/vmtests/test_simple.py |
2118 | +++ b/tests/vmtests/test_simple.py |
2119 | @@ -43,14 +43,14 @@ class XenialTestSimple(relbase.xenial, TestSimple): |
2120 | __test__ = True |
2121 | |
2122 | |
2123 | -class ArtfulTestSimple(relbase.artful, TestSimple): |
2124 | +class BionicTestSimple(relbase.bionic, TestSimple): |
2125 | __test__ = True |
2126 | |
2127 | def test_output_files_exist(self): |
2128 | self.output_files_exist(["netplan.yaml"]) |
2129 | |
2130 | |
2131 | -class BionicTestSimple(relbase.bionic, TestSimple): |
2132 | +class CosmicTestSimple(relbase.cosmic, TestSimple): |
2133 | __test__ = True |
2134 | |
2135 | def test_output_files_exist(self): |
2136 | diff --git a/tests/vmtests/test_uefi_basic.py b/tests/vmtests/test_uefi_basic.py |
2137 | index 517554f..641a077 100644 |
2138 | --- a/tests/vmtests/test_uefi_basic.py |
2139 | +++ b/tests/vmtests/test_uefi_basic.py |
2140 | @@ -112,11 +112,11 @@ class XenialEdgeUefiTestBasic(relbase.xenial_edge, TestBasicAbs): |
2141 | __test__ = True |
2142 | |
2143 | |
2144 | -class ArtfulUefiTestBasic(relbase.artful, TestBasicAbs): |
2145 | +class BionicUefiTestBasic(relbase.bionic, TestBasicAbs): |
2146 | __test__ = True |
2147 | |
2148 | |
2149 | -class BionicUefiTestBasic(relbase.bionic, TestBasicAbs): |
2150 | +class CosmicUefiTestBasic(relbase.cosmic, TestBasicAbs): |
2151 | __test__ = True |
2152 | |
2153 | |
2154 | @@ -132,11 +132,11 @@ class XenialGAUefiTestBasic4k(XenialGAUefiTestBasic): |
2155 | disk_block_size = 4096 |
2156 | |
2157 | |
2158 | -class ArtfulUefiTestBasic4k(ArtfulUefiTestBasic): |
2159 | +class BionicUefiTestBasic4k(BionicUefiTestBasic): |
2160 | disk_block_size = 4096 |
2161 | |
2162 | |
2163 | -class BionicUefiTestBasic4k(BionicUefiTestBasic): |
2164 | +class CosmicUefiTestBasic4k(CosmicUefiTestBasic): |
2165 | disk_block_size = 4096 |
2166 | |
2167 | # vi: ts=4 expandtab syntax=python |
2168 | diff --git a/tests/vmtests/test_zfsroot.py b/tests/vmtests/test_zfsroot.py |
2169 | index 1ebc616..e159d17 100644 |
2170 | --- a/tests/vmtests/test_zfsroot.py |
2171 | +++ b/tests/vmtests/test_zfsroot.py |
2172 | @@ -96,11 +96,11 @@ class XenialEdgeTestZfsRoot(relbase.xenial_edge, TestZfsRootAbs): |
2173 | __test__ = True |
2174 | |
2175 | |
2176 | -class ArtfulTestZfsRoot(relbase.artful, TestZfsRootAbs): |
2177 | +class BionicTestZfsRoot(relbase.bionic, TestZfsRootAbs): |
2178 | __test__ = True |
2179 | |
2180 | |
2181 | -class BionicTestZfsRoot(relbase.bionic, TestZfsRootAbs): |
2182 | +class CosmicTestZfsRoot(relbase.cosmic, TestZfsRootAbs): |
2183 | __test__ = True |
2184 | |
2185 | |
2186 | @@ -120,3 +120,7 @@ class XenialGAi386TestZfsRootFsType(relbase.xenial_ga, TestZfsRootFsTypeAbs, |
2187 | |
2188 | class BionicTestZfsRootFsType(relbase.bionic, TestZfsRootFsTypeAbs): |
2189 | __test__ = True |
2190 | + |
2191 | + |
2192 | +class CosmicTestZfsRootFsType(relbase.cosmic, TestZfsRootFsTypeAbs): |
2193 | + __test__ = True |
2194 | diff --git a/tools/xkvm b/tools/xkvm |
2195 | index deb769e..dbcba6f 100755 |
2196 | --- a/tools/xkvm |
2197 | +++ b/tools/xkvm |
2198 | @@ -648,9 +648,13 @@ main() { |
2199 | |
2200 | local bus_devices |
2201 | bus_devices=( -device "$virtio_scsi_bus,id=virtio-scsi-xkvm" ) |
2202 | - cmd=( "${kvmcmd[@]}" "${archopts[@]}" |
2203 | + local rng_devices |
2204 | + rng_devices=( -object "rng-random,filename=/dev/urandom,id=rng0" |
2205 | + -device "virtio-rng-pci,rng=rng0" ) |
2206 | + cmd=( "${kvmcmd[@]}" "${archopts[@]}" |
2207 | "${bios_opts[@]}" |
2208 | "${bus_devices[@]}" |
2209 | + "${rng_devices[@]}" |
2210 | "${netargs[@]}" |
2211 | "${diskargs[@]}" "${pt[@]}" ) |
2212 | local pcmd=$(quote_cmd "${cmd[@]}") |
2213 | diff --git a/tox.ini b/tox.ini |
2214 | index 6f14381..8e5faf2 100644 |
2215 | --- a/tox.ini |
2216 | +++ b/tox.ini |
2217 | @@ -51,7 +51,7 @@ commands = {envpython} -m flake8 {posargs:curtin tests/} |
2218 | basepython = python3 |
2219 | deps = {[testenv]deps} |
2220 | pylint==1.8.1 |
2221 | - bzr+lp:simplestreams |
2222 | + git+https://git.launchpad.net/simplestreams |
2223 | commands = {envpython} -m pylint --errors-only {posargs:curtin tests/vmtests} |
2224 | |
2225 | [testenv:py27-pylint] |
lgtm