Пример #1
0
    def test_upload_kernel_config(self):
        tests_map = {
            'mach1': trigger.map_action.machine_info(
                ('test1',), {'2.6.20': 'config1'}),
            'mach3': trigger.map_action.machine_info(
                ('test1',), {'2.6.20': 'config1'})
        }

        action = trigger.map_action(tests_map, 'jobname %s',
                                    upload_kernel_config=True)
        self.assertTrue(isinstance(action._afe, trigger.frontend.AFE))
        action._afe = self.god.create_mock_class(trigger.frontend.AFE, 'AFE')

        control = self._make_control_dict('control contents', is_server=True)
        (action._afe.generate_control_file.expect_call(
            tests=['test1'],
            kernel=[dict(version='2.6.21', config_file='config1')],
            upload_kernel_config=True)
         .and_return(control))
        action._afe.create_job.expect_call(
            control.control_file, 'jobname 2.6.21',
            control_type='Server', hosts=['mach1', 'mach3'])

        action(['2.6.21'])
        self.god.check_playback()
Пример #2
0
    def test_upload_kernel_config(self):
        tests_map = {
            'mach1': trigger.map_action.machine_info(
                ('test1',), {'2.6.20': 'config1'}),
            'mach3': trigger.map_action.machine_info(
                ('test1',), {'2.6.20': 'config1'})
        }

        action = trigger.map_action(tests_map, 'jobname %s',
                                    upload_kernel_config=True)
        self.assertTrue(isinstance(action._afe, trigger.frontend.AFE))
        action._afe = self.god.create_mock_class(trigger.frontend.AFE, 'AFE')

        control = self._make_control_dict('control contents', is_server=True)
        (action._afe.generate_control_file.expect_call(
            tests=['test1'],
            kernel=[dict(version='2.6.21', config_file='config1')],
            upload_kernel_config=True)
         .and_return(control))
        action._afe.create_job.expect_call(
            control.control_file, 'jobname 2.6.21',
            control_type='Server', hosts=['mach1', 'mach3'])

        action(['2.6.21'])
        self.god.check_playback()
Пример #3
0
    def test_job_grouping(self):
        tests_map = {
            'mach1':
            trigger.map_action.machine_info(('test1', 'test2'),
                                            {'2.6.20': 'config1'}),
            'mach2':
            trigger.map_action.machine_info(('test3', ), {
                '2.6.10': 'config2',
                '2.6.20': 'config1'
            }),
            'mach3':
            trigger.map_action.machine_info(('test2', 'test3'),
                                            {'2.6.20': 'config1'}),
        }
        action = trigger.map_action(tests_map, 'jobname %s')
        self.assertTrue(isinstance(action._afe, trigger.frontend.AFE))
        action._afe = self.god.create_mock_class(trigger.frontend.AFE, 'AFE')

        control2 = self._make_control_dict('control contents2')
        (action._afe.generate_control_file.expect_call(
            tests=['test2'],
            kernel=[dict(version='2.6.21', config_file='config1')],
            upload_kernel_config=False).and_return(control2))
        action._afe.create_job.expect_call(control2.control_file,
                                           'jobname 2.6.21',
                                           control_type='Client',
                                           hosts=['mach1', 'mach3'])

        control3 = self._make_control_dict('control contents3', is_server=True)
        (action._afe.generate_control_file.expect_call(
            tests=['test3'],
            kernel=[dict(version='2.6.21', config_file='config1')],
            upload_kernel_config=False).and_return(control3))
        action._afe.create_job.expect_call(control3.control_file,
                                           'jobname 2.6.21',
                                           control_type='Server',
                                           hosts=['mach2', 'mach3'])

        control1 = self._make_control_dict('control contents1')
        (action._afe.generate_control_file.expect_call(
            tests=['test1'],
            kernel=[dict(version='2.6.21', config_file='config1')],
            upload_kernel_config=False).and_return(control1))
        action._afe.create_job.expect_call(control1.control_file,
                                           'jobname 2.6.21',
                                           control_type='Client',
                                           hosts=['mach1'])

        action(['2.6.21'])
        self.god.check_playback()
