| OLD | NEW |
| 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 by the Apache v2.0 license that can be | 4 # Use of this source code is governed by the Apache v2.0 license that can be |
| 5 # found in the LICENSE file. | 5 # 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 u'os': u'Amiga', | 248 u'os': u'Amiga', |
| 249 u'pool': u'default', | 249 u'pool': u'default', |
| 250 }, | 250 }, |
| 251 u'env': {}, | 251 u'env': {}, |
| 252 u'extra_args': [], | 252 u'extra_args': [], |
| 253 u'grace_period': 30, | 253 u'grace_period': 30, |
| 254 u'hard_timeout': 3600, | 254 u'hard_timeout': 3600, |
| 255 u'host': u'http://localhost:8080', | 255 u'host': u'http://localhost:8080', |
| 256 u'inputs_ref': None, | 256 u'inputs_ref': None, |
| 257 u'io_timeout': 1200, | 257 u'io_timeout': 1200, |
| 258 u'packages': [{ |
| 259 u'package_name': u'rm', |
| 260 u'version': test_env_handlers.PINNED_PACKAGE_VERSION, |
| 261 }], |
| 258 u'task_id': task_id, | 262 u'task_id': task_id, |
| 259 }, | 263 }, |
| 260 } | 264 } |
| 261 self.assertEqual(expected, response) | 265 self.assertEqual(expected, response) |
| 262 response = self.client_get_results(task_id) | 266 response = self.client_get_results(task_id) |
| 263 expected = { | 267 expected = { |
| 264 u'bot_dimensions': [ | 268 u'bot_dimensions': [ |
| 265 {u'key': u'id', u'value': [u'bot1']}, | 269 {u'key': u'id', u'value': [u'bot1']}, |
| 266 {u'key': u'os', u'value': [u'Amiga']}, | 270 {u'key': u'os', u'value': [u'Amiga']}, |
| 267 {u'key': u'pool', u'value': [u'default']}, | 271 {u'key': u'pool', u'value': [u'default']}, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 u'extra_args': [], | 313 u'extra_args': [], |
| 310 u'hard_timeout': 3600, | 314 u'hard_timeout': 3600, |
| 311 u'grace_period': 30, | 315 u'grace_period': 30, |
| 312 u'host': u'http://localhost:8080', | 316 u'host': u'http://localhost:8080', |
| 313 u'inputs_ref': { | 317 u'inputs_ref': { |
| 314 u'isolated': u'0123456789012345678901234567890123456789', | 318 u'isolated': u'0123456789012345678901234567890123456789', |
| 315 u'isolatedserver': u'http://localhost:1', | 319 u'isolatedserver': u'http://localhost:1', |
| 316 u'namespace': u'default-gzip', | 320 u'namespace': u'default-gzip', |
| 317 }, | 321 }, |
| 318 u'io_timeout': 1200, | 322 u'io_timeout': 1200, |
| 323 u'packages': [{ |
| 324 u'package_name': u'rm', |
| 325 u'version': test_env_handlers.PINNED_PACKAGE_VERSION, |
| 326 }], |
| 319 u'task_id': task_id, | 327 u'task_id': task_id, |
| 320 }, | 328 }, |
| 321 } | 329 } |
| 322 self.assertEqual(expected, response) | 330 self.assertEqual(expected, response) |
| 323 | 331 |
| 324 # Complete the isolated task. | 332 # Complete the isolated task. |
| 325 params = { | 333 params = { |
| 326 'cost_usd': 0.1, | 334 'cost_usd': 0.1, |
| 327 'duration': 3., | 335 'duration': 3., |
| 328 'bot_overhead': 0.1, | 336 'bot_overhead': 0.1, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 u'extra_args': [], | 434 u'extra_args': [], |
| 427 u'hard_timeout': 3600, | 435 u'hard_timeout': 3600, |
| 428 u'grace_period': 30, | 436 u'grace_period': 30, |
| 429 u'host': u'http://localhost:8080', | 437 u'host': u'http://localhost:8080', |
| 430 u'inputs_ref': { | 438 u'inputs_ref': { |
| 431 u'isolated': u'0123456789012345678901234567890123456789', | 439 u'isolated': u'0123456789012345678901234567890123456789', |
| 432 u'isolatedserver': u'http://localhost:1', | 440 u'isolatedserver': u'http://localhost:1', |
| 433 u'namespace': u'default-gzip', | 441 u'namespace': u'default-gzip', |
| 434 }, | 442 }, |
| 435 u'io_timeout': 1200, | 443 u'io_timeout': 1200, |
| 444 u'packages': [{ |
| 445 u'package_name': u'rm', |
| 446 u'version': test_env_handlers.PINNED_PACKAGE_VERSION, |
| 447 }], |
| 436 u'task_id': task_id, | 448 u'task_id': task_id, |
| 437 }, | 449 }, |
| 438 } | 450 } |
| 439 self.assertEqual(expected, response) | 451 self.assertEqual(expected, response) |
| 440 | 452 |
| 441 def test_bot_ereporter2_error(self): | 453 def test_bot_ereporter2_error(self): |
| 442 # ereporter2's //client/utils/on_error.py traps unhandled exceptions | 454 # ereporter2's //client/utils/on_error.py traps unhandled exceptions |
| 443 # automatically. | 455 # automatically. |
| 444 self.mock(random, 'getrandbits', lambda _: 0x88) | 456 self.mock(random, 'getrandbits', lambda _: 0x88) |
| 445 errors = [] | 457 errors = [] |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 self.assertEqual(expected, set(z.namelist())) | 870 self.assertEqual(expected, set(z.namelist())) |
| 859 | 871 |
| 860 | 872 |
| 861 if __name__ == '__main__': | 873 if __name__ == '__main__': |
| 862 if '-v' in sys.argv: | 874 if '-v' in sys.argv: |
| 863 unittest.TestCase.maxDiff = None | 875 unittest.TestCase.maxDiff = None |
| 864 logging.basicConfig( | 876 logging.basicConfig( |
| 865 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL, | 877 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL, |
| 866 format='%(levelname)-7s %(filename)s:%(lineno)3d %(message)s') | 878 format='%(levelname)-7s %(filename)s:%(lineno)3d %(message)s') |
| 867 unittest.main() | 879 unittest.main() |
| OLD | NEW |