How to use _test_basic_scheduling_helper method in autotest

Best Python code snippet using autotest_python

monitor_db_unittest.py

Source:monitor_db_unittest.py Github

copy

Full Screen

...175 def _run_scheduler(self):176 self._dispatcher._host_scheduler.tick()177 for _ in xrange(2): # metahost scheduling can take two ticks178 self._dispatcher._schedule_new_jobs()179 def _test_basic_scheduling_helper(self, use_metahosts):180 'Basic nonmetahost scheduling'181 self._create_job_simple([1], use_metahosts)182 self._create_job_simple([2], use_metahosts)183 self._run_scheduler()184 self._assert_job_scheduled_on(1, 1)185 self._assert_job_scheduled_on(2, 2)186 self._check_for_extra_schedulings()187 def _test_priorities_helper(self, use_metahosts):188 'Test prioritization ordering'189 self._create_job_simple([1], use_metahosts)190 self._create_job_simple([2], use_metahosts)191 self._create_job_simple([1,2], use_metahosts)192 self._create_job_simple([1], use_metahosts, priority=1)193 self._run_scheduler()194 self._assert_job_scheduled_on(4, 1) # higher priority195 self._assert_job_scheduled_on(2, 2) # earlier job over later196 self._check_for_extra_schedulings()197 def _test_hosts_ready_helper(self, use_metahosts):198 """199 Only hosts that are status=Ready, unlocked and not invalid get200 scheduled.201 """202 self._create_job_simple([1], use_metahosts)203 self._do_query('UPDATE afe_hosts SET status="Running" WHERE id=1')204 self._run_scheduler()205 self._check_for_extra_schedulings()206 self._do_query('UPDATE afe_hosts SET status="Ready", locked=1 '207 'WHERE id=1')208 self._run_scheduler()209 self._check_for_extra_schedulings()210 self._do_query('UPDATE afe_hosts SET locked=0, invalid=1 '211 'WHERE id=1')212 self._run_scheduler()213 if not use_metahosts:214 self._assert_job_scheduled_on(1, 1)215 self._check_for_extra_schedulings()216 def _test_hosts_idle_helper(self, use_metahosts):217 'Only idle hosts get scheduled'218 self._create_job(hosts=[1], active=True)219 self._create_job_simple([1], use_metahosts)220 self._run_scheduler()221 self._check_for_extra_schedulings()222 def _test_obey_ACLs_helper(self, use_metahosts):223 self._do_query('DELETE FROM afe_acl_groups_hosts WHERE host_id=1')224 self._create_job_simple([1], use_metahosts)225 self._run_scheduler()226 self._check_for_extra_schedulings()227 def test_basic_scheduling(self):228 self._test_basic_scheduling_helper(False)229 def test_priorities(self):230 self._test_priorities_helper(False)231 def test_hosts_ready(self):232 self._test_hosts_ready_helper(False)233 def test_hosts_idle(self):234 self._test_hosts_idle_helper(False)235 def test_obey_ACLs(self):236 self._test_obey_ACLs_helper(False)237 def test_one_time_hosts_ignore_ACLs(self):238 self._do_query('DELETE FROM afe_acl_groups_hosts WHERE host_id=1')239 self._do_query('UPDATE afe_hosts SET invalid=1 WHERE id=1')240 self._create_job_simple([1])241 self._run_scheduler()242 self._assert_job_scheduled_on(1, 1)243 self._check_for_extra_schedulings()244 def test_non_metahost_on_invalid_host(self):245 """246 Non-metahost entries can get scheduled on invalid hosts (this is how247 one-time hosts work).248 """249 self._do_query('UPDATE afe_hosts SET invalid=1')250 self._test_basic_scheduling_helper(False)251 def test_metahost_scheduling(self):252 """253 Basic metahost scheduling254 """255 self._test_basic_scheduling_helper(True)256 def test_metahost_priorities(self):257 self._test_priorities_helper(True)258 def test_metahost_hosts_ready(self):259 self._test_hosts_ready_helper(True)260 def test_metahost_hosts_idle(self):261 self._test_hosts_idle_helper(True)262 def test_metahost_obey_ACLs(self):263 self._test_obey_ACLs_helper(True)264 def test_nonmetahost_over_metahost(self):265 """266 Non-metahost entries should take priority over metahost entries267 for the same host268 """269 self._create_job(metahosts=[1])...

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