Пример #4
0
    def test_job_grouping(self):
        tests_map = {
            'mach1': trigger.map_action.machine_info(
                ('test1', 'test2'), {'2.6.20': 'config1'}),
            'mach2': trigger.map_action.machine_info(
                ('test3',), {'2.6.10': 'config2', '2.6.20': 'config1'}),
            'mach3': trigger.map_action.machine_info(
                ('test2', 'test3'), {'2.6.20': 'config1'}),
        }
        action = trigger.map_action(tests_map, 'jobname %s')
        self.assertTrue(isinstance(action._afe, trigger.frontend.AFE))
        action._afe = self.god.create_mock_class(trigger.frontend.AFE, 'AFE')

        control2 = self._make_control_dict('control contents2')
        (action._afe.generate_control_file.expect_call(
            tests=['test2'],
            kernel=[dict(version='2.6.21', config_file='config1')],
            upload_kernel_config=False)
         .and_return(control2))
        action._afe.create_job.expect_call(
            control2.control_file, 'jobname 2.6.21',
            control_type='Client', hosts=['mach1', 'mach3'])

        control3 = self._make_control_dict('control contents3', is_server=True)
        (action._afe.generate_control_file.expect_call(
            tests=['test3'],
            kernel=[dict(version='2.6.21', config_file='config1')],
            upload_kernel_config=False)
         .and_return(control3))
        action._afe.create_job.expect_call(
            control3.control_file, 'jobname 2.6.21',
            control_type='Server', hosts=['mach2', 'mach3'])

        control1 = self._make_control_dict('control contents1')
        (action._afe.generate_control_file.expect_call(
            tests=['test1'],
            kernel=[dict(version='2.6.21', config_file='config1')],
            upload_kernel_config=False)
         .and_return(control1))
        action._afe.create_job.expect_call(
            control1.control_file, 'jobname 2.6.21',
            control_type='Client', hosts=['mach1'])

        action(['2.6.21'])
        self.god.check_playback()
Пример #5
0
# all machines have the same hardware configuration so they will all
# use the same mapping for kernel version -> kernel config file
_common_kernel_config = {
    '2.6.20': '/path/to/2.6.20.config',
    '2.6.25': '~/kernel-2.6.25.config',
    '2.6.29': 'http://somesite/configs/2.6.29.conf',
    }

# a mapping of machine -> machine_info (containing list a of test names as
# they are named in the frontend database and kernel version association to
# kernel config filenames)
_tests_map = {
    'mach1': trigger_module.map_action.machine_info(
            ('test1', 'server test2'), _common_kernel_config),
    'mach2': trigger_module.map_action.machine_info(
            ('test1',), _common_kernel_config),
    'mach3': trigger_module.map_action.machine_info(
            ('test3',), _common_kernel_config),
    'mach4': trigger_module.map_action.machine_info(
            ('test4',), _common_kernel_config),
    }

# no need to instantiate trigger_module.trigger() as it's already done so
# trigger = trigger_module.trigger()

# now register some trigger actions otherwise nothing will be done for the new
# kernel versions
trigger = trigger_module.trigger()
trigger.add_action(trigger_module.map_action(_tests_map, 'kerntest-%s'))
trigger.add_action(trigger_module.email_action('*****@*****.**'))
Пример #6
0
# use the same mapping for kernel version -> kernel config file
_common_kernel_config = {
    '2.6.20': '/path/to/2.6.20.config',
    '2.6.25': '~/kernel-2.6.25.config',
    '2.6.29': 'http://somesite/configs/2.6.29.conf',
}

# a mapping of machine -> machine_info (containing list a of test names as
# they are named in the frontend database and kernel version association to
# kernel config filenames)
_tests_map = {
    'mach1':
    trigger_module.map_action.machine_info(('test1', 'server test2'),
                                           _common_kernel_config),
    'mach2':
    trigger_module.map_action.machine_info(('test1', ), _common_kernel_config),
    'mach3':
    trigger_module.map_action.machine_info(('test3', ), _common_kernel_config),
    'mach4':
    trigger_module.map_action.machine_info(('test4', ), _common_kernel_config),
}

# no need to instantiate trigger_module.trigger() as it's already done so
# trigger = trigger_module.trigger()

# now register some trigger actions otherwise nothing will be done for the new
# kernel versions
trigger = trigger_module.trigger()
trigger.add_action(trigger_module.map_action(_tests_map, 'kerntest-%s'))
trigger.add_action(trigger_module.email_action('*****@*****.**'))