mirrored from https://chromium.googlesource.com/infra/luci/recipes-py
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathempty.py
64 lines (49 loc) · 1.75 KB
/
empty.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Copyright 2021 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
from recipe_engine.post_process import (
DropExpectation,
HasLog,
LogEquals,
StepCommandEmpty,
StepException,
StepFailure,
StepSuccess,
StepTextEquals
)
DEPS = [
'step',
]
def RunSteps(api):
api.step.empty('hello', step_text='stuff', log_text='other\nstuff')
api.step.empty('multi hello', log_text=['multi', 'line'])
api.step.empty(
'alternate log', log_name='details', log_text='some\nlog\ncontent')
try:
api.step.empty('bye', status=api.step.FAILURE)
assert False, 'unreachable' # pragma: no cover
except api.step.StepFailure:
pass
try:
api.step.empty('bigfail', status=api.step.INFRA_FAILURE)
assert False, 'unreachable' # pragma: no cover
except api.step.StepFailure:
pass
api.step.empty('quiet fail', status=api.step.FAILURE, raise_on_failure=False)
def GenTests(api):
yield api.test(
'basic',
api.post_process(StepSuccess, 'hello'),
api.post_process(HasLog, 'hello', 'stdout'),
api.post_process(LogEquals, 'hello', 'stdout', 'other\nstuff'),
api.post_process(StepTextEquals, 'hello', 'stuff'),
api.post_process(StepCommandEmpty, 'hello'),
api.post_process(StepSuccess, 'multi hello'),
api.post_process(LogEquals, 'multi hello', 'stdout', 'multi\nline'),
api.post_process(StepSuccess, 'alternate log'),
api.post_process(LogEquals, 'alternate log', 'details',
'some\nlog\ncontent'),
api.post_process(StepException, 'bigfail'),
api.post_process(StepFailure, 'quiet fail'),
api.post_process(DropExpectation),
)