summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRadostin Stoyanov <rstoyanov1@gmail.com>2017-08-26 21:42:03 +0100
committerRadostin Stoyanov <rstoyanov1@gmail.com>2017-08-28 16:03:05 +0100
commit6ca9a3f7eccae0411f73d7aa8df759eb09be8955 (patch)
tree13b5f28e1911201ccb4a073d6841c444226fc457 /tests
parentdba42986a04d5b5a9d4926d65479744812c00f3f (diff)
downloadvirt-bootstrap.git-6ca9a3f7eccae0411f73d7aa8df759eb09be8955.tar.gz
virt-bootstrap.git-6ca9a3f7eccae0411f73d7aa8df759eb09be8955.tar.xz
virt-bootstrap.git-6ca9a3f7eccae0411f73d7aa8df759eb09be8955.zip
Create qcow2 images with guestfs-python
Use the python bindings of libguestfs to create qcow2 image with backing chains to mimic the layers of container image. This commit also changes the behavior of FileSource when 'qcow2' output format is used. Now the string layer-0.qcow2 will be used as name of the output file. This change is applied in the test suite as an update to the function get_image_path().
Diffstat (limited to 'tests')
-rw-r--r--tests/file_source.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/file_source.py b/tests/file_source.py
index 79bb234..391ca48 100644
--- a/tests/file_source.py
+++ b/tests/file_source.py
@@ -27,6 +27,7 @@ import unittest
from . import mock
from . import virt_bootstrap
from . import ImageAccessor
+from . import Qcow2ImageAccessor
from . import NOT_ROOT
@@ -76,3 +77,31 @@ class TestDirFileSource(ImageAccessor):
self.root_password = 'my secret root password'
self.call_bootstrap()
self.validate_shadow_file()
+
+
+class TestQcow2FileSource(Qcow2ImageAccessor):
+ """
+ Test cases for the class FileSource used with qcow2 output format.
+ """
+
+ def call_bootstrap(self):
+ """
+ Execute the bootstrap method from virtBootstrap.
+ """
+ virt_bootstrap.bootstrap(
+ uri=self.tar_file,
+ dest=self.dest_dir,
+ fmt='qcow2',
+ progress_cb=mock.Mock(),
+ uid_map=self.uid_map,
+ gid_map=self.gid_map,
+ root_password=self.root_password
+ )
+
+ def test_qcow2_extract_rootfs(self):
+ """
+ Ensures root file system of tar archive is converted to single
+ partition qcow2 image.
+ """
+ self.call_bootstrap()
+ self.check_qcow2_images(self.get_image_path())