How to use _make_control_dict method in autotest

Best Python code snippet using autotest_python

trigger_unittest.py

Source:trigger_unittest.py Github

copy

Full Screen

...18 info = trigger.map_action.machine_info(tests, configs)19 self.assertEquals(tests, info.tests)20 self.assertEquals(configs, info.kernel_configs)21 @staticmethod22 def _make_control_dict(contents, is_server=False, synch_count=1,23 dependencies=()):24 class ControlFile(object):25 def __init__(self, contents, is_server, synch_count, dependencies):26 self.control_file = contents27 self.is_server = is_server28 self.synch_count = synch_count29 self.dependencies = dependencies30 return ControlFile(contents, is_server, synch_count, dependencies)31 def test_job_grouping(self):32 tests_map = {33 'mach1': trigger.map_action.machine_info(34 ('test1', 'test2'), {'2.6.20': 'config1'}),35 'mach2': trigger.map_action.machine_info(36 ('test3',), {'2.6.10': 'config2', '2.6.20': 'config1'}),37 'mach3': trigger.map_action.machine_info(38 ('test2', 'test3'), {'2.6.20': 'config1'}),39 }40 action = trigger.map_action(tests_map, 'jobname %s')41 self.assertTrue(isinstance(action._afe, trigger.frontend.AFE))42 action._afe = self.god.create_mock_class(trigger.frontend.AFE, 'AFE')43 control2 = self._make_control_dict('control contents2')44 (action._afe.generate_control_file.expect_call(45 tests=['test2'],46 kernel=[dict(version='2.6.21', config_file='config1')],47 upload_kernel_config=False)48 .and_return(control2))49 action._afe.create_job.expect_call(50 control2.control_file, 'jobname 2.6.21',51 control_type='Client', hosts=['mach1', 'mach3'])52 control3 = self._make_control_dict('control contents3', is_server=True)53 (action._afe.generate_control_file.expect_call(54 tests=['test3'],55 kernel=[dict(version='2.6.21', config_file='config1')],56 upload_kernel_config=False)57 .and_return(control3))58 action._afe.create_job.expect_call(59 control3.control_file, 'jobname 2.6.21',60 control_type='Server', hosts=['mach2', 'mach3'])61 control1 = self._make_control_dict('control contents1')62 (action._afe.generate_control_file.expect_call(63 tests=['test1'],64 kernel=[dict(version='2.6.21', config_file='config1')],65 upload_kernel_config=False)66 .and_return(control1))67 action._afe.create_job.expect_call(68 control1.control_file, 'jobname 2.6.21',69 control_type='Client', hosts=['mach1'])70 action(['2.6.21'])71 self.god.check_playback()72 def test_kver_cmp(self):73 def check_cmp(ver1, ver2):74 # function to make sure "cmp" invariants are followed75 cmp_func = trigger.map_action._kver_cmp76 if ver1 != ver2:77 self.assertEquals(cmp_func(ver1, ver2), -1)78 self.assertEquals(cmp_func(ver2, ver1), 1)79 else:80 self.assertEquals(cmp_func(ver1, ver2), 0)81 self.assertEquals(cmp_func(ver2, ver1), 0)82 check_cmp('2.6.20', '2.6.20')83 check_cmp('2.6.20', '2.6.21')84 check_cmp('2.6.20', '2.6.21-rc2')85 check_cmp('2.6.20-rc2-git2', '2.6.20-rc2')86 def test_upload_kernel_config(self):87 tests_map = {88 'mach1': trigger.map_action.machine_info(89 ('test1',), {'2.6.20': 'config1'}),90 'mach3': trigger.map_action.machine_info(91 ('test1',), {'2.6.20': 'config1'})92 }93 action = trigger.map_action(tests_map, 'jobname %s',94 upload_kernel_config=True)95 self.assertTrue(isinstance(action._afe, trigger.frontend.AFE))96 action._afe = self.god.create_mock_class(trigger.frontend.AFE, 'AFE')97 control = self._make_control_dict('control contents', is_server=True)98 (action._afe.generate_control_file.expect_call(99 tests=['test1'],100 kernel=[dict(version='2.6.21', config_file='config1')],101 upload_kernel_config=True)102 .and_return(control))103 action._afe.create_job.expect_call(104 control.control_file, 'jobname 2.6.21',105 control_type='Server', hosts=['mach1', 'mach3'])106 action(['2.6.21'])107 self.god.check_playback()108if __name__ == "__main__":...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful