Merge lp:~jibel/ubuntu-cdimage/support_for_multilayer into lp:ubuntu-cdimage

Proposed by Jean-Baptiste Lallement
Status: Merged
Merged at revision: 1792
Proposed branch: lp:~jibel/ubuntu-cdimage/support_for_multilayer
Merge into: lp:ubuntu-cdimage
Prerequisite: lp:~vorlon/ubuntu-cdimage/prune-obsolete-code
Diff against target: 358 lines (+130/-81) (has conflicts)
5 files modified
etc/crontab (+1/-1)
etc/livefs-launchpad (+1/-0)
etc/qa-products (+1/-0)
lib/cdimage/livefs.py (+43/-46)
lib/cdimage/tests/test_livefs.py (+84/-34)
Text conflict in etc/purge-days
To merge this branch: bzr merge lp:~jibel/ubuntu-cdimage/support_for_multilayer
Reviewer Review Type Date Requested Status
Steve Langasek Approve
Review via email: mp+364105@code.launchpad.net

This proposal supersedes a proposal from 2018-11-26.

Commit message

Adds support for multilayer images

* Made artefacts download generic: Don't hardcode artefact names and ensure they can be matched via regexp, on launchpad or local directory build.
* Fixed test suite
* Removed obsolete edubuntu server-squashfs test (LP: #1154601)
* Ensure we are still compatible with tests using a local server and with a local build.
* Add new ubuntu:canary subproject in automated builds

Extract from the discussion with cjwatson about these changes:
"""""
didrocks hey cjwatson! jibel and I have a question on ubuntu-cdimage: as with the new layered images we are building, we might not know in advance the squashfs, size, manifest files. We want to avoid to hardcode more filenames that already exists. In livefs.py, there are basically 2 code paths to download assets. One is using LP API (and so, can list all artefacts attached to a specific build) and the other
didrocks one is just for filesystem + http:// download. We thought to match against regexp, which works in the LP case and for filesystem (via os.listdir()). However, tests are failing as they are using http mock server. I wonder if in production, only the LP path is took. If so, can we just detect "http" for tests and either create a manifest that we download or rely on hardcoded filenames?
cjwatson As far as I know it's only ever the LP path in production, indeed
didrocks so, do you think special casing tests, like not using the regexp for them, is fine?
cjwatson Yeah, I think so
didrocks perfect! Thanks a lot cjwatson :)
cjwatson The http:// case may even be legacy - not sure
didrocks yeah, sounds like it, but we preferred asking you directly :)
cjwatson Obviously for good software engineering reasons keeping special cases for tests to a minimum is a good idea, but creating a sort of meta-manifest doesn't seem unreasonable, maybe with a fallback if it doesn't exist
didrocks yeah, the best would be ofc to rewrite the tests to mock LP
didrocks but I think that's out of our current scope :)
"""""

Description of the change

This is the support for multi layer images based on dead code removal branch from from Steve.

To post a comment you must log in.
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote : Posted in a previous version of this proposal

Rebased on trunk, could you please review? Thanks

Revision history for this message
Steve Langasek (vorlon) : Posted in a previous version of this proposal
review: Needs Fixing
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote : Posted in a previous version of this proposal

Thanks for the review!

We just rebased on your cleanup branch to avoid adapating tests and code that are going to be removed soon. All your comments should hopefully now be addressed :)

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

FYI, some answers to your comments were in https://code.launchpad.net/~jibel/ubuntu-cdimage/support_for_multilayer/+merge/359512 (+ selecting the correct diff version, can't link directly apparently).

Revision history for this message
Steve Langasek (vorlon) wrote :

Thanks, getting close now, mostly I just want you to delete some more code ;)

Also since you have (IMHO reasonably) based this on my other branch which has not yet landed, landing this will now necessarily block on review of that other branch, which I've asked sil2100 to look at.

review: Needs Fixing
Revision history for this message
Steve Langasek (vorlon) :
1804. By Jean-Baptiste Lallement

