Exemplo n.º 1
0
    def test_run_success(self):
        expected = actions.Result(data={'errors': [], 'warnings': []})

        action_args = {
            'node': self.node,
            'kernel_id': self.kernel_id,
            'ramdisk_id': self.ramdisk_id,
        }
        action = validations.CheckNodeBootConfigurationAction(**action_args)
        self.assertEqual(expected, action.run(self.ctx))
Exemplo n.º 2
0
    def test_run_invalid_ramdisk(self):
        expected = actions.Result(
            error={
                'errors': [
                    'Node 100f2cf6-06de-480e-a73e-6fdf6c9962b7 has an '
                    'incorrectly configured driver_info/deploy_ramdisk. '
                    'Expected "67890" but got "98760".'
                ],
                'warnings': []
            })

        node = self.node.copy()
        node['driver_info']['deploy_ramdisk'] = '98760'
        action_args = {
            'node': node,
            'kernel_id': self.kernel_id,
            'ramdisk_id': self.ramdisk_id,
        }
        action = validations.CheckNodeBootConfigurationAction(**action_args)
        self.assertEqual(expected, action.run(self.ctx))
Exemplo n.º 3
0
    def test_no_boot_option_local(self):
        expected = actions.Result(
            data={
                'errors': [],
                'warnings': [
                    'Node 100f2cf6-06de-480e-a73e-6fdf6c9962b7 is not '
                    'configured to use boot_option:local in capabilities. '
                    'It will not be used for deployment with flavors that '
                    'require boot_option:local.'
                ]
            })

        node = self.node.copy()
        node['properties']['capabilities'] = 'boot_option:not_local'

        action_args = {
            'node': node,
            'kernel_id': self.kernel_id,
            'ramdisk_id': self.ramdisk_id,
        }

        action = validations.CheckNodeBootConfigurationAction(**action_args)
        self.assertEqual(expected, action.run(self.ctx))