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

Side by Side Diff: appengine/swarming/handlers_bot_test.py

Issue 2453873002: Add --output option to Swarming client and pass it through to the bot (Closed)
Patch Set: Fix help text for --output Created 4 years, 1 month 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 # coding: utf-8 2 # coding: utf-8
3 # Copyright 2015 The LUCI Authors. All rights reserved. 3 # Copyright 2015 The LUCI Authors. All rights reserved.
4 # Use of this source code is governed under the Apache License, Version 2.0 4 # Use of this source code is governed under the Apache License, Version 2.0
5 # that can be found in the LICENSE file. 5 # that can be found in the LICENSE file.
6 6
7 import base64 7 import base64
8 import datetime 8 import datetime
9 import logging 9 import logging
10 import os 10 import os
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 u'os': u'Amiga', 286 u'os': u'Amiga',
287 u'pool': u'default', 287 u'pool': u'default',
288 }, 288 },
289 u'env': {}, 289 u'env': {},
290 u'extra_args': [], 290 u'extra_args': [],
291 u'grace_period': 30, 291 u'grace_period': 30,
292 u'hard_timeout': 3600, 292 u'hard_timeout': 3600,
293 u'host': u'http://localhost:8080', 293 u'host': u'http://localhost:8080',
294 u'isolated': None, 294 u'isolated': None,
295 u'io_timeout': 1200, 295 u'io_timeout': 1200,
296 u'outputs': [u'foo', u'path/to/foobar'],
296 u'service_account': u'none', 297 u'service_account': u'none',
297 u'task_id': task_id, 298 u'task_id': task_id,
298 }, 299 },
299 } 300 }
300 self.assertEqual(expected, response) 301 self.assertEqual(expected, response)
301 response = self.client_get_results(task_id) 302 response = self.client_get_results(task_id)
302 expected = { 303 expected = {
303 u'bot_dimensions': [ 304 u'bot_dimensions': [
304 {u'key': u'id', u'value': [u'bot1']}, 305 {u'key': u'id', u'value': [u'bot1']},
305 {u'key': u'os', u'value': [u'Amiga']}, 306 {u'key': u'os', u'value': [u'Amiga']},
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 u'os': u'Amiga', 352 u'os': u'Amiga',
352 u'pool': u'default', 353 u'pool': u'default',
353 }, 354 },
354 u'env': {}, 355 u'env': {},
355 u'extra_args': [], 356 u'extra_args': [],
356 u'grace_period': 30, 357 u'grace_period': 30,
357 u'hard_timeout': 3600, 358 u'hard_timeout': 3600,
358 u'host': u'http://localhost:8080', 359 u'host': u'http://localhost:8080',
359 u'isolated': None, 360 u'isolated': None,
360 u'io_timeout': 1200, 361 u'io_timeout': 1200,
362 u'outputs': [u'foo', u'path/to/foobar'],
361 u'service_account': u'bot', 363 u'service_account': u'bot',
362 u'task_id': task_id, 364 u'task_id': task_id,
363 }, 365 },
364 } 366 }
365 self.assertEqual(expected, response) 367 self.assertEqual(expected, response)
366 368
367 def test_poll_confliciting_dimensions(self): 369 def test_poll_confliciting_dimensions(self):
368 params = self.do_handshake() 370 params = self.do_handshake()
369 self.assertEqual(params['dimensions']['pool'], ['default']) 371 self.assertEqual(params['dimensions']['pool'], ['default'])
370 372
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 u'extra_args': [], 442 u'extra_args': [],
441 u'hard_timeout': 3600, 443 u'hard_timeout': 3600,
442 u'grace_period': 30, 444 u'grace_period': 30,
443 u'host': u'http://localhost:8080', 445 u'host': u'http://localhost:8080',
444 u'isolated': { 446 u'isolated': {
445 u'input': u'0123456789012345678901234567890123456789', 447 u'input': u'0123456789012345678901234567890123456789',
446 u'server': u'http://localhost:1', 448 u'server': u'http://localhost:1',
447 u'namespace': u'default-gzip', 449 u'namespace': u'default-gzip',
448 }, 450 },
449 u'io_timeout': 1200, 451 u'io_timeout': 1200,
452 u'outputs': [u'foo', u'path/to/foobar'],
450 u'service_account': u'none', 453 u'service_account': u'none',
451 u'task_id': task_id, 454 u'task_id': task_id,
452 }, 455 },
453 } 456 }
454 self.assertEqual(expected, response) 457 self.assertEqual(expected, response)
455 458
456 # Complete the isolated task. 459 # Complete the isolated task.
457 params = { 460 params = {
458 'cost_usd': 0.1, 461 'cost_usd': 0.1,
459 'duration': 3., 462 'duration': 3.,
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 u'extra_args': [], 595 u'extra_args': [],
593 u'hard_timeout': 3600, 596 u'hard_timeout': 3600,
594 u'grace_period': 30, 597 u'grace_period': 30,
595 u'host': u'http://localhost:8080', 598 u'host': u'http://localhost:8080',
596 u'isolated': { 599 u'isolated': {
597 u'input': u'0123456789012345678901234567890123456789', 600 u'input': u'0123456789012345678901234567890123456789',
598 u'server': u'http://localhost:1', 601 u'server': u'http://localhost:1',
599 u'namespace': u'default-gzip', 602 u'namespace': u'default-gzip',
600 }, 603 },
601 u'io_timeout': 1200, 604 u'io_timeout': 1200,
605 u'outputs': [u'foo', u'path/to/foobar'],
602 u'service_account': u'none', 606 u'service_account': u'none',
603 u'task_id': task_id, 607 u'task_id': task_id,
604 }, 608 },
605 } 609 }
606 self.assertEqual(expected, response) 610 self.assertEqual(expected, response)
607 611
608 def test_bot_ereporter2_error(self): 612 def test_bot_ereporter2_error(self):
609 # ereporter2's //client/utils/on_error.py traps unhandled exceptions 613 # ereporter2's //client/utils/on_error.py traps unhandled exceptions
610 # automatically. 614 # automatically.
611 self.mock(random, 'getrandbits', lambda _: 0x88) 615 self.mock(random, 'getrandbits', lambda _: 0x88)
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 self.app.get('/bot_code?tok=%s' % tok, status=200) 1046 self.app.get('/bot_code?tok=%s' % tok, status=200)
1043 1047
1044 1048
1045 if __name__ == '__main__': 1049 if __name__ == '__main__':
1046 if '-v' in sys.argv: 1050 if '-v' in sys.argv:
1047 unittest.TestCase.maxDiff = None 1051 unittest.TestCase.maxDiff = None
1048 logging.basicConfig( 1052 logging.basicConfig(
1049 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL, 1053 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL,
1050 format='%(levelname)-7s %(filename)s:%(lineno)3d %(message)s') 1054 format='%(levelname)-7s %(filename)s:%(lineno)3d %(message)s')
1051 unittest.main() 1055 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698