コード例 #1
0
ファイル: test_zfs.py プロジェクト: jgleissner/salt-2
 def test_diff_parsed_time(self):
     '''
     Tests zfs diff
     '''
     ## NOTE: do not hardcode parsed timestamps, timezone play a role here.
     ##       zfs diff output seems to be timezone aware
     res = OrderedDict([
         (strftime(1517063879.144517494,
                   '%Y-%m-%d.%H:%M:%S.%f'), 'M\t\t/data/test/'),
         (strftime(1517063875.296592355,
                   '%Y-%m-%d.%H:%M:%S.%f'), '+\t\t/data/test/world'),
         (strftime(1517063879.274438467,
                   '%Y-%m-%d.%H:%M:%S.%f'), '+\t\t/data/test/hello'),
     ])
     ret = {}
     ret['retcode'] = 0
     ret['stdout'] = "\n".join([
         "1517063879.144517494\tM\t\t/data/test/",
         "1517063875.296592355\t+\t\t/data/test/world",
         "1517063879.274438467\t+\t\t/data/test/hello",
     ])
     ret['stderr'] = ''
     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.diff('myzpool/data@yesterday',
                      'myzpool/data',
                      parsable=False))
コード例 #2
0
ファイル: test_zfs.py プロジェクト: jgleissner/salt-2
 def test_diff(self):
     '''
     Tests zfs diff
     '''
     res = [
         "1517063879.144517494\tM\t\t/data/test/",
         "1517063875.296592355\t+\t\t/data/test/world",
         "1517063879.274438467\t+\t\t/data/test/hello",
     ]
     ret = {}
     ret['retcode'] = 0
     ret['stdout'] = "\n".join([
         "1517063879.144517494\tM\t\t/data/test/",
         "1517063875.296592355\t+\t\t/data/test/world",
         "1517063879.274438467\t+\t\t/data/test/hello",
     ])
     ret['stderr'] = ''
     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.diff('myzpool/mydataset@yesterday', 'myzpool/mydataset'))