| OLD | NEW |
| 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 random | 8 import random |
| 9 import sys | 9 import sys |
| 10 import unittest | 10 import unittest |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 mkreq(_gen_request(properties=dict(env={}))) | 563 mkreq(_gen_request(properties=dict(env={}))) |
| 564 | 564 |
| 565 # Priority. | 565 # Priority. |
| 566 with self.assertRaises(datastore_errors.BadValueError): | 566 with self.assertRaises(datastore_errors.BadValueError): |
| 567 mkreq(_gen_request(priority=task_request.MAXIMUM_PRIORITY+1)) | 567 mkreq(_gen_request(priority=task_request.MAXIMUM_PRIORITY+1)) |
| 568 mkreq(_gen_request(priority=task_request.MAXIMUM_PRIORITY)) | 568 mkreq(_gen_request(priority=task_request.MAXIMUM_PRIORITY)) |
| 569 | 569 |
| 570 # Execution timeout. | 570 # Execution timeout. |
| 571 with self.assertRaises(datastore_errors.BadValueError): | 571 with self.assertRaises(datastore_errors.BadValueError): |
| 572 mkreq(_gen_request( | 572 mkreq(_gen_request( |
| 573 properties=dict(execution_timeout_secs=task_request._ONE_DAY_SECS+1))) | 573 properties=dict( |
| 574 execution_timeout_secs=task_request._THREE_DAY_SECS+1))) |
| 574 mkreq(_gen_request( | 575 mkreq(_gen_request( |
| 575 properties=dict(execution_timeout_secs=task_request._ONE_DAY_SECS))) | 576 properties=dict(execution_timeout_secs=task_request._THREE_DAY_SECS))) |
| 576 | 577 |
| 577 # Expiration. | 578 # Expiration. |
| 578 now = utils.utcnow() | 579 now = utils.utcnow() |
| 579 with self.assertRaises(datastore_errors.BadValueError): | 580 with self.assertRaises(datastore_errors.BadValueError): |
| 580 mkreq(_gen_request( | 581 mkreq(_gen_request( |
| 581 created_ts=now, | 582 created_ts=now, |
| 582 expiration_ts=now + datetime.timedelta( | 583 expiration_ts=now + datetime.timedelta( |
| 583 seconds=task_request._MIN_TIMEOUT_SECS-1))) | 584 seconds=task_request._MIN_TIMEOUT_SECS-1))) |
| 584 with self.assertRaises(datastore_errors.BadValueError): | 585 with self.assertRaises(datastore_errors.BadValueError): |
| 585 mkreq(_gen_request( | 586 mkreq(_gen_request( |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 with self.assertRaises(datastore_errors.BadValueError): | 743 with self.assertRaises(datastore_errors.BadValueError): |
| 743 task_request.SecretBytes(secret_bytes='a'*(20*1024+1)).put() | 744 task_request.SecretBytes(secret_bytes='a'*(20*1024+1)).put() |
| 744 | 745 |
| 745 | 746 |
| 746 if __name__ == '__main__': | 747 if __name__ == '__main__': |
| 747 if '-v' in sys.argv: | 748 if '-v' in sys.argv: |
| 748 unittest.TestCase.maxDiff = None | 749 unittest.TestCase.maxDiff = None |
| 749 logging.basicConfig( | 750 logging.basicConfig( |
| 750 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR) | 751 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR) |
| 751 unittest.main() | 752 unittest.main() |
| OLD | NEW |