diff options
author | Ryan Harper <ryan.harper@canonical.com> | 2020-02-07 16:52:06 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-07 17:52:06 -0500 |
commit | 890aca4777ab61e54b6b96d251c3022cbe0b108c (patch) | |
tree | 4618481ee9861868b2cec51cff0c1d749efa3b67 /tests/unittests/test_handler | |
parent | 616d0a60d8d6ef0fa024267e718b3ed0e3b6bbdc (diff) | |
download | vyos-cloud-init-890aca4777ab61e54b6b96d251c3022cbe0b108c.tar.gz vyos-cloud-init-890aca4777ab61e54b6b96d251c3022cbe0b108c.zip |
cc_disk_setup: add swap filesystem force flag (#207)
Diffstat (limited to 'tests/unittests/test_handler')
-rw-r--r-- | tests/unittests/test_handler/test_handler_disk_setup.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unittests/test_handler/test_handler_disk_setup.py b/tests/unittests/test_handler/test_handler_disk_setup.py index 5afcacaf..0e51f17a 100644 --- a/tests/unittests/test_handler/test_handler_disk_setup.py +++ b/tests/unittests/test_handler/test_handler_disk_setup.py @@ -222,4 +222,22 @@ class TestMkfsCommandHandling(CiTestCase): '-L', 'without_cmd', '-F', 'are', 'added'], shell=False) + @mock.patch('cloudinit.config.cc_disk_setup.util.which') + def test_mkswap(self, m_which, subp, *args): + """mkfs observes extra_opts and overwrite settings when cmd is not + present.""" + m_which.side_effect = iter([None, '/sbin/mkswap']) + cc_disk_setup.mkfs({ + 'filesystem': 'swap', + 'device': '/dev/xdb1', + 'label': 'swap', + 'overwrite': True, + }) + + self.assertEqual([mock.call('mkfs.swap'), mock.call('mkswap')], + m_which.call_args_list) + subp.assert_called_once_with( + ['/sbin/mkswap', '/dev/xdb1', '-L', 'swap', '-f'], shell=False) + +# # vi: ts=4 expandtab |