Exemplo n.º 1
0
 def test_clone_success(self):
     '''
     Tests zfs clone success
     '''
     res = OrderedDict([('cloned', True)])
     ret = {'pid': 64532, 'retcode': 0, 'stderr': '', 'stdout': ''}
     mock_cmd = MagicMock(return_value=ret)
     with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
          patch.dict(zfs.__utils__, utils_patch):
         self.assertEqual(
             res,
             zfs.clone('myzpool/mydataset@yesterday', 'myzpool/yesterday'))
Exemplo n.º 2
0
 def test_clone_failure(self):
     '''
     Tests zfs clone failure
     '''
     res = OrderedDict([
         ('cloned', False),
         ('error',
          "cannot create 'myzpool/archive/yesterday': parent does not exist"
          ),
     ])
     ret = {
         'pid': 64864,
         'retcode': 1,
         'stderr':
         "cannot create 'myzpool/archive/yesterday': parent does not exist",
         'stdout': ''
     }
     mock_cmd = MagicMock(return_value=ret)
     with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
          patch.dict(zfs.__utils__, utils_patch):
         self.assertEqual(
             res,
             zfs.clone('myzpool/mydataset@yesterday',
                       'myzpool/archive/yesterday'))