def test_space_required_for_mount_points(
            self, calculate_free_space_mock, find_mount_point_mock):

        checker = CheckFreeSpace(self.context)
        mount_points = checker.space_required_for_mount_points()

        self.assertEqual(mount_points, {'/etc': 10, '/var': 20})
Exemple #2
0
    def test_space_required_for_mount_points(self, calculate_free_space_mock,
                                             find_mount_point_mock):

        checker = CheckFreeSpace(self.context)
        mount_points = checker.space_required_for_mount_points()

        self.assertEqual(mount_points, {'/etc': 10, '/var': 20})
    def test_list_of_error_mount_points(
            self, calculate_free_space_mock, find_mount_point_mock):

        checker = CheckFreeSpace(self.context)
        error_mount_points = checker.list_of_error_mount_points({
            '/etc': 100, '/var': 2})
        self.assertEqual(
            error_mount_points,
            [{'available': 9, 'path': '/etc', 'size': 100}])
Exemple #4
0
    def test_list_of_error_mount_points(self, calculate_free_space_mock,
                                        find_mount_point_mock):

        checker = CheckFreeSpace(self.context)
        error_mount_points = checker.list_of_error_mount_points({
            '/etc': 100,
            '/var': 2
        })
        self.assertEqual(error_mount_points, [{
            'available': 9,
            'path': '/etc',
            'size': 100
        }])
    def test_check_raises_errors(
            self, calculate_free_space_mock, find_mount_point_mock):

        checker = CheckFreeSpace(self.context)
        err_msg = "Not enough free space on device: " +\
            "device /etc (required 10MB, available 9MB, not enough 1MB), " +\
            "device /var (required 20MB, available 9MB, not enough 11MB)"

        with self.assertRaises(errors.NotEnoughFreeSpaceOnDeviceError) as exc:
            checker.check()

        self.assertEqual(str(exc.exception), err_msg)
        self.called_times(find_mount_point_mock, 3)
        self.called_times(calculate_free_space_mock, 2)
Exemple #6
0
    def test_check_raises_errors(self, calculate_free_space_mock,
                                 find_mount_point_mock):

        checker = CheckFreeSpace(self.context)
        err_msg = "Not enough free space on device: " +\
            "device /etc (required 10MB, available 9MB, not enough 1MB), " +\
            "device /var (required 20MB, available 9MB, not enough 11MB)"

        with self.assertRaises(errors.NotEnoughFreeSpaceOnDeviceError) as exc:
            checker.check()

        self.assertEqual(str(exc.exception), err_msg)
        self.called_times(find_mount_point_mock, 3)
        self.called_times(calculate_free_space_mock, 2)
    def test_check(self, calculate_free_space_mock, find_mount_point_mock):
        checker = CheckFreeSpace(self.context)
        checker.check()

        self.called_times(find_mount_point_mock, 3)
        self.called_times(calculate_free_space_mock, 2)
Exemple #8
0
    def test_check(self, calculate_free_space_mock, find_mount_point_mock):
        checker = CheckFreeSpace(self.context)
        checker.check()

        self.called_times(find_mount_point_mock, 3)
        self.called_times(calculate_free_space_mock, 2)