Ejemplo n.º 1
0
 def test_convert(self):
     '''
     Test if it convert ext2/3/4 to BTRFS
     '''
     with patch('os.path.exists', MagicMock(return_value=True)):
         ret = {
             'after': {
                 'balance_log': 'Salt',
                 'ext4_image': 'removed',
                 'ext4_image_info': 'N/A',
                 'fsck_status': 'N/A',
                 'mount_point': None,
                 'type': 'ext4'
             },
             'before': {
                 'fsck_status': 'Filesystem errors corrected',
                 'mount_point': None,
                 'type': 'ext4'
             }
         }
         mock = MagicMock(return_value={
             'retcode': 1,
             'stderr': '',
             'stdout': 'Salt'
         })
         with patch.dict(btrfs.__salt__, {'cmd.run_all': mock}):
             mock = MagicMock(return_value={'/dev/sda3': {'type': 'ext4'}})
             with patch.object(salt.utils.fsutils, '_blkid_output', mock):
                 mock = MagicMock(
                     return_value={'/dev/sda3': [{
                         'mount_point': None
                     }]})
                 with patch.object(salt.utils.fsutils, '_get_mounts', mock):
                     self.assertDictEqual(
                         btrfs.convert('/dev/sda3', permanent=True), ret)
Ejemplo n.º 2
0
 def test_convert(self):
     """
     Test if it convert ext2/3/4 to BTRFS
     """
     with patch("os.path.exists", MagicMock(return_value=True)):
         ret = {
             "after": {
                 "balance_log": "Salt",
                 "ext4_image": "removed",
                 "ext4_image_info": "N/A",
                 "fsck_status": "N/A",
                 "mount_point": None,
                 "type": "ext4",
             },
             "before": {
                 "fsck_status": "Filesystem errors corrected",
                 "mount_point": None,
                 "type": "ext4",
             },
         }
         mock = MagicMock(
             return_value={"retcode": 1, "stderr": "", "stdout": "Salt"}
         )
         with patch.dict(btrfs.__salt__, {"cmd.run_all": mock}):
             mock = MagicMock(return_value={"/dev/sda3": {"type": "ext4"}})
             with patch.object(salt.utils.fsutils, "_blkid_output", mock):
                 mock = MagicMock(
                     return_value={"/dev/sda3": [{"mount_point": None}]}
                 )
                 with patch.object(salt.utils.fsutils, "_get_mounts", mock):
                     self.assertDictEqual(
                         btrfs.convert("/dev/sda3", permanent=True), ret
                     )
Ejemplo n.º 3
0
 def test_convert(self):
     '''
     Test if it convert ext2/3/4 to BTRFS
     '''
     ret = {'after': {'balance_log': 'Salt',
                      'ext4_image': 'removed',
                      'ext4_image_info': 'N/A',
                      'fsck_status': 'N/A',
                      'mount_point': None,
                      'type': 'ext4'},
            'before': {'fsck_status': 'Filesystem errors corrected',
                       'mount_point': None,
                       'type': 'ext4'}}
     mock = MagicMock(return_value={'retcode': 1,
                                    'stderr': '',
                                    'stdout': 'Salt'})
     with patch.dict(btrfs.__salt__, {'cmd.run_all': mock}):
         mock = MagicMock(return_value={'/dev/sda3': {'type': 'ext4'}})
         with patch.object(salt.utils.fsutils, '_blkid_output', mock):
             mock = MagicMock(return_value={'/dev/sda3': [{'mount_point': None}]})
             with patch.object(salt.utils.fsutils, '_get_mounts', mock):
                 self.assertDictEqual(btrfs.convert('/dev/sda3', permanent=True),
                                     ret)