[recipes] Migrate away from deprecated post_process checks

Migrate away from ResultReason/ResultReasonRE. Also, do some minor
reformatting.

Bug: 339834630
Change-Id: Ibad136c4389955476af87bcc148581bea408415c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5565454
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Auto-Submit: Rob Mohr <mohrr@google.com>
changes/54/5565454/2
Rob Mohr 1 year ago committed by LUCI CQ
parent 499342211b
commit 2377dbfdbc

@ -185,12 +185,15 @@ def GenTests(api):
api.expect_status('INFRA_FAILURE'),
)
yield (
api.test('tryjob_fail_missing_bot_update_json', status="INFRA_FAILURE") +
try_build() + api.override_step_data('bot_update', retcode=1) +
api.post_process(post_process.ResultReasonRE, 'Infra Failure.*') +
api.post_process(post_process.StatusException) +
api.post_process(post_process.DropExpectation))
yield api.test(
'tryjob_fail_missing_bot_update_json',
try_build(),
api.override_step_data('bot_update', retcode=1),
api.post_process(post_process.SummaryMarkdownRE, 'Infra Failure.*'),
api.post_process(post_process.StatusException),
api.post_process(post_process.DropExpectation),
status='INFRA_FAILURE')
yield (
api.test('clobber') +
api.properties(clobber=1)

@ -21,6 +21,7 @@ def GenTests(api):
'no-json',
api.override_step_data('gclient sync', retcode=1),
# Should not fail with uncaught exception
api.post_process(post_process.ResultReasonRE, r'^(?!Uncaught Exception)'),
api.post_process(post_process.SummaryMarkdownRE,
r'^(?!Uncaught Exception)'),
api.post_process(post_process.DropExpectation),
status="INFRA_FAILURE")

