Exemple #1
0
 def test_release_success(self):
     '''
     Tests zfs release success
     '''
     res = OrderedDict([('released', True)])
     ret = {'pid': 50876, '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.release('important', 'myzpool/mydataset@baseline',
                         'myzpool/[email protected]'))
Exemple #2
0
 def test_release_failure(self):
     '''
     Tests zfs release failure
     '''
     res = OrderedDict([
         ('released', False),
         ('error',
          "cannot release hold from snapshot 'myzpool/mydataset@baseline': no such tag on this dataset"
          ),
     ])
     ret = {
         'pid': 51006,
         'retcode': 1,
         'stderr':
         "cannot release hold from snapshot 'myzpool/mydataset@baseline': no such tag on this dataset",
         '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.release('important', 'myzpool/mydataset@baseline'))