* Removed dead code
* Fixed PEP8 warning
* Updated tests to match the code removal and use the LP code path
* Added negative test to download from remote URL

Revision history for this message
Didier Roche-Tolomelli (didrocks) :
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Thanks for the review.

We tried to explain our choices to show that some decisions were not arbitrary. No issue on pending on the other MP, as stated before, there was no point anyway to modify tests and code that are going to be removed.

So, we mixed a little bit of dead code removal as you requested on this MP, and adapted the tests as the API isn’t called in the way the tests were calling them.

Revision history for this message
Steve Langasek (vorlon) wrote :

I still get the following linting failures from ./run-tests on cosmic, do you also see this?

./lib/cdimage/livefs.py:552:21: E201 whitespace after '['
./lib/cdimage/livefs.py:552:69: E202 whitespace before ']'
./lib/cdimage/livefs.py:586:42: E225 missing whitespace around operator
./lib/cdimage/tests/test_livefs.py:1294: local variable 'url' is assigned to but never used

review: Needs Fixing
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

I didn't notice these linter errors on cosmic because pep8 and pyflakes were not installed in the build env.
test_pep8_clean and test_pyflakes_clean should probably fail (or as least explicitly skip) when the linter is not installed instead of returning.

1805. By Jean-Baptiste Lallement

Fixed linter errors

1806. By Jean-Baptiste Lallement

Factorized download_live_items_* tests and removed duplicated tests
Added test for filtering several artefacts by suffix
Added test for downloading several artefacts

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

We removed duplicated test and added one to cover filtering of artefacts and another to ensure that several artefacts are downloaded.

The remaining point is the question about server-squashfs (cf inline comment)

Revision history for this message
Steve Langasek (vorlon) wrote :

I covered the point in my prior review that there are no actual consumers of the "server-squashfs" support apart from the tests; so both the tests and the implementation should be culled.

1807. By Jean-Baptiste Lallement

Removed all the references to server-squashfs

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

All the references to server-squashfs have been removed from livefs.py and the related tests.