@ -68,11 +68,12 @@ def GenTests(api):
['--skip_canned', 'CheckOwners']) +
api.post_process(post_process.DropExpectation))
yield (
api.test('timeout', status="FAILURE") +
api.runtime(is_experimental=False) +
api.buildbucket.try_build(project='infra') +
api.presubmit(timeout_s=600) + api.step_data(
yield api.test(
'timeout',
api.runtime(is_experimental=False),
api.buildbucket.try_build(project='infra'),
api.presubmit(timeout_s=600),
api.step_data(
'presubmit',
api.json.output({
'errors': [],
@ -80,16 +81,20 @@ def GenTests(api):
'warnings': []
}),
times_out_after=1200,
) + api.post_process(post_process.StatusFailure) + api.post_process(
post_process.ResultReason,
),
api.post_process(post_process.StatusFailure),
api.post_process(
post_process.SummaryMarkdown,
(u'#### There are 0 error(s), 0 warning(s), and 0 notifications(s).'
'\n\nTimeout occurred during presubmit step.')) +
api.post_process(post_process.DropExpectation))
'\n\nTimeout occurred during presubmit step.')),
api.post_process(post_process.DropExpectation),
status="FAILURE")
yield (
api.test('failure', status="FAILURE") +
api.runtime(is_experimental=False) +
api.buildbucket.try_build(project='infra') + api.step_data(
yield api.test(
'failure',
api.runtime(is_experimental=False),
api.buildbucket.try_build(project='infra'),
api.step_data(
'presubmit',
api.json.output(
{
@ -117,9 +122,10 @@ def GenTests(api):
'fatal': False
}]
},
retcode=1)) + api.post_process(post_process.StatusFailure) +
retcode=1)),
api.post_process(post_process.StatusFailure),
api.post_process(
post_process.ResultReason,
post_process.SummaryMarkdown,
textwrap.dedent(u'''
#### There are 2 error(s), 1 warning(s), and 1 notifications(s).
@ -136,29 +142,34 @@ def GenTests(api):
```
#### To see notifications and warnings, look at the stdout of the presubmit step.
''').strip()) + api.post_process(post_process.DropExpectation))
''').strip()),
api.post_process(post_process.DropExpectation),
status="FAILURE")
long_message = (u'Here are some suggested OWNERS:' +
u'\nreallyLongFakeAccountNameEmail@chromium.org' * 10)
yield (api.test('failure-long-message', status="FAILURE") +
api.runtime(is_experimental=False) +
api.buildbucket.try_build(project='infra') + api.step_data(
'presubmit',
api.json.output(
{
'errors': [{
'message': 'Missing LGTM',
'long_text': long_message,
'items': [],
'fatal': True
}],
'notifications': [],
'warnings': []
},
retcode=1)) + api.post_process(post_process.StatusFailure) +
api.post_process(
post_process.ResultReason,
textwrap.dedent('''
yield api.test(
'failure-long-message',
api.runtime(is_experimental=False),
api.buildbucket.try_build(project='infra'),
api.step_data(
'presubmit',
api.json.output(
{
'errors': [{
'message': 'Missing LGTM',
'long_text': long_message,
'items': [],
'fatal': True
}],
'notifications': [],
'warnings': []
},
retcode=1)),
api.post_process(post_process.StatusFailure),
api.post_process(
post_process.SummaryMarkdown,
textwrap.dedent('''
#### There are 1 error(s), 0 warning(s), and 0 notifications(s).
**ERROR**
@ -178,52 +189,63 @@ def GenTests(api):
**Error size > 450 chars, there are 2 more error(s) (15 total)**
**The complete output can be found at the bottom of the presubmit stdout.**
''').strip()) + api.post_process(post_process.DropExpectation))
''').strip()),
api.post_process(post_process.DropExpectation),
status="FAILURE")
yield (api.test('infra-failure', status="INFRA_FAILURE") +
api.runtime(is_experimental=False) +
api.buildbucket.try_build(project='infra') + api.step_data(
'presubmit',
api.json.output(
{
'errors': [{
'message': 'Infra Failure',
'long_text': '',
'items': [],
'fatal': True
}],
'notifications': [],
'warnings': []
},
retcode=2)) + api.post_process(post_process.StatusException) +
api.post_process(
post_process.ResultReason,
textwrap.dedent(u'''
#### There are 1 error(s), 0 warning(s), and 0 notifications(s).
**ERROR**
```
Infra Failure
```
''').strip()) + api.post_process(post_process.DropExpectation))
yield api.test(
'infra-failure',
api.runtime(is_experimental=False),
api.buildbucket.try_build(project='infra'),
api.step_data(
'presubmit',
api.json.output(
{
'errors': [{
'message': 'Infra Failure',
'long_text': '',
'items': [],
'fatal': True
}],
'notifications': [],
'warnings': []
},
retcode=2)),
api.post_process(post_process.StatusException),
api.post_process(
post_process.SummaryMarkdown,
textwrap.dedent(u'''
#### There are 1 error(s), 0 warning(s), and 0 notifications(s).
**ERROR**
```
Infra Failure
```
''').strip()),
api.post_process(post_process.DropExpectation),
status="INFRA_FAILURE")
bug_msg = ('Something unexpected occurred'
' while running presubmit checks.'
' Please [file a bug](https://issues.chromium.org'
'/issues/new?component=1456211)')
yield (api.test('failure-no-json', status="INFRA_FAILURE") +
api.runtime(is_experimental=False) +
api.buildbucket.try_build(project='infra') +
api.step_data('presubmit', api.json.output(None, retcode=1)) +
api.post_process(post_process.StatusException) +
api.post_process(post_process.ResultReason, bug_msg) +
api.post_process(post_process.DropExpectation))
yield api.test(
'failure-no-json',
api.runtime(is_experimental=False),
api.buildbucket.try_build(project='infra'),
api.step_data('presubmit', api.json.output(None, retcode=1)),
api.post_process(post_process.StatusException),
api.post_process(post_process.SummaryMarkdown, bug_msg),
api.post_process(post_process.DropExpectation),
status="INFRA_FAILURE")
yield (api.test('infra-failure-no-json', status="INFRA_FAILURE") +
api.runtime(is_experimental=False) +
api.buildbucket.try_build(project='infra') +
api.step_data('presubmit', api.json.output(None, retcode=2)) +
api.post_process(post_process.StatusException) +
api.post_process(post_process.ResultReason, bug_msg) +
api.post_process(post_process.DropExpectation))
yield api.test(
'infra-failure-no-json',
api.runtime(is_experimental=False),
api.buildbucket.try_build(project='infra'),
api.step_data('presubmit', api.json.output(None, retcode=2)),
api.post_process(post_process.StatusException),
api.post_process(post_process.SummaryMarkdown, bug_msg),
api.post_process(post_process.DropExpectation),
status="INFRA_FAILURE")

Loading…
Cancel
Save