예제 #1
0
 def test_holds_failure(self):
     '''
     Tests zfs holds failure
     '''
     res = OrderedDict([
         ('error',
          "cannot open 'myzpool/mydataset@baseline': dataset does not exist"
          ),
     ])
     ret = {
         'pid': 40993,
         'retcode': 1,
         'stderr':
         "cannot open 'myzpool/mydataset@baseline': dataset does not exist",
         'stdout': 'no datasets available'
     }
     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.holds('myzpool/mydataset@baseline'))
예제 #2
0
 def test_holds_success(self):
     '''
     Tests zfs holds success
     '''
     res = OrderedDict([
         ('important', 'Wed Dec 23 21:06 2015'),
         ('release-1.0', 'Wed Dec 23 21:08 2015'),
     ])
     ret = {
         'pid':
         40216,
         'retcode':
         0,
         'stderr':
         '',
         'stdout':
         'myzpool/mydataset@baseline\timportant  \tWed Dec 23 21:06 2015\nmyzpool/mydataset@baseline\trelease-1.0\tWed Dec 23 21:08 2015'
     }
     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.holds('myzpool/mydataset@baseline'))