Revision history for this message
Steve Langasek (vorlon) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'etc/crontab'
--- etc/crontab 2018-10-30 13:23:58 +0000
+++ etc/crontab 2019-03-12 08:44:31 +0000
@@ -21,7 +21,7 @@
2120 15 * * * DIST=bionic for-project ubuntu-budgie cron.daily-live --live2120 15 * * * DIST=bionic for-project ubuntu-budgie cron.daily-live --live
2226 2 * * * DIST=bionic for-project ubuntu-mate cron.daily-live --live2226 2 * * * DIST=bionic for-project ubuntu-mate cron.daily-live --live
23# regular disco daily builds23# regular disco daily builds
2431 7 * * * for-project ubuntu cron.daily-live --live2431 7 * * * for-project ubuntu cron.daily-live --live; SUBPROJECT=canary for-project ubuntu cron.daily-live --live
2514 5 * * * for-project kubuntu cron.daily-live --live2514 5 * * * for-project kubuntu cron.daily-live --live
2650 1 * * * for-project xubuntu cron.daily-live --live2650 1 * * * for-project xubuntu cron.daily-live --live
2729 6 * * * for-project ubuntu-server cron.daily --live; for-project ubuntu-server cron.daily-preinstalled --live; SUBPROJECT=live for-project ubuntu-server cron.daily-live --live2729 6 * * * for-project ubuntu-server cron.daily --live; for-project ubuntu-server cron.daily-preinstalled --live; SUBPROJECT=live for-project ubuntu-server cron.daily-live --live
2828
=== modified file 'etc/livefs-launchpad'
--- etc/livefs-launchpad 2019-03-12 08:44:31 +0000
+++ etc/livefs-launchpad 2019-03-12 08:44:31 +0000
@@ -3,6 +3,7 @@
3# Like etc/default-arches, "PROJECT" is in fact PROJECT[-SUBPROJECT][-LOCALE].3# Like etc/default-arches, "PROJECT" is in fact PROJECT[-SUBPROJECT][-LOCALE].
44
5ubuntu daily-live * * ubuntu-cdimage/ubuntu5ubuntu daily-live * * ubuntu-cdimage/ubuntu
6ubuntu-canary daily-live * * ubuntu-cdimage/ubuntu-canary
6kubuntu daily-live * * ubuntu-cdimage/kubuntu7kubuntu daily-live * * ubuntu-cdimage/kubuntu
7edubuntu dvd * * ubuntu-cdimage/edubuntu8edubuntu dvd * * ubuntu-cdimage/edubuntu
8xubuntu daily-live * * ubuntu-cdimage/xubuntu9xubuntu daily-live * * ubuntu-cdimage/xubuntu
910
=== modified file 'etc/qa-products'
--- etc/qa-products 2019-03-12 08:44:31 +0000
+++ etc/qa-products 2019-03-12 08:44:31 +0000
@@ -45,6 +45,7 @@
4545
46# Ubuntu Desktop 46# Ubuntu Desktop
47Ubuntu Desktop amd64 ubuntu daily-live desktop amd64 iso47Ubuntu Desktop amd64 ubuntu daily-live desktop amd64 iso
48Ubuntu Desktop (Canary) amd64 ubuntu daily-live/canary desktop amd64 iso
48Ubuntu Desktop amd64+mac ubuntu daily-live desktop amd64+mac iso49Ubuntu Desktop amd64+mac ubuntu daily-live desktop amd64+mac iso
49Ubuntu Desktop armhf+omap4 ubuntu daily-live desktop armhf+omap4 iso50Ubuntu Desktop armhf+omap4 ubuntu daily-live desktop armhf+omap4 iso
50Ubuntu Desktop i386 ubuntu daily-live desktop i386 iso51Ubuntu Desktop i386 ubuntu daily-live desktop i386 iso
5152
=== modified file 'lib/cdimage/livefs.py'
--- lib/cdimage/livefs.py 2019-03-12 08:44:31 +0000
+++ lib/cdimage/livefs.py 2019-03-12 08:44:31 +0000
@@ -538,22 +538,32 @@
538 liveproject_subarch = liveproject538 liveproject_subarch = liveproject
539539
540 lp, lp_livefs = get_lp_livefs(config, arch)540 lp, lp_livefs = get_lp_livefs(config, arch)
541 uris = []
542 root = ""
541 if lp_livefs is not None:543 if lp_livefs is not None:
542 lp_kwargs = live_build_lp_kwargs(config, lp, lp_livefs, arch)544 lp_kwargs = live_build_lp_kwargs(config, lp, lp_livefs, arch)
543 lp_build = lp_livefs.getLatestBuild(545 lp_build = lp_livefs.getLatestBuild(
544 lp_kwargs["distro_arch_series"],546 lp_kwargs["distro_arch_series"],
545 unique_key=lp_kwargs.get("unique_key"))547 unique_key=lp_kwargs.get("unique_key"))
546 lp_urls = list(lp_build.getFileUrls())548 uris = list(lp_build.getFileUrls())
547
548 def urls_for(base):
549 for url in lp_urls:
550 if unquote(os.path.basename(url)) == base:
551 yield url
552 else:549 else:
553 root = livecd_base(config, arch)550 root = livecd_base(config, arch)
551 try:
552 uris = [os.path.join(root, u) for u in os.listdir(root)]
553 except OSError:
554 # fallback to exact given uri (for http://) in url_for as we can't
555 # list content.
556 pass
554557
555 def urls_for(base):558 def urls_for(base, item):
556 yield "%s/%s" % (root, base)559 if uris:
560 for uri in uris:
561 filename = unquote(os.path.basename(uri))
562 if (filename.startswith(base + '.') and
563 filename.endswith('.' + item)):
564 yield uri
565 else:
566 yield os.path.join(root, base + '.' + item)
557567
558 if item in (568 if item in (
559 "cloop", "squashfs", "manifest", "manifest-desktop", "manifest-remove",569 "cloop", "squashfs", "manifest", "manifest-desktop", "manifest-remove",
@@ -561,20 +571,22 @@
561 "rootfs.tar.gz", "custom.tar.gz", "device.tar.gz",571 "rootfs.tar.gz", "custom.tar.gz", "device.tar.gz",
562 "azure.device.tar.gz", "raspi2.device.tar.gz", "plano.device.tar.gz",572 "azure.device.tar.gz", "raspi2.device.tar.gz", "plano.device.tar.gz",
563 "tar.xz", "iso", "os.snap", "kernel.snap", "disk1.img.xz",573 "tar.xz", "iso", "os.snap", "kernel.snap", "disk1.img.xz",
564 "dragonboard.kernel.snap", "raspi2.kernel.snap", "installer.squashfs",574 "dragonboard.kernel.snap", "raspi2.kernel.snap",
565 "maas-rack.squashfs", "maas-region.squashfs",
566 "img.xz", "model-assertion"575 "img.xz", "model-assertion"
567 ):576 ):
568 if item == "ext4" and arch == "armhf+nexus7":577 if item == "ext4" and arch == "armhf+nexus7":
569 for url in urls_for(578 for url in urls_for(
570 "livecd.%s.%s-nexus7" % (liveproject_subarch, item)):579 "livecd." + liveproject_subarch, item + "-nexus7"):
571 yield url580 yield url
572 elif item == "disk1.img.xz":581 elif item == "disk1.img.xz":
573 for url in urls_for(582 for url in urls_for(
574 "livecd.%s.%s" % (liveproject, item)):583 "livecd." + liveproject, item):
575 yield url584 yield url
576 else:585 else:
577 for url in urls_for("livecd.%s.%s" % (liveproject_subarch, item)):586 for url in urls_for("livecd." + liveproject_subarch, item):
587 # filter out redundant artefacts
588 if url.endswith("modules.squashfs"):
589 continue
578 yield url590 yield url
579 elif item in (591 elif item in (
580 "kernel", "initrd", "bootimg", "modules.squashfs"592 "kernel", "initrd", "bootimg", "modules.squashfs"
@@ -582,8 +594,8 @@
582 our_flavours = flavours(config, arch)594 our_flavours = flavours(config, arch)
583 our_flavours.extend(["%s-hwe" % (f,) for f in our_flavours])595 our_flavours.extend(["%s-hwe" % (f,) for f in our_flavours])
584 for flavour in our_flavours:596 for flavour in our_flavours:
585 base = "livecd.%s.%s-%s" % (liveproject_subarch, item, flavour)597 for url in urls_for("livecd." + liveproject_subarch,
586 for url in urls_for(base):598 item + "-" + flavour):
587 yield url599 yield url
588 elif item in (600 elif item in (
589 "boot-%s+%s.img" % (target.ubuntu_arch, target.subarch)601 "boot-%s+%s.img" % (target.ubuntu_arch, target.subarch)
@@ -596,15 +608,13 @@
596 for target in Touch.list_targets_by_ubuntu_arch(arch)608 for target in Touch.list_targets_by_ubuntu_arch(arch)
597 ):609 ):
598 for flavour in flavours(config, arch):610 for flavour in flavours(config, arch):
599 base = "livecd.%s.%s" % (liveproject_subarch, item)611 for url in urls_for("livecd." + liveproject_subarch, item):
600 for url in urls_for(base):
601 yield url612 yield url
602 elif item == "kernel-efi-signed":613 elif item == "kernel-efi-signed":
603 if series >= "precise" and arch == "amd64":614 if series >= "precise" and arch == "amd64":
604 for flavour in flavours(config, arch):615 for flavour in flavours(config, arch):
605 base = "livecd.%s.kernel-%s.efi.signed" % (616 for url in urls_for("livecd." + liveproject_subarch,
606 liveproject_subarch, flavour)617 "kernel-" + flavour + ".efi.signed"):
607 for url in urls_for(base):
608 yield url618 yield url
609 elif item == "wubi":619 elif item == "wubi":
610 if (project != "xubuntu" and arch in ("amd64", "i386")):620 if (project != "xubuntu" and arch in ("amd64", "i386")):
@@ -616,7 +626,7 @@
616 "stable" % series)626 "stable" % series)
617 elif item == "ltsp-squashfs":627 elif item == "ltsp-squashfs":
618 if arch in ("amd64", "i386"):628 if arch in ("amd64", "i386"):
619 for url in urls_for("livecd.%s-ltsp.squashfs" % liveproject):629 for url in urls_for("livecd." + liveproject + "-ltsp", "squashfs"):
620 yield url630 yield url
621 else:631 else:
622 raise UnknownLiveItem("Unknown live filesystem item '%s'" % item)632 raise UnknownLiveItem("Unknown live filesystem item '%s'" % item)
@@ -635,15 +645,7 @@
635 output_dir = live_output_directory(config)645 output_dir = live_output_directory(config)
636 found = False646 found = False
637647
638 if item == "server-squashfs":648 urls = list(live_item_paths(config, arch, item))
639 original_project = config.project
640 try:
641 config["PROJECT"] = "ubuntu-server"
642 urls = list(live_item_paths(config, arch, "squashfs"))
643 finally:
644 config["PROJECT"] = original_project
645 else:
646 urls = list(live_item_paths(config, arch, item))
647 if not urls:649 if not urls:
648 return False650 return False
649651
@@ -726,14 +728,17 @@
726 except osextras.FetchError:728 except osextras.FetchError:
727 pass729 pass
728 else:730 else:
729 target = os.path.join(output_dir, "%s.%s" % (arch, item))731 for url in urls:
730 try:732 # strip livecd.<PROJECT> and replace by arch
731 osextras.fetch(config, urls[0], target)733 filename = unquote(os.path.basename(url)).split('.', 2)[-1]
732 if item in ["squashfs", "server-squashfs"]:734 target = os.path.join(output_dir, "%s.%s" % (arch, filename))
733 sign.sign_cdimage(config, target)735 try:
734 found = True736 osextras.fetch(config, url, target)
735 except osextras.FetchError:737 if target.endswith("squashfs"):
736 pass738 sign.sign_cdimage(config, target)
739 found = True
740 except osextras.FetchError:
741 pass
737 return found742 return found
738743
739744
@@ -796,9 +801,6 @@
796 elif download_live_items(config, arch, "cloop"):801 elif download_live_items(config, arch, "cloop"):
797 got_image = True802 got_image = True
798 elif download_live_items(config, arch, "squashfs"):803 elif download_live_items(config, arch, "squashfs"):
799 download_live_items(config, arch, "installer.squashfs")
800 download_live_items(config, arch, "maas-rack.squashfs")
801 download_live_items(config, arch, "maas-region.squashfs")
802 download_live_items(config, arch, "modules.squashfs")804 download_live_items(config, arch, "modules.squashfs")
803 got_image = True805 got_image = True
804 elif download_live_items(config, arch, "rootfs.tar.gz"):806 elif download_live_items(config, arch, "rootfs.tar.gz"):
@@ -904,10 +906,5 @@
904 if project == "edubuntu" and config["CDIMAGE_DVD"]:906 if project == "edubuntu" and config["CDIMAGE_DVD"]:
905 for arch in config.arches:907 for arch in config.arches:
906 if arch in ("amd64", "i386"):908 if arch in ("amd64", "i386"):
907 # TODO: Disabled for raring (LP: #1154601)
908 # if series >= "raring":
909 # # Fetch the Ubuntu Server squashfs for Edubuntu Server.
910 # download_live_items(config, arch, "server-squashfs")
911
912 # Fetch the i386 LTSP chroot for Edubuntu Terminal Server.909 # Fetch the i386 LTSP chroot for Edubuntu Terminal Server.
913 download_live_items(config, arch, "ltsp-squashfs")910 download_live_items(config, arch, "ltsp-squashfs")
914911
=== modified file 'lib/cdimage/tests/test_livefs.py'
--- lib/cdimage/tests/test_livefs.py 2019-03-12 08:44:31 +0000
+++ lib/cdimage/tests/test_livefs.py 2019-03-12 08:44:31 +0000
@@ -1201,50 +1201,56 @@
1201 mock_fetch.assert_called_once_with(1201 mock_fetch.assert_called_once_with(
1202 self.config, url, os.path.join(target_dir, "i386.squashfs"))1202 self.config, url, os.path.join(target_dir, "i386.squashfs"))
12031203
1204 @mock.patch("cdimage.osextras.fetch")1204 def assert_desktop_live_download_items(self, series, item, filenames):
1205 def test_download_live_items_server_squashfs(self, mock_fetch):1205 self.assert_live_download_items("ubuntu", "", series, item,
1206 self.config["PROJECT"] = "edubuntu"1206 filenames, filenames)
1207 self.config["DIST"] = "trusty"1207
1208 self.config["IMAGE_TYPE"] = "dvd"1208 def assert_desktop_live_download_items_with_expected(self, series, item,
1209 self.assertTrue(1209 filenames,
1210 download_live_items(self.config, "i386", "server-squashfs"))1210 expected_files):
1211 url = ("http://cardamom.buildd/~buildd/LiveCD/trusty/ubuntu-server/"1211 self.assert_live_download_items("ubuntu", "", series, item,
1212 "current/livecd.ubuntu-server.squashfs")1212 filenames, expected_files)
1213 target_dir = os.path.join(1213
1214 self.temp_dir, "scratch", "edubuntu", "trusty", "dvd", "live")1214 def assert_server_live_download_items(self, series, item, filenames):
1215 mock_fetch.assert_called_once_with(1215 self.assert_live_download_items("ubuntu-server", "live", series, item,
1216 self.config, url, os.path.join(target_dir, "i386.server-squashfs"))1216 filenames, filenames)
12171217
1218 @mock.patch("cdimage.osextras.fetch")1218 @mock.patch("cdimage.osextras.fetch")
1219 def assert_server_live_download_items(self, series, item, filenames,1219 def assert_live_download_items(self, project, subproject, series, item,
1220 mock_fetch):1220 filenames, expected_files, mock_fetch):
1221 self.config["PROJECT"] = "ubuntu-server"1221 artefacts_dir = self.use_temp_dir()
1222 self.config["SUBPROJECT"] = "live"1222 self.config["PROJECT"] = project
1223 self.config["SUBPROJECT"] = subproject
1223 self.config["DIST"] = series1224 self.config["DIST"] = series
1224 self.config["IMAGE_TYPE"] = "daily-live"1225 self.config["IMAGE_TYPE"] = "daily-live"
1225 self.assertTrue(1226 self.config["LIVECD"] = artefacts_dir
1226 download_live_items(self.config, "amd64", item))
1227 calls = []1227 calls = []
1228 project_path = project
1229 if subproject:
1230 project_path = "%s-%s" % (project_path, subproject)
1228 for filename in filenames:1231 for filename in filenames:
1229 url = ("http://kapok.buildd/~buildd/LiveCD/%s/ubuntu-server-live/"1232 uri = os.path.join(
1230 "current/livecd.ubuntu-server.%s") % (series, filename)1233 artefacts_dir, series,
1234 project_path, "current",
1235 "livecd.%s.%s" % (project, filename))
1236 touch(uri)
1237 for filename in expected_files:
1231 target = os.path.join(1238 target = os.path.join(
1232 self.temp_dir, "scratch", "ubuntu-server", series,1239 self.temp_dir, "scratch", project, series,
1233 "daily-live", "live", "amd64." + filename)1240 "daily-live", "live", "amd64." + filename)
1234 calls.append(mock.call(self.config, url, target))1241 uri = os.path.join(
1242 artefacts_dir, series,
1243 project_path, "current",
1244 "livecd.%s.%s" % (project, filename))
1245 calls.append(mock.call(self.config, uri, target))
1246
1247 self.assertTrue(
1248 download_live_items(self.config, "amd64", item))
1235 self.assertCountEqual(mock_fetch.call_args_list, calls)1249 self.assertCountEqual(mock_fetch.call_args_list, calls)
12361250
1237 def test_download_live_items_installer_squashfs(self):1251 def test_download_live_items_installer_squashfs(self):
1238 self.assert_server_live_download_items(1252 self.assert_server_live_download_items(
1239 "bionic", "installer.squashfs", ["installer.squashfs"])1253 "bionic", "squashfs", ["installer.squashfs"])
1240
1241 def test_download_live_items_maas_rack_squashfs(self):
1242 self.assert_server_live_download_items(
1243 "bionic", "maas-rack.squashfs", ["maas-rack.squashfs"])
1244
1245 def test_download_live_items_maas_region_squashfs(self):
1246 self.assert_server_live_download_items(
1247 "bionic", "maas-region.squashfs", ["maas-region.squashfs"])
12481254
1249 def test_download_live_server_boot_items(self):1255 def test_download_live_server_boot_items(self):
1250 self.assert_server_live_download_items(1256 self.assert_server_live_download_items(
@@ -1257,6 +1263,50 @@
1257 "bionic", "modules.squashfs",1263 "bionic", "modules.squashfs",
1258 ["modules.squashfs-generic", "modules.squashfs-generic-hwe"])1264 ["modules.squashfs-generic", "modules.squashfs-generic-hwe"])
12591265
1266 @mock.patch("cdimage.osextras.fetch")
1267 def test_download_live_items_multi_layers_squashfs(self, mock_fetch):
1268 self.assert_desktop_live_download_items(
1269 "disco", "squashfs",
1270 ["minimal.standard.live.squashfs"])
1271
1272 @mock.patch("cdimage.osextras.fetch")
1273 def test_download_live_items_multiple_squashfses(self, mock_fetch):
1274 self.assert_desktop_live_download_items(
1275 "disco", "squashfs",
1276 ["minimal.squashfs",
1277 "minimal.standard.squashfs",
1278 "minimal.standard.live.squashfs"])
1279
1280 @mock.patch("cdimage.osextras.fetch")
1281 def test_download_live_items_filter_suffix(self, mock_fetch):
1282 self.assert_desktop_live_download_items_with_expected(
1283 "disco", "squashfs",
1284 ["minimal.squashfs", "minimal.size"], ["minimal.squashfs"])
1285
1286 @mock.patch("cdimage.osextras.fetch")
1287 def test_download_remote_doesnt_honor_suffix(self, mock_fetch):
1288 '''Downloading from remote (not LP or local path) will only download
1289 basic names'''
1290 self.config["PROJECT"] = "ubuntu"
1291 self.config["DIST"] = "disco"
1292 self.config["IMAGE_TYPE"] = "daily-live"
1293 target_dir = os.path.join(
1294 self.temp_dir, "scratch", "ubuntu", "disco", "daily-live", "live")
1295
1296 self.assertTrue(
1297 download_live_items(self.config, "amd64", "squashfs"))
1298 mock_fetch.assert_called_once_with(
1299 self.config,
1300 "http://kapok.buildd/~buildd/LiveCD/disco/ubuntu/" +\
1301 # This can't be livecd.ubuntu.minimal.standard.live.squashfs for
1302 # instance
1303 "current/livecd.ubuntu.squashfs",
1304 os.path.join(
1305 target_dir,
1306 # This can't be amd64.minimal.standard.live.squashfs for
1307 # instance
1308 "amd64.squashfs"))
1309
1260 def test_write_autorun(self):1310 def test_write_autorun(self):
1261 self.config["PROJECT"] = "ubuntu"1311 self.config["PROJECT"] = "ubuntu"
1262 self.config["DIST"] = "trusty"1312 self.config["DIST"] = "trusty"

Subscribers

People subscribed via source and target branches