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 json | 9 import json |
10 import logging | 10 import logging |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 ], | 224 ], |
225 server='https://chrome-infra-packages.appspot.com'), | 225 server='https://chrome-infra-packages.appspot.com'), |
226 command=['rm', '-rf', '/'], | 226 command=['rm', '-rf', '/'], |
227 dimensions=[ | 227 dimensions=[ |
228 swarming_rpcs.StringPair(key='pool', value='default'), | 228 swarming_rpcs.StringPair(key='pool', value='default'), |
229 ], | 229 ], |
230 env=[ | 230 env=[ |
231 swarming_rpcs.StringPair(key='PATH', value='/'), | 231 swarming_rpcs.StringPair(key='PATH', value='/'), |
232 ], | 232 ], |
233 execution_timeout_secs=30, | 233 execution_timeout_secs=30, |
234 io_timeout_secs=30), | 234 io_timeout_secs=30, |
| 235 outputs=['foo','path/to/dir']), |
235 tags=['foo:bar'], | 236 tags=['foo:bar'], |
236 user='joe@localhost', | 237 user='joe@localhost', |
237 pubsub_topic='projects/abc/topics/def', | 238 pubsub_topic='projects/abc/topics/def', |
238 pubsub_auth_token='secret that must not be shown', | 239 pubsub_auth_token='secret that must not be shown', |
239 pubsub_userdata='userdata', | 240 pubsub_userdata='userdata', |
240 service_account_token='bot') | 241 service_account_token='bot') |
241 expected = { | 242 expected = { |
242 u'request': { | 243 u'request': { |
243 u'authenticated': u'user:user@example.com', | 244 u'authenticated': u'user:user@example.com', |
244 u'created_ts': str_now, | 245 u'created_ts': str_now, |
(...skipping 17 matching lines...) Expand all Loading... |
262 u'dimensions': [ | 263 u'dimensions': [ |
263 {u'key': u'pool', u'value': u'default'}, | 264 {u'key': u'pool', u'value': u'default'}, |
264 ], | 265 ], |
265 u'env': [ | 266 u'env': [ |
266 {u'key': u'PATH', u'value': u'/'}, | 267 {u'key': u'PATH', u'value': u'/'}, |
267 ], | 268 ], |
268 u'execution_timeout_secs': u'30', | 269 u'execution_timeout_secs': u'30', |
269 u'grace_period_secs': u'30', | 270 u'grace_period_secs': u'30', |
270 u'idempotent': False, | 271 u'idempotent': False, |
271 u'io_timeout_secs': u'30', | 272 u'io_timeout_secs': u'30', |
| 273 u'outputs': [u'foo', u'path/to/dir'], |
272 }, | 274 }, |
273 u'pubsub_topic': u'projects/abc/topics/def', | 275 u'pubsub_topic': u'projects/abc/topics/def', |
274 u'pubsub_userdata': u'userdata', | 276 u'pubsub_userdata': u'userdata', |
275 u'service_account': u'bot', | 277 u'service_account': u'bot', |
276 u'tags': [ | 278 u'tags': [ |
277 u'foo:bar', | 279 u'foo:bar', |
278 u'pool:default', | 280 u'pool:default', |
279 u'priority:200', | 281 u'priority:200', |
280 u'service_account:bot', | 282 u'service_account:bot', |
281 u'user:joe@localhost', | 283 u'user:joe@localhost', |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 path='bin', | 322 path='bin', |
321 version='git_revision:deadbeef'), | 323 version='git_revision:deadbeef'), |
322 ], | 324 ], |
323 server='https://chrome-infra-packages.appspot.com'), | 325 server='https://chrome-infra-packages.appspot.com'), |
324 dimensions=[ | 326 dimensions=[ |
325 swarming_rpcs.StringPair(key='os', value='Amiga'), | 327 swarming_rpcs.StringPair(key='os', value='Amiga'), |
326 swarming_rpcs.StringPair(key='pool', value='default'), | 328 swarming_rpcs.StringPair(key='pool', value='default'), |
327 ], | 329 ], |
328 execution_timeout_secs=3600, | 330 execution_timeout_secs=3600, |
329 idempotent=True, | 331 idempotent=True, |
330 io_timeout_secs=1200), | 332 io_timeout_secs=1200, |
| 333 outputs=['foo', 'path/to/foobar']), |
331 tags=['foo:bar'], | 334 tags=['foo:bar'], |
332 user='joe@localhost') | 335 user='joe@localhost') |
333 expected = { | 336 expected = { |
334 u'request': { | 337 u'request': { |
335 u'authenticated': u'user:user@example.com', | 338 u'authenticated': u'user:user@example.com', |
336 u'created_ts': str_now_30, | 339 u'created_ts': str_now_30, |
337 u'expiration_secs': u'30', | 340 u'expiration_secs': u'30', |
338 u'name': u'job1', | 341 u'name': u'job1', |
339 u'priority': u'200', | 342 u'priority': u'200', |
340 u'properties': { | 343 u'properties': { |
(...skipping 11 matching lines...) Expand all Loading... |
352 }, | 355 }, |
353 u'command': [u'python', u'run_test.py'], | 356 u'command': [u'python', u'run_test.py'], |
354 u'dimensions': [ | 357 u'dimensions': [ |
355 {u'key': u'os', u'value': u'Amiga'}, | 358 {u'key': u'os', u'value': u'Amiga'}, |
356 {u'key': u'pool', u'value': u'default'}, | 359 {u'key': u'pool', u'value': u'default'}, |
357 ], | 360 ], |
358 u'execution_timeout_secs': u'3600', | 361 u'execution_timeout_secs': u'3600', |
359 u'grace_period_secs': u'30', | 362 u'grace_period_secs': u'30', |
360 u'idempotent': True, | 363 u'idempotent': True, |
361 u'io_timeout_secs': u'1200', | 364 u'io_timeout_secs': u'1200', |
| 365 u'outputs': [u'foo', u'path/to/foobar'], |
362 }, | 366 }, |
363 u'service_account': u'none', | 367 u'service_account': u'none', |
364 u'tags': [ | 368 u'tags': [ |
365 u'foo:bar', | 369 u'foo:bar', |
366 u'os:Amiga', | 370 u'os:Amiga', |
367 u'pool:default', | 371 u'pool:default', |
368 u'priority:200', | 372 u'priority:200', |
369 u'service_account:none', | 373 u'service_account:none', |
370 u'user:joe@localhost', | 374 u'user:joe@localhost', |
371 ], | 375 ], |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 }, | 501 }, |
498 u'command': [u'python', u'run_test.py'], | 502 u'command': [u'python', u'run_test.py'], |
499 u'dimensions': [ | 503 u'dimensions': [ |
500 {u'key': u'os', u'value': u'Amiga'}, | 504 {u'key': u'os', u'value': u'Amiga'}, |
501 {u'key': u'pool', u'value': u'default'}, | 505 {u'key': u'pool', u'value': u'default'}, |
502 ], | 506 ], |
503 u'execution_timeout_secs': u'3600', | 507 u'execution_timeout_secs': u'3600', |
504 u'grace_period_secs': u'30', | 508 u'grace_period_secs': u'30', |
505 u'idempotent': True, | 509 u'idempotent': True, |
506 u'io_timeout_secs': u'1200', | 510 u'io_timeout_secs': u'1200', |
| 511 u'outputs': [u'foo', u'path/to/foobar'], |
507 }, | 512 }, |
508 u'service_account': u'none', | 513 u'service_account': u'none', |
509 u'tags': [ | 514 u'tags': [ |
510 u'foo:bar', | 515 u'foo:bar', |
511 u'os:Amiga', | 516 u'os:Amiga', |
512 u'pool:default', | 517 u'pool:default', |
513 u'priority:200', | 518 u'priority:200', |
514 u'service_account:none', | 519 u'service_account:none', |
515 u'user:joe@localhost', | 520 u'user:joe@localhost', |
516 ], | 521 ], |
(...skipping 20 matching lines...) Expand all Loading... |
537 }, | 542 }, |
538 u'command': [u'python', u'run_test.py'], | 543 u'command': [u'python', u'run_test.py'], |
539 u'dimensions': [ | 544 u'dimensions': [ |
540 {u'key': u'os', u'value': u'Amiga'}, | 545 {u'key': u'os', u'value': u'Amiga'}, |
541 {u'key': u'pool', u'value': u'default'}, | 546 {u'key': u'pool', u'value': u'default'}, |
542 ], | 547 ], |
543 u'execution_timeout_secs': u'3600', | 548 u'execution_timeout_secs': u'3600', |
544 u'grace_period_secs': u'30', | 549 u'grace_period_secs': u'30', |
545 u'idempotent': True, | 550 u'idempotent': True, |
546 u'io_timeout_secs': u'1200', | 551 u'io_timeout_secs': u'1200', |
| 552 u'outputs': [u'foo', u'path/to/foobar'], |
547 }, | 553 }, |
548 u'service_account': u'none', | 554 u'service_account': u'none', |
549 u'tags': [ | 555 u'tags': [ |
550 u'commit:post', | 556 u'commit:post', |
551 u'os:Amiga', | 557 u'os:Amiga', |
552 u'os:Win', | 558 u'os:Win', |
553 u'pool:default', | 559 u'pool:default', |
554 u'priority:100', | 560 u'priority:100', |
555 u'project:yay', | 561 u'project:yay', |
556 u'service_account:none', | 562 u'service_account:none', |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 }, | 1472 }, |
1467 u'command': [u'python', u'run_test.py'], | 1473 u'command': [u'python', u'run_test.py'], |
1468 u'dimensions': [ | 1474 u'dimensions': [ |
1469 {u'key': u'os', u'value': u'Amiga'}, | 1475 {u'key': u'os', u'value': u'Amiga'}, |
1470 {u'key': u'pool', u'value': u'default'}, | 1476 {u'key': u'pool', u'value': u'default'}, |
1471 ], | 1477 ], |
1472 u'execution_timeout_secs': u'3600', | 1478 u'execution_timeout_secs': u'3600', |
1473 u'grace_period_secs': u'30', | 1479 u'grace_period_secs': u'30', |
1474 u'idempotent': False, | 1480 u'idempotent': False, |
1475 u'io_timeout_secs': u'1200', | 1481 u'io_timeout_secs': u'1200', |
| 1482 u'outputs': [u'foo', u'path/to/foobar'], |
1476 }, | 1483 }, |
1477 u'service_account': u'none', | 1484 u'service_account': u'none', |
1478 u'tags': [ | 1485 u'tags': [ |
1479 u'os:Amiga', | 1486 u'os:Amiga', |
1480 u'pool:default', | 1487 u'pool:default', |
1481 u'priority:100', | 1488 u'priority:100', |
1482 u'service_account:none', | 1489 u'service_account:none', |
1483 u'user:joe@localhost', | 1490 u'user:joe@localhost', |
1484 ], | 1491 ], |
1485 u'user': u'joe@localhost', | 1492 u'user': u'joe@localhost', |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2039 self.call_api('terminate', body={'bot_id': 'bot1'}, status=403) | 2046 self.call_api('terminate', body={'bot_id': 'bot1'}, status=403) |
2040 | 2047 |
2041 | 2048 |
2042 if __name__ == '__main__': | 2049 if __name__ == '__main__': |
2043 if '-v' in sys.argv: | 2050 if '-v' in sys.argv: |
2044 unittest.TestCase.maxDiff = None | 2051 unittest.TestCase.maxDiff = None |
2045 logging.basicConfig(level=logging.DEBUG) | 2052 logging.basicConfig(level=logging.DEBUG) |
2046 else: | 2053 else: |
2047 logging.basicConfig(level=logging.CRITICAL) | 2054 logging.basicConfig(level=logging.CRITICAL) |
2048 unittest.main() | 2055 unittest.main() |
OLD | NEW |