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

Side by Side Diff: appengine/swarming/server/task_result_test.py

Issue 2926713004: Add support for repeated keys in TaskRequest. (Closed)
Patch Set: rebase Created 3 years, 6 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
OLDNEW
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 17 matching lines...) Expand all
28 from server import task_to_run 28 from server import task_to_run
29 29
30 30
31 # pylint: disable=W0212 31 # pylint: disable=W0212
32 32
33 33
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_flat': [u'pool: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')
45 now = utils.utcnow() 44 now = utils.utcnow()
46 args = { 45 args = {
47 'created_ts': now, 46 'created_ts': now,
48 'name': 'Request name', 47 'name': 'Request name',
49 'priority': 50, 48 'priority': 50,
50 'properties': task_request.TaskProperties(**props), 49 'properties': task_request.TaskProperties(**props),
51 'expiration_ts': now + datetime.timedelta(seconds=60), 50 'expiration_ts': now + datetime.timedelta(seconds=60),
52 'tags': [u'tag:1'], 51 'tags': [u'tag:1'],
53 'user': 'Jesus', 52 'user': 'Jesus',
54 } 53 }
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 task_result.TaskOutput.CHUNK_SIZE * '\x00' + 'Baz\x00Bar\x00FooWow', 693 task_result.TaskOutput.CHUNK_SIZE * '\x00' + 'Baz\x00Bar\x00FooWow',
695 self.run_result.get_output()) 694 self.run_result.get_output())
696 self.assertTaskOutputChunk( 695 self.assertTaskOutputChunk(
697 [{'chunk': 'Baz\x00Bar\x00FooWow', 'gaps': [3, 4, 7, 8]}]) 696 [{'chunk': 'Baz\x00Bar\x00FooWow', 'gaps': [3, 4, 7, 8]}])
698 697
699 698
700 if __name__ == '__main__': 699 if __name__ == '__main__':
701 if '-v' in sys.argv: 700 if '-v' in sys.argv:
702 unittest.TestCase.maxDiff = None 701 unittest.TestCase.maxDiff = None
703 unittest.main() 702 unittest.main()
OLDNEW
« no previous file with comments | « appengine/swarming/server/task_request_test.py ('k') | appengine/swarming/server/task_scheduler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698