| 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 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 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 23 matching lines...) Expand all Loading... |
| 34 def _gen_request(properties=None, **kwargs): | 34 def _gen_request(properties=None, **kwargs): |
| 35 """Creates a TaskRequest.""" | 35 """Creates a TaskRequest.""" |
| 36 props = { | 36 props = { |
| 37 'command': [u'command1'], | 37 'command': [u'command1'], |
| 38 'dimensions': {u'pool': u'default'}, | 38 'dimensions': {u'pool': u'default'}, |
| 39 'env': {}, | 39 'env': {}, |
| 40 'execution_timeout_secs': 24*60*60, | 40 'execution_timeout_secs': 24*60*60, |
| 41 'io_timeout_secs': None, | 41 'io_timeout_secs': None, |
| 42 } | 42 } |
| 43 props.update(properties or {}) | 43 props.update(properties or {}) |
| 44 props['dimensions_dict'] = props.pop('dimensions') |
| 44 now = utils.utcnow() | 45 now = utils.utcnow() |
| 45 args = { | 46 args = { |
| 46 'created_ts': now, | 47 'created_ts': now, |
| 47 'name': 'Request name', | 48 'name': 'Request name', |
| 48 'priority': 50, | 49 'priority': 50, |
| 49 'properties': task_request.TaskProperties(**props), | 50 'properties': task_request.TaskProperties(**props), |
| 50 'expiration_ts': now + datetime.timedelta(seconds=60), | 51 'expiration_ts': now + datetime.timedelta(seconds=60), |
| 51 'tags': [u'tag:1'], | 52 'tags': [u'tag:1'], |
| 52 'user': 'Jesus', | 53 'user': 'Jesus', |
| 53 } | 54 } |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 task_result.TaskOutput.CHUNK_SIZE * '\x00' + 'Baz\x00Bar\x00FooWow', | 694 task_result.TaskOutput.CHUNK_SIZE * '\x00' + 'Baz\x00Bar\x00FooWow', |
| 694 self.run_result.get_output()) | 695 self.run_result.get_output()) |
| 695 self.assertTaskOutputChunk( | 696 self.assertTaskOutputChunk( |
| 696 [{'chunk': 'Baz\x00Bar\x00FooWow', 'gaps': [3, 4, 7, 8]}]) | 697 [{'chunk': 'Baz\x00Bar\x00FooWow', 'gaps': [3, 4, 7, 8]}]) |
| 697 | 698 |
| 698 | 699 |
| 699 if __name__ == '__main__': | 700 if __name__ == '__main__': |
| 700 if '-v' in sys.argv: | 701 if '-v' in sys.argv: |
| 701 unittest.TestCase.maxDiff = None | 702 unittest.TestCase.maxDiff = None |
| 702 unittest.main() | 703 unittest.main() |
| OLD | NEW |