| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The LUCI Authors. All rights reserved. | 2 # Copyright 2013 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed under the Apache License, Version 2.0 | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
| 4 # that can be found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
| 5 | 5 |
| 6 import json | 6 import json |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 import tempfile | 10 import tempfile |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 self.root_dir, 'w', 'task_runner_out.json') | 491 self.root_dir, 'w', 'task_runner_out.json') |
| 492 expected = [ | 492 expected = [ |
| 493 sys.executable, bot_main.THIS_FILE, 'task_runner', | 493 sys.executable, bot_main.THIS_FILE, 'task_runner', |
| 494 '--swarming-server', url, | 494 '--swarming-server', url, |
| 495 '--in-file', | 495 '--in-file', |
| 496 os.path.join(self.root_dir, 'w', 'task_runner_in.json'), | 496 os.path.join(self.root_dir, 'w', 'task_runner_in.json'), |
| 497 '--out-file', self2._out_file, | 497 '--out-file', self2._out_file, |
| 498 '--cost-usd-hour', '3600.0', '--start', '100.0', | 498 '--cost-usd-hour', '3600.0', '--start', '100.0', |
| 499 '--min-free-space', | 499 '--min-free-space', |
| 500 str(int( | 500 str(int( |
| 501 (os_utilities.get_min_free_space(bot_main.THIS_FILE) + 250.) * | 501 os_utilities.get_desired_free_space(bot_main.THIS_FILE)*1024*1024)), |
| 502 1024 * 1024)), | |
| 503 ] | 502 ] |
| 504 self.assertEqual(cmd[15], '--bot-file') | 503 self.assertEqual(cmd[15], '--bot-file') |
| 505 self.assertTrue(cmd[16].endswith('.json')) | 504 self.assertTrue(cmd[16].endswith('.json')) |
| 506 del cmd[15:17] | 505 del cmd[15:17] |
| 507 if expected_auth_params_json: | 506 if expected_auth_params_json: |
| 508 auth_params_file = os.path.join( | 507 auth_params_file = os.path.join( |
| 509 self.root_dir, 'w', 'bot_auth_params.json') | 508 self.root_dir, 'w', 'bot_auth_params.json') |
| 510 with open(auth_params_file, 'rb') as f: | 509 with open(auth_params_file, 'rb') as f: |
| 511 actual_auth_params = json.load(f) | 510 actual_auth_params = json.load(f) |
| 512 self.assertEqual(expected_auth_params_json, actual_auth_params) | 511 self.assertEqual(expected_auth_params_json, actual_auth_params) |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 self.assertEqual(0, bot_main.main([])) | 718 self.assertEqual(0, bot_main.main([])) |
| 720 | 719 |
| 721 | 720 |
| 722 if __name__ == '__main__': | 721 if __name__ == '__main__': |
| 723 fix_encoding.fix_encoding() | 722 fix_encoding.fix_encoding() |
| 724 if '-v' in sys.argv: | 723 if '-v' in sys.argv: |
| 725 TestBotMain.maxDiff = None | 724 TestBotMain.maxDiff = None |
| 726 logging.basicConfig( | 725 logging.basicConfig( |
| 727 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL) | 726 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL) |
| 728 unittest.main() | 727 unittest.main() |
| OLD | NEW |