| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The LUCI Authors. All rights reserved. | 2 # Copyright 2014 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed by the Apache v2.0 license that can be | 3 # Use of this source code is governed by the Apache v2.0 license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import datetime | 6 import datetime |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import random | 9 import random |
| 10 import sys | 10 import sys |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 complete_ts = self.now + datetime.timedelta(seconds=6) | 306 complete_ts = self.now + datetime.timedelta(seconds=6) |
| 307 self.mock_now(complete_ts) | 307 self.mock_now(complete_ts) |
| 308 run_result.completed_ts = complete_ts | 308 run_result.completed_ts = complete_ts |
| 309 run_result.duration = 0.1 | 309 run_result.duration = 0.1 |
| 310 run_result.exit_code = 0 | 310 run_result.exit_code = 0 |
| 311 run_result.state = task_result.State.COMPLETED | 311 run_result.state = task_result.State.COMPLETED |
| 312 run_result.modified_ts = utils.utcnow() | 312 run_result.modified_ts = utils.utcnow() |
| 313 task_result.PerformanceStats( | 313 task_result.PerformanceStats( |
| 314 key=task_pack.run_result_key_to_performance_stats_key(run_result.key), | 314 key=task_pack.run_result_key_to_performance_stats_key(run_result.key), |
| 315 bot_overhead=0.1, | 315 bot_overhead=0.1, |
| 316 isolated_download=task_result.IsolatedOperation( | 316 isolated_download=task_result.OperationStats( |
| 317 duration=0.05, initial_number_items=10, initial_size=10000, | 317 duration=0.05, initial_number_items=10, initial_size=10000, |
| 318 items_cold='foo', items_hot='bar'), | 318 items_cold='foo', items_hot='bar'), |
| 319 isolated_upload=task_result.IsolatedOperation( | 319 isolated_upload=task_result.OperationStats( |
| 320 duration=0.01, items_cold='foo')).put() | 320 duration=0.01, items_cold='foo')).put() |
| 321 ndb.transaction(lambda: ndb.put_multi(run_result.append_output('foo', 0))) | 321 ndb.transaction(lambda: ndb.put_multi(run_result.append_output('foo', 0))) |
| 322 result_summary.set_from_run_result(run_result, request) | 322 result_summary.set_from_run_result(run_result, request) |
| 323 ndb.transaction(lambda: ndb.put_multi((result_summary, run_result))) | 323 ndb.transaction(lambda: ndb.put_multi((result_summary, run_result))) |
| 324 expected = { | 324 expected = { |
| 325 'abandoned_ts': None, | 325 'abandoned_ts': None, |
| 326 'bot_dimensions': {}, | 326 'bot_dimensions': {}, |
| 327 'bot_id': u'localhost', | 327 'bot_id': u'localhost', |
| 328 'bot_version': u'abc', | 328 'bot_version': u'abc', |
| 329 'children_task_ids': [], | 329 'children_task_ids': [], |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 task_result.TaskOutput.CHUNK_SIZE * '\x00' + 'Baz\x00Bar\x00FooWow', | 679 task_result.TaskOutput.CHUNK_SIZE * '\x00' + 'Baz\x00Bar\x00FooWow', |
| 680 self.run_result.get_output()) | 680 self.run_result.get_output()) |
| 681 self.assertTaskOutputChunk( | 681 self.assertTaskOutputChunk( |
| 682 [{'chunk': 'Baz\x00Bar\x00FooWow', 'gaps': [3, 4, 7, 8]}]) | 682 [{'chunk': 'Baz\x00Bar\x00FooWow', 'gaps': [3, 4, 7, 8]}]) |
| 683 | 683 |
| 684 | 684 |
| 685 if __name__ == '__main__': | 685 if __name__ == '__main__': |
| 686 if '-v' in sys.argv: | 686 if '-v' in sys.argv: |
| 687 unittest.TestCase.maxDiff = None | 687 unittest.TestCase.maxDiff = None |
| 688 unittest.main() | 688 unittest.main() |
| OLD | NEW |