Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: scheduler/monitor_db_functional_test.py

Issue 6597047: Host scheduler refactoring. Move HostScheduler out of monitor_db. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: Revert name change. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « scheduler/monitor_db.py ('k') | scheduler/monitor_db_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 import logging, os, unittest 3 import logging, os, unittest
4 import common 4 import common
5 from autotest_lib.client.common_lib import enum, global_config, host_protections 5 from autotest_lib.client.common_lib import enum, global_config, host_protections
6 from autotest_lib.database import database_connection 6 from autotest_lib.database import database_connection
7 from autotest_lib.frontend import setup_django_environment 7 from autotest_lib.frontend import setup_django_environment
8 from autotest_lib.frontend.afe import frontend_test_utils, models 8 from autotest_lib.frontend.afe import frontend_test_utils, models
9 from autotest_lib.frontend.afe import model_attributes 9 from autotest_lib.frontend.afe import model_attributes
10 from autotest_lib.scheduler import drone_manager, email_manager, monitor_db 10 from autotest_lib.scheduler import drone_manager, email_manager, host_scheduler
11 from autotest_lib.scheduler import scheduler_models 11 from autotest_lib.scheduler import monitor_db, scheduler_models
12 12
13 # translations necessary for scheduler queries to work with SQLite 13 # translations necessary for scheduler queries to work with SQLite
14 _re_translator = database_connection.TranslatingDatabase.make_regexp_translator 14 _re_translator = database_connection.TranslatingDatabase.make_regexp_translator
15 _DB_TRANSLATORS = ( 15 _DB_TRANSLATORS = (
16 _re_translator(r'NOW\(\)', 'time("now")'), 16 _re_translator(r'NOW\(\)', 'time("now")'),
17 _re_translator(r'LAST_INSERT_ID\(\)', 'LAST_INSERT_ROWID()'), 17 _re_translator(r'LAST_INSERT_ID\(\)', 'LAST_INSERT_ROWID()'),
18 # older SQLite doesn't support group_concat, so just don't bother until 18 # older SQLite doesn't support group_concat, so just don't bother until
19 # it arises in an important query 19 # it arises in an important query
20 _re_translator(r'GROUP_CONCAT\((.*?)\)', r'\1'), 20 _re_translator(r'GROUP_CONCAT\((.*?)\)', r'\1'),
21 ) 21 )
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 host=queue_entry.host, 724 host=queue_entry.host,
725 task=models.SpecialTask.Task.VERIFY, 725 task=models.SpecialTask.Task.VERIFY,
726 requested_by=models.User.current_user()) 726 requested_by=models.User.current_user())
727 models.SpecialTask.objects.create( 727 models.SpecialTask.objects.create(
728 host=queue_entry.host, 728 host=queue_entry.host,
729 task=models.SpecialTask.Task.CLEANUP, 729 task=models.SpecialTask.Task.CLEANUP,
730 queue_entry=queue_entry, 730 queue_entry=queue_entry,
731 is_complete=True, 731 is_complete=True,
732 requested_by=models.User.current_user()) 732 requested_by=models.User.current_user())
733 733
734 self.assertRaises(monitor_db.SchedulerError, self._initialize_test) 734 self.assertRaises(host_scheduler.SchedulerError, self._initialize_test)
735 735
736 736
737 def _test_recover_verifying_hqe_helper(self, task, pidfile_type): 737 def _test_recover_verifying_hqe_helper(self, task, pidfile_type):
738 _, queue_entry = self._make_job_and_queue_entry() 738 _, queue_entry = self._make_job_and_queue_entry()
739 queue_entry.status = HqeStatus.VERIFYING 739 queue_entry.status = HqeStatus.VERIFYING
740 queue_entry.save() 740 queue_entry.save()
741 741
742 special_task = models.SpecialTask.objects.create( 742 special_task = models.SpecialTask.objects.create(
743 host=queue_entry.host, task=task, queue_entry=queue_entry) 743 host=queue_entry.host, task=task, queue_entry=queue_entry)
744 744
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 self.assert_(job_keyval_path in attached_files, attached_files) 1068 self.assert_(job_keyval_path in attached_files, attached_files)
1069 keyval_contents = attached_files[job_keyval_path] 1069 keyval_contents = attached_files[job_keyval_path]
1070 keyval_dict = dict(line.strip().split('=', 1) 1070 keyval_dict = dict(line.strip().split('=', 1)
1071 for line in keyval_contents.splitlines()) 1071 for line in keyval_contents.splitlines())
1072 self.assert_('job_queued' in keyval_dict, keyval_dict) 1072 self.assert_('job_queued' in keyval_dict, keyval_dict)
1073 self.assertEquals(keyval_dict['mykey'], 'myvalue') 1073 self.assertEquals(keyval_dict['mykey'], 'myvalue')
1074 1074
1075 1075
1076 if __name__ == '__main__': 1076 if __name__ == '__main__':
1077 unittest.main() 1077 unittest.main()
OLDNEW
« no previous file with comments | « scheduler/monitor_db.py ('k') | scheduler/monitor_db_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698