summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/docker_source.py18
-rw-r--r--tests/file_source.py9
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/docker_source.py b/tests/docker_source.py
index eeea379..9090988 100644
--- a/tests/docker_source.py
+++ b/tests/docker_source.py
@@ -286,6 +286,24 @@ class TestQcow2DockerSource(Qcow2ImageAccessor):
g.umount('/')
g.shutdown()
+ def test_qcow2_setting_root_password(self):
+ """
+ Ensures that the root password is set in the last qcow2 image.
+ """
+ self.root_password = "My secret password"
+ layers_rootfs = self.call_bootstrap()
+
+ g = guestfs.GuestFS(python_return_dict=True)
+ g.add_drive_opts(
+ self.get_image_path(len(layers_rootfs)),
+ readonly=True
+ )
+ g.launch()
+ g.mount('/dev/sda', '/')
+ self.validate_shadow_file_in_image(g)
+ g.umount('/')
+ g.shutdown()
+
class TestDockerSource(unittest.TestCase):
"""
diff --git a/tests/file_source.py b/tests/file_source.py
index 9ffd4e3..4554ecd 100644
--- a/tests/file_source.py
+++ b/tests/file_source.py
@@ -115,3 +115,12 @@ class TestQcow2FileSource(Qcow2ImageAccessor):
self.call_bootstrap()
self.apply_mapping()
self.check_qcow2_images(self.get_image_path(1))
+
+ def test_qcow2_setting_root_password(self):
+ """
+ Ensures that the root password is set in the last qcow2 image.
+ """
+ self.root_password = "My secret password"
+ self.call_bootstrap()
+ self.check_image = self.validate_shadow_file_in_image
+ self.check_qcow2_images(self.get_image_path(1))