diff options
author | Neil Williams <codehelp@debian.org> | 2015-12-20 15:10:58 +0000 |
---|---|---|
committer | Neil Williams <codehelp@debian.org> | 2015-12-20 15:10:58 +0000 |
commit | 2749d3f08e774f8b8f38a389edbd6dafbfd99d66 (patch) | |
tree | 2d9f3d8c79b3df91775e716a9297c0324354dce1 | |
parent | acafe6a9ccde31e313965fcfd044804c1306d47e (diff) | |
download | vmdebootstrap-2749d3f08e774f8b8f38a389edbd6dafbfd99d66.tar.gz |
add tests for combining image, tarball and squash
-rwxr-xr-x | bin/vmdebootstrap | 9 | ||||
-rw-r--r-- | vmdebootstrap/filesystem.py | 2 | ||||
-rw-r--r-- | yarns/200-fast-tests.yarn | 22 |
3 files changed, 32 insertions, 1 deletions
diff --git a/bin/vmdebootstrap b/bin/vmdebootstrap index b9dc559..d9252cb 100755 --- a/bin/vmdebootstrap +++ b/bin/vmdebootstrap @@ -152,6 +152,15 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth if self.settings['apt-mirror'] and not self.settings['configure-apt']: raise cliapp.AppException( '--apt-mirror requires --configure-apt as well.') + if self.settings['convert-qcow2'] and not self.settings['image']: + raise cliapp.AppException( + '--convert-qcow2 can only be used with --image.') + if self.settings['image'] and self.settings['tarball']: + raise cliapp.AppException( + 'Use --image or --tarball, not both.') + if self.settings['squash'] and self.settings['tarball']: + raise cliapp.AppException( + 'Use --squash or --tarball, not both.') uefi = self.handlers[Uefi.name] oldstable = distro.was_oldstable(datetime.date(2015, 4, 26)) uefi.check_settings(oldstable=oldstable) diff --git a/vmdebootstrap/filesystem.py b/vmdebootstrap/filesystem.py index f5e6483..106fa56 100644 --- a/vmdebootstrap/filesystem.py +++ b/vmdebootstrap/filesystem.py @@ -289,7 +289,7 @@ class Filesystem(Base): rename to .raw and let the conversion put the original name back """ - if not self.settings['convert-qcow2']: + if not self.settings['convert-qcow2'] or not self.settings['image']: return self.message('Converting raw image to qcow2') tmpname = self.settings['image'] + '.raw' diff --git a/yarns/200-fast-tests.yarn b/yarns/200-fast-tests.yarn index 8955d75..796535e 100644 --- a/yarns/200-fast-tests.yarn +++ b/yarns/200-fast-tests.yarn @@ -145,3 +145,25 @@ verify that vmdebootstrap parses the command line correctly. THEN vmdebootstrap exited with a zero exit code AND vmdebootstrap wrote a message matching linux-image-amd64 AND vmdebootstrap wrote a message matching unlikely + + SCENARIO only images can be converted to qcow2 + ASSUMING fast tests are requested + WHEN user attempts to run vmdebootstrap + ... --convert-qcow2 --tarball --arch=amd64 --dry-run + THEN vmdebootstrap exited with a non-zero exit code + AND vmdebootstrap wrote an error message matching qcow2 can only + AND vmdebootstrap wrote an error message matching with --image + + SCENARIO tarball is not usable with image + ASSUMING fast tests are requested + WHEN user attempts to run vmdebootstrap + ... --image=FOO --tarball=FOO --arch=amd64 --dry-run + THEN vmdebootstrap exited with a non-zero exit code + AND vmdebootstrap wrote an error message matching not both + + SCENARIO tarball is not usable with squash + ASSUMING fast tests are requested + WHEN user attempts to run vmdebootstrap + ... --squash=FOO --tarball=FOO --arch=amd64 --dry-run + THEN vmdebootstrap exited with a non-zero exit code + AND vmdebootstrap wrote an error message matching not both |