Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2013 The LUCI Authors. All rights reserved. | 1 # Copyright 2013 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 from recipe_engine import recipe_api, config | 5 from recipe_engine import recipe_api, config |
| 6 | 6 |
| 7 DEPS = [ | 7 DEPS = [ |
| 8 'path', | 8 'path', |
| 9 'properties', | 9 'properties', |
| 10 'step', | 10 'step', |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 | 25 |
| 26 | 26 |
| 27 def RunSteps( | 27 def RunSteps( |
| 28 api, bad_return, raise_infra_failure, access_invalid_data, timeout): | 28 api, bad_return, raise_infra_failure, access_invalid_data, timeout): |
| 29 if bad_return: | 29 if bad_return: |
| 30 return RETURN_SCHEMA.new(test_me='this should fail') | 30 return RETURN_SCHEMA.new(test_me='this should fail') |
| 31 elif timeout: | 31 elif timeout: |
| 32 # Timeout causes the recipe engine to raise an exception if your step takes | 32 # Timeout causes the recipe engine to raise an exception if your step takes |
| 33 # longer to run than you allow. Units are seconds. | 33 # longer to run than you allow. Units are seconds. |
| 34 if timeout == 1: | 34 if timeout == 1: |
| 35 raise Exception('fuu') | |
|
iannucci
2017/04/04 20:24:51
did you mean to leave this in? should this be adde
Paweł Hajdan Jr.
2017/04/04 20:32:03
Ouch, indeed left by mistake. Also detected by pre
| |
| 35 api.step('timeout', ['sleep', '20'], timeout=1) | 36 api.step('timeout', ['sleep', '20'], timeout=1) |
| 36 elif timeout == 2: | 37 elif timeout == 2: |
| 37 try: | 38 try: |
| 38 api.step('caught timeout', ['sleep', '20'], timeout=1) | 39 api.step('caught timeout', ['sleep', '20'], timeout=1) |
| 39 except api.step.StepTimeout: | 40 except api.step.StepTimeout: |
| 40 return RETURN_SCHEMA(test_me=4) | 41 return RETURN_SCHEMA(test_me=4) |
| 41 | 42 |
| 42 | 43 |
| 43 # TODO(martinis) change this | 44 # TODO(martinis) change this |
| 44 # The api.step object is directly callable. | 45 # The api.step object is directly callable. |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 api.test('timeout') + | 172 api.test('timeout') + |
| 172 api.properties(timeout=1) + | 173 api.properties(timeout=1) + |
| 173 api.step_data('timeout', times_out_after=20) | 174 api.step_data('timeout', times_out_after=20) |
| 174 ) | 175 ) |
| 175 | 176 |
| 176 yield ( | 177 yield ( |
| 177 api.test('catch_timeout') + | 178 api.test('catch_timeout') + |
| 178 api.properties(timeout=2) + | 179 api.properties(timeout=2) + |
| 179 api.step_data('caught timeout', times_out_after=20) | 180 api.step_data('caught timeout', times_out_after=20) |
| 180 ) | 181 ) |
| OLD | NEW |