Exemplo n.º 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()
Exemplo n.º 2
0
    def test_job_grouping(self):
        control_map = {
            'mach1': trigger.map_action.machine_info(
                    ('control1', 'control2'), {'2.6.20': 'config1'}),
            'mach2': trigger.map_action.machine_info(
                    ('control3',), {'2.6.10': 'config2', '2.6.20': 'config1'}),
            'mach3': trigger.map_action.machine_info(
                    ('control2', 'control3'), {'2.6.20': 'config1'}),
            }
        action = trigger.map_action(control_map, 'jobname %s')

        self.god.stub_function(action, '_generate_control')
        self.god.stub_function(action, '_schedule_job')

        (action._generate_control.expect_call('control2', '2.6.21', 'config1')
                .and_return('control contents2'))
        action._schedule_job.expect_call('jobname 2.6.21', 'control contents2',
                                         ['mach1', 'mach3'], False)

        (action._generate_control.expect_call('control3', '2.6.21', 'config1')
                .and_return('control contents3'))
        action._schedule_job.expect_call('jobname 2.6.21', 'control contents3',
                                         ['mach2', 'mach3'], False)

        (action._generate_control.expect_call('control1', '2.6.21', 'config1')
                .and_return('control contents1'))
        action._schedule_job.expect_call('jobname 2.6.21', 'control contents1',
                                         ['mach1'], False)

        action(['2.6.21'])
        self.god.check_playback()
Exemplo n.º 3
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()
Exemplo n.º 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()
Exemplo n.º 5
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()
Exemplo n.º 6
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()
Exemplo n.º 7
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.add_action(trigger_module.map_action(_tests_map, 'kerntest-%s'))
trigger.add_action(trigger_module.email_action('*****@*****.**'))
Exemplo n.º 8
0
    # -mm tree
    r"^(.*/)?(?P<arg>2\.6\.\d+(-rc\d+)?-mm\d+)\.bz2$",
)

# associate kernel versions with kernel config files
# 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.add_action(trigger_module.map_action(_tests_map, "kerntest-%s"))
trigger.add_action(trigger_module.email_action("*****@*****.**"))
Exemplo n.º 9
0
# associate kernel versions with kernel config files
# 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 control filenames
# and kernel version association to kernel config filenames)
_control_map = {
    'mach1': trigger_module.map_action.machine_info(
            ('/path/to/control1', '~/control2.srv'), _common_kernel_config),
    'mach2': trigger_module.map_action.machine_info(
            ('/path/to/control1',), _common_kernel_config),
    'mach3': trigger_module.map_action.machine_info(
            ('/path/to/control3',), _common_kernel_config),
    'mach4': trigger_module.map_action.machine_info(
            ('/path/to/control4',), _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.add_action(trigger_module.map_action(_control_map, 'kerntest-%s'))
trigger.add_action(trigger_module.email_action('*****@*****.**'))