| 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 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 self.assertEqual('0', task_id[-1]) | 232 self.assertEqual('0', task_id[-1]) |
| 233 # Convert TaskResultSummary reference to TaskRunResult. | 233 # Convert TaskResultSummary reference to TaskRunResult. |
| 234 task_id = task_id[:-1] + '1' | 234 task_id = task_id[:-1] + '1' |
| 235 response = self.post_json('/swarming/api/v1/bot/poll', params) | 235 response = self.post_json('/swarming/api/v1/bot/poll', params) |
| 236 expected = { | 236 expected = { |
| 237 u'cmd': u'run', | 237 u'cmd': u'run', |
| 238 u'manifest': { | 238 u'manifest': { |
| 239 u'bot_id': u'bot1', | 239 u'bot_id': u'bot1', |
| 240 u'cipd_input': { | 240 u'cipd_input': { |
| 241 u'client_package': { | 241 u'client_package': { |
| 242 u'package_name': 'infra/tools/cipd/${platform}', | 242 u'package_name': u'infra/tools/cipd/${platform}', |
| 243 u'version': 'git_revision:deadbeef', | 243 u'path': None, |
| 244 u'version': u'git_revision:deadbeef', |
| 244 }, | 245 }, |
| 245 u'packages': [{ | 246 u'packages': [{ |
| 246 u'package_name': u'rm', | 247 u'package_name': u'rm', |
| 247 u'version': 'git_revision:deadbeef', | 248 u'path': u'bin', |
| 249 u'version': u'git_revision:deadbeef', |
| 248 }], | 250 }], |
| 249 u'server': 'https://chrome-infra-packages.appspot.com', | 251 u'server': u'https://chrome-infra-packages.appspot.com', |
| 250 }, | 252 }, |
| 251 u'command': [u'python', u'run_test.py'], | 253 u'command': [u'python', u'run_test.py'], |
| 252 u'dimensions': { | 254 u'dimensions': { |
| 253 u'os': u'Amiga', | 255 u'os': u'Amiga', |
| 254 u'pool': u'default', | 256 u'pool': u'default', |
| 255 }, | 257 }, |
| 256 u'env': {}, | 258 u'env': {}, |
| 257 u'extra_args': [], | 259 u'extra_args': [], |
| 258 u'grace_period': 30, | 260 u'grace_period': 30, |
| 259 u'hard_timeout': 3600, | 261 u'hard_timeout': 3600, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 self.assertEqual('0', task_id[-1]) | 302 self.assertEqual('0', task_id[-1]) |
| 301 # Convert TaskResultSummary reference to TaskRunResult. | 303 # Convert TaskResultSummary reference to TaskRunResult. |
| 302 task_id = task_id[:-1] + '1' | 304 task_id = task_id[:-1] + '1' |
| 303 response = self.post_json('/swarming/api/v1/bot/poll', params) | 305 response = self.post_json('/swarming/api/v1/bot/poll', params) |
| 304 expected = { | 306 expected = { |
| 305 u'cmd': u'run', | 307 u'cmd': u'run', |
| 306 u'manifest': { | 308 u'manifest': { |
| 307 u'bot_id': u'bot1', | 309 u'bot_id': u'bot1', |
| 308 u'cipd_input': { | 310 u'cipd_input': { |
| 309 u'client_package': { | 311 u'client_package': { |
| 310 u'package_name': 'infra/tools/cipd/${platform}', | 312 u'package_name': u'infra/tools/cipd/${platform}', |
| 311 u'version': 'git_revision:deadbeef', | 313 u'path': None, |
| 314 u'version': u'git_revision:deadbeef', |
| 312 }, | 315 }, |
| 313 u'packages': [{ | 316 u'packages': [{ |
| 314 u'package_name': u'rm', | 317 u'package_name': u'rm', |
| 315 u'version': 'git_revision:deadbeef', | 318 u'path': u'bin', |
| 319 u'version': u'git_revision:deadbeef', |
| 316 }], | 320 }], |
| 317 u'server': 'https://chrome-infra-packages.appspot.com', | 321 u'server': u'https://chrome-infra-packages.appspot.com', |
| 318 }, | 322 }, |
| 319 u'command': None, | 323 u'command': None, |
| 320 u'dimensions': { | 324 u'dimensions': { |
| 321 u'os': u'Amiga', | 325 u'os': u'Amiga', |
| 322 u'pool': u'default', | 326 u'pool': u'default', |
| 323 }, | 327 }, |
| 324 u'env': {}, | 328 u'env': {}, |
| 325 u'extra_args': [], | 329 u'extra_args': [], |
| 326 u'hard_timeout': 3600, | 330 u'hard_timeout': 3600, |
| 327 u'grace_period': 30, | 331 u'grace_period': 30, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 int(utils.time_time()) + 3600 + 1200 + 3 * 30 + 10 + 1) | 431 int(utils.time_time()) + 3600 + 1200 + 3 * 30 + 10 + 1) |
| 428 response = self.post_json('/swarming/api/v1/bot/poll', params) | 432 response = self.post_json('/swarming/api/v1/bot/poll', params) |
| 429 # Convert TaskResultSummary reference to TaskRunResult. | 433 # Convert TaskResultSummary reference to TaskRunResult. |
| 430 task_id = task_id[:-1] + '1' | 434 task_id = task_id[:-1] + '1' |
| 431 expected = { | 435 expected = { |
| 432 u'cmd': u'run', | 436 u'cmd': u'run', |
| 433 u'manifest': { | 437 u'manifest': { |
| 434 u'bot_id': u'bot1', | 438 u'bot_id': u'bot1', |
| 435 u'cipd_input': { | 439 u'cipd_input': { |
| 436 u'client_package': { | 440 u'client_package': { |
| 437 u'package_name': 'infra/tools/cipd/${platform}', | 441 u'package_name': u'infra/tools/cipd/${platform}', |
| 438 u'version': 'git_revision:deadbeef', | 442 u'path': None, |
| 443 u'version': u'git_revision:deadbeef', |
| 439 }, | 444 }, |
| 440 u'packages': [{ | 445 u'packages': [{ |
| 441 u'package_name': u'rm', | 446 u'package_name': u'rm', |
| 442 u'version': 'git_revision:deadbeef', | 447 u'path': u'bin', |
| 448 u'version': u'git_revision:deadbeef', |
| 443 }], | 449 }], |
| 444 u'server': 'https://chrome-infra-packages.appspot.com', | 450 u'server': u'https://chrome-infra-packages.appspot.com', |
| 445 }, | 451 }, |
| 446 u'command': None, | 452 u'command': None, |
| 447 u'dimensions': { | 453 u'dimensions': { |
| 448 u'os': u'Amiga', | 454 u'os': u'Amiga', |
| 449 u'pool': u'default', | 455 u'pool': u'default', |
| 450 }, | 456 }, |
| 451 u'env': {}, | 457 u'env': {}, |
| 452 u'extra_args': [], | 458 u'extra_args': [], |
| 453 u'hard_timeout': 3600, | 459 u'hard_timeout': 3600, |
| 454 u'grace_period': 30, | 460 u'grace_period': 30, |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 self.app.get('/bot_code?tok=%s' % tok, status=200) | 894 self.app.get('/bot_code?tok=%s' % tok, status=200) |
| 889 | 895 |
| 890 | 896 |
| 891 if __name__ == '__main__': | 897 if __name__ == '__main__': |
| 892 if '-v' in sys.argv: | 898 if '-v' in sys.argv: |
| 893 unittest.TestCase.maxDiff = None | 899 unittest.TestCase.maxDiff = None |
| 894 logging.basicConfig( | 900 logging.basicConfig( |
| 895 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL, | 901 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL, |
| 896 format='%(levelname)-7s %(filename)s:%(lineno)3d %(message)s') | 902 format='%(levelname)-7s %(filename)s:%(lineno)3d %(message)s') |
| 897 unittest.main() | 903 unittest.main() |
| OLD | NEW |