Ejemplo n.º 1
0
 def test_make_partitions(self, mock_exc):
     expected_mkpart = ['mkpart', 'primary', '', '1', '1025',
                        'mkpart', 'primary', 'linux-swap', '1025', '1537']
     cmd = self.parted_static_cmd + expected_mkpart
     utils.make_partitions(self.dev, self.root_mb, self.swap_mb,
                           self.ephemeral_mb)
     mock_exc.assert_called_once_with(*cmd, run_as_root=True,
                                      check_exit_code=[0])
Ejemplo n.º 2
0
 def test_make_partitions(self, mock_exc):
     expected_mkpart = ['mkpart', 'primary', '', '1', '1025',
                        'mkpart', 'primary', 'linux-swap', '1025', '1537']
     cmd = self.parted_static_cmd + expected_mkpart
     utils.make_partitions(self.dev, self.root_mb, self.swap_mb,
                           self.ephemeral_mb)
     mock_exc.assert_called_once_with(*cmd,
                                      run_as_root=True, attempts=3,
                                      check_exit_code=[0])
Ejemplo n.º 3
0
 def test_make_partitions_with_ephemeral(self, mock_exc):
     self.ephemeral_mb = 2048
     expected_mkpart = ['mkpart', 'primary', '', '1', '2049',
                        'mkpart', 'primary', 'linux-swap', '2049', '2561',
                        'mkpart', 'primary', '', '2561', '3585']
     cmd = self.parted_static_cmd + expected_mkpart
     utils.make_partitions(self.dev, self.root_mb, self.swap_mb,
                           self.ephemeral_mb)
     mock_exc.assert_called_once_with(*cmd,
                                      run_as_root=True, attempts=3,
                                      check_exit_code=[0])
Ejemplo n.º 4
0
    def test_make_partitions_with_ephemeral(self, mock_exc):
        self.ephemeral_mb = 2048
        expected_mkpart = ['mkpart', 'primary', '', '1', '2049',
                           'mkpart', 'primary', 'linux-swap', '2049', '2561',
                           'mkpart', 'primary', '', '2561', '3585']
        cmd = self.parted_static_cmd + expected_mkpart
        mock_exc.return_value = (None, None)
        utils.make_partitions(self.dev, self.root_mb, self.swap_mb,
                              self.ephemeral_mb, self.configdrive_mb)

        parted_call = mock.call(*cmd, run_as_root=True, check_exit_code=[0])
        mock_exc.assert_has_calls(parted_call)
Ejemplo n.º 5
0
    def test_make_partitions_with_ephemeral(self, mock_exc):
        self.ephemeral_mb = 2048
        expected_mkpart = ['mkpart', 'primary', '', '1', '2049',
                           'mkpart', 'primary', 'linux-swap', '2049', '2561',
                           'mkpart', 'primary', '', '2561', '3585']
        cmd = self.parted_static_cmd + expected_mkpart
        mock_exc.return_value = (None, None)
        utils.make_partitions(self.dev, self.root_mb, self.swap_mb,
                              self.ephemeral_mb)

        parted_call = mock.call(*cmd, run_as_root=True, check_exit_code=[0])
        mock_exc.assert_has_calls(parted_call)
Ejemplo n.º 6
0
 def test_make_partitions_with_ephemeral(self, mock_exc):
     self.ephemeral_mb = 2048
     expected_mkpart = [
         'mkpart', 'primary', '', '1', '2049', 'mkpart', 'primary',
         'linux-swap', '2049', '2561', 'mkpart', 'primary', '', '2561',
         '3585'
     ]
     cmd = self.parted_static_cmd + expected_mkpart
     utils.make_partitions(self.dev, self.root_mb, self.swap_mb,
                           self.ephemeral_mb)
     mock_exc.assert_called_once_with(*cmd,
                                      run_as_root=True,
                                      check_exit_code=[0])
Ejemplo n.º 7
0
    def test_make_partitions(self, mock_exc):
        mock_exc.return_value = (None, None)
        utils.make_partitions(self.dev, self.root_mb, self.swap_mb,
                              self.ephemeral_mb, self.configdrive_mb)

        expected_mkpart = ['mkpart', 'primary', 'linux-swap', '1', '513',
                           'mkpart', 'primary', '', '513', '1537']
        parted_cmd = self.parted_static_cmd + expected_mkpart
        parted_call = mock.call(*parted_cmd, run_as_root=True,
                                check_exit_code=[0])
        fuser_cmd = ['fuser', 'fake-dev']
        fuser_call = mock.call(*fuser_cmd, run_as_root=True,
                               check_exit_code=[0, 1])
        mock_exc.assert_has_calls([parted_call, fuser_call])
Ejemplo n.º 8
0
    def test_make_partitions(self, mock_exc):
        mock_exc.return_value = (None, None)
        utils.make_partitions(self.dev, self.root_mb, self.swap_mb,
                              self.ephemeral_mb)

        expected_mkpart = ['mkpart', 'primary', 'linux-swap', '1', '513',
                           'mkpart', 'primary', '', '513', '1537']
        parted_cmd = self.parted_static_cmd + expected_mkpart
        parted_call = mock.call(*parted_cmd, run_as_root=True,
                                check_exit_code=[0])
        fuser_cmd = ['fuser', 'fake-dev']
        fuser_call = mock.call(*fuser_cmd, run_as_root=True,
                               check_exit_code=[0, 1])
        mock_exc.assert_has_calls([parted_call, fuser_call])