Skip to content

Commit 18f6995

Browse files
committed
Add additional test checks
Add additional checks definition to the spec files and extend the jsonschema with them. Signed-off-by: Miroslav Vadkerti <[email protected]>
1 parent 2f4eae4 commit 18f6995

File tree

4 files changed

+93
-22
lines changed

4 files changed

+93
-22
lines changed

spec/plans/discover.fmf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ description: |
3030
result: respect
3131
tag: [tag]
3232
tier: 1
33+
check:
34+
- avc
3335

3436
/test/two:
3537
summary: Short test summary.

spec/plans/execute.fmf

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ description: |
2525
/test/one:
2626
result: OUTCOME
2727
log: PATH
28+
check:
29+
CHECK_NAME:
30+
result: TEST_RESULT
31+
log: PATH
2832

2933
/test/two:
3034
result: OUTCOME
@@ -45,8 +49,9 @@ description: |
4549
warn
4650
A problem appeared during test execution which does
4751
not affect test results but might be worth checking
48-
and fixing. For example test cleanup phase failed.
49-
Automation must treat this as a failed test.
52+
and fixing. For example test cleanup phase failed
53+
or a check failure for a passing test. Automation
54+
must treat this as a failed test.
5055
error
5156
Undefined problem encountered during test execution.
5257
Human inspection is needed to investigate whether it
@@ -64,6 +69,13 @@ description: |
6469
The ``DURATION`` is an optional section stating how long did
6570
the test run. Its value is in the ``hh:mm:ss`` format.
6671

72+
The ``CHECK_NAME`` specifies a check which was executed during
73+
the testing. Multiple checks can end up here.
74+
75+
Checks can be overridden by the ``check`` property of the
76+
``execute`` step. The property in execute overrides all checks
77+
from the test attribute.
78+
6779
/upgrade:
6880
summary: Perform system upgrades during testing
6981
story:
@@ -318,3 +330,18 @@ description: |
318330
systemctl start httpd
319331
echo foo > /var/www/html/index.html
320332
curl http://localhost/ | grep foo
333+
334+
335+
/avc:
336+
summary: A shell script with AVC check enabled
337+
description:
338+
The ``avc`` check is enabled when running this test.
339+
example: |
340+
execute:
341+
check:
342+
- avc
343+
script: |
344+
dnf -y install httpd curl
345+
systemctl start httpd
346+
echo foo > /var/www/html/index.html
347+
curl http://localhost/ | grep foo

spec/plans/report.fmf

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -93,43 +93,59 @@ description:
9393
result: OVERALL_RESULT
9494
plans:
9595
/plan/one:
96-
result: PLAN_RESULT
96+
result: PLAN_OUTCOME
9797
tests:
9898
/test/one:
99-
result: TEST_RESULT
99+
result: TEST_OUTCOME
100100
log: LOG_PATH
101101

102102
/test/two:
103-
result: TEST_RESULT
103+
result: TEST_OUTCOME
104104
log:
105105
- LOG_PATH
106106
- LOG_PATH
107107
- LOG_PATH
108108
/plan/two:
109-
result: PLAN_RESULT
109+
result: PLAN_OUTCOME
110110
/test/one:
111-
result: TEST_RESULT
111+
result: TEST_OUTCOME
112112
log: LOG_PATH
113113

114114
Where ``OVERALL_RESULT`` is the overall result of all plan
115-
results. It is counted the same way as ``PLAN_RESULT``.
116-
117-
Where ``TEST_RESULT`` is the same as in `execute`_ step
118-
definition:
119-
120-
* info - test finished and produced only information
121-
message
122-
* passed - test finished and passed
123-
* failed - test finished and failed
124-
* error - a problem encountered during test execution
125-
126-
Note the priority of test results is as written above,
115+
results. It is counted the same way as ``PLAN_OUTCOME``.
116+
117+
Where ``TEST_OUTCOME`` is the same as ``OUTCOME`` in
118+
the `execute`_ step definition:
119+
120+
pass
121+
Test execution successfully finished and passed.
122+
info
123+
Test finished but only produced an informational
124+
message. Represents a soft pass, used for skipped
125+
tests and for tests with the :ref:`/spec/tests/result`
126+
attribute set to *ignore*. Automation must treat
127+
this as a passed test.
128+
warn
129+
A problem appeared during test execution which does
130+
not affect test results but might be worth checking
131+
and fixing. For example test cleanup phase failed
132+
or a check failure for a passing test. Automation
133+
must treat this as a failed test.
134+
error
135+
Undefined problem encountered during test execution.
136+
Human inspection is needed to investigate whether it
137+
was a test bug, infrastructure error or a real test
138+
failure. Automation must treat it as a failed test.
139+
fail
140+
Test execution successfully finished and failed.
141+
142+
Note the priority of test results is as written above,
127143
with ``info`` having the lowest priority and ``error`` has
128-
the highest. This is important for ``PLAN_RESULT``.
144+
the highest. This is important for ``PLAN_OUTCOME``.
129145

130-
Where ``PLAN_RESULT`` is the overall result or all test
146+
Where ``PLAN_OUTCOME`` is the overall result or all test
131147
results for the plan run. It has the same values as
132-
``TEST_RESULT``. Plan result is counted according to the
148+
``TEST_OUTCOME``. Plan result is counted according to the
133149
priority of the test outcome values. For example:
134150

135151
* if the test results are info, passed, passed - the

spec/tests/check.fmf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
summary: Specify additional checks which should be enabled by the test runner.
2+
3+
story: As a tester I want to enable additional checks when running my tests.
4+
5+
description: |
6+
In some cases we want to run additional checks while running a test. A nice
7+
example is a check for unexpected SELinux AVCs produced during the test,
8+
this can point to additional issues a user can run into and is very valuable
9+
for Red Hat based and Fedora distros.
10+
11+
These checks can alter the test result and usually provide a separate log
12+
output. Note that the value set here can be overridden by L2 metadata.
13+
14+
Currently the following additional checks are recognized:
15+
16+
avc
17+
SELinux AVCs are inspected during the test time
18+
test-inspector
19+
Run test inspector
20+
21+
By default no additional checks are run.
22+
23+
example: |
24+
check:
25+
- avc
26+
- test-inspector

0 commit comments

Comments
 (0)