mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Adding another unit test to check for zfs.create failure if the parent datasets do not exist
This commit is contained in:
parent
e46f3f71ed
commit
e492962996
@ -107,6 +107,17 @@ class ZfsTestCase(TestCase):
|
||||
with patch.dict(zfs.__salt__, {'cmd.run': mock_cmd}):
|
||||
self.assertEqual(zfs.create('myzpool/mydataset'), ret)
|
||||
|
||||
@patch('salt.modules.zfs._check_zfs', MagicMock(return_value='/sbin/zfs'))
|
||||
def test_create_error_missing_parent(self):
|
||||
'''
|
||||
Tests unsuccessful return of create function if the parent datasets do not exist
|
||||
'''
|
||||
msg = "cannot create 'myzpool/mydataset/mysubdataset': parent does not exist"
|
||||
ret = {'Error': 'cannot create \'myzpool/mydataset/mysubdataset\': parent does not exist'}
|
||||
mock_cmd = MagicMock(return_value=msg)
|
||||
with patch.dict(zfs.__salt__, {'cmd.run': mock_cmd}):
|
||||
self.assertEqual(zfs.create('myzpool/mydataset/mysubdataset'), ret)
|
||||
|
||||
if __name__ == '__main__':
|
||||
from integration import run_tests
|
||||
run_tests(ZfsTestCase, needs_daemon=False)
|
||||
|
Loading…
Reference in New Issue
Block a user