-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement check-result: test check failure affects test result by default #3239
Open
martinhoyer
wants to merge
6
commits into
teemtee:main
Choose a base branch
from
martinhoyer:check-results
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
12a41c4
Implement check result key feature
martinhoyer 3e4af18
Add check-result spec and release note
martinhoyer d709e11
Move and modify check schema
martinhoyer 329f632
Fix doc generation
martinhoyer 5348a2c
Add is_enum to plugins doc generate script
happz 93dbb91
Fix result interpretation, notes, tests
martinhoyer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
. /usr/share/beakerlib/beakerlib.sh || exit 1 | ||
|
||
run() | ||
{ | ||
res=$1 # expected final result of test | ||
tn=$2 # test name | ||
ret=$3 # tmt return code | ||
|
||
rlRun -s "tmt run -a --scratch --id \${run} test --name ${tn} provision --how local report -v 2>&1 >/dev/null | grep report -A2 | tail -n 1" \ | ||
${ret} "Result: ${res}, Test name: ${tn}, tmt return code: ${ret}" | ||
|
||
rlAssertGrep "${res} ${tn}" $rlRun_LOG | ||
|
||
echo | ||
} | ||
|
||
rlJournalStart | ||
rlPhaseStartSetup | ||
rlRun "run=\$(mktemp -d)" 0 "Create run directory" | ||
rlRun "pushd check_results" | ||
rlRun "set -o pipefail" | ||
rlPhaseEnd | ||
|
||
rlPhaseStartTest "Check Results Tests" | ||
run "pass" "/test/check-pass" 0 | ||
run "fail" "/test/check-fail-respect" 1 | ||
run "pass" "/test/check-fail-info" 0 | ||
run "fail" "/test/check-xfail-pass" 1 | ||
run "pass" "/test/check-xfail-fail" 0 | ||
run "pass" "/test/check-override" 0 | ||
rlPhaseEnd | ||
|
||
rlPhaseStartTest "Verbose execute prints result" | ||
rlRun -s "tmt run --id \${run} --scratch --until execute tests --filter tag:-cherry_pick provision --how local execute -v 2>&1 >/dev/null" "1" | ||
|
||
while read -r line; do | ||
rlAssertGrep "$line" "$rlRun_LOG" -F | ||
done <<-EOF | ||
00:00:00 pass /test/check-fail-info (on default-0) [1/6] | ||
00:00:00 fail /test/check-fail-respect (on default-0) (Check 'dmesg' failed, original result: pass) [2/6] | ||
00:00:00 pass /test/check-override (on default-0) [3/6] | ||
00:00:00 pass /test/check-pass (on default-0) [4/6] | ||
00:00:00 pass /test/check-xfail-fail (on default-0) [5/6] | ||
00:00:00 fail /test/check-xfail-pass (on default-0) (Check 'dmesg' failed, original result: pass) [6/6] | ||
EOF | ||
rlPhaseEnd | ||
|
||
rlPhaseStartCleanup | ||
rlRun "popd" | ||
rlRun "rm -r ${run}" 0 "Remove run directory" | ||
rlPhaseEnd | ||
rlJournalEnd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
summary: Tests for check results behaviour | ||
description: Verify that check results are correctly interpreted and affect test results | ||
|
||
/check-pass: | ||
summary: Test with passing checks | ||
test: echo "Test passed" | ||
framework: shell | ||
duration: 1m | ||
check: | ||
- how: dmesg | ||
result: respect | ||
# Expected outcome: PASS (test passes, check passes) | ||
|
||
/check-fail-respect: | ||
summary: Test with failing dmesg check (respect) | ||
test: echo "Fail Test Check Pattern" | sudo tee /dev/kmsg | ||
framework: shell | ||
duration: 1m | ||
check: | ||
- how: dmesg | ||
failure-pattern: Fail Test Check Pattern | ||
result: respect | ||
# Expected outcome: FAIL (test passes, but check fails and is respected) | ||
|
||
/check-fail-info: | ||
summary: Test with failing dmesg check (info) | ||
test: echo "Fail Test Check Pattern" | sudo tee /dev/kmsg | ||
framework: shell | ||
duration: 1m | ||
check: | ||
- how: dmesg | ||
failure-pattern: Fail Test Check Pattern | ||
result: info | ||
# Expected outcome: PASS (test passes, check fails, but should be just info) | ||
|
||
/check-xfail-pass: | ||
summary: Test with passing dmesg check (xfail) | ||
test: echo "Test passed" | ||
framework: shell | ||
duration: 1m | ||
check: | ||
- how: dmesg | ||
result: xfail | ||
# Expected outcome: FAIL (test passes, check passes but xfail expects it to fail) | ||
|
||
/check-xfail-fail: | ||
summary: Test with failing dmesg check (xfail) | ||
test: echo "Fail Test Check Pattern" | sudo tee /dev/kmsg | ||
framework: shell | ||
duration: 1m | ||
check: | ||
- how: dmesg | ||
failure-pattern: Fail Test Check Pattern | ||
result: xfail | ||
# Expected outcome: PASS (test passes, check fails but xfail expects it to fail) | ||
|
||
# TODO: handle multiple checks with same 'name'/'how' | ||
#/check-multiple: | ||
# summary: Test with multiple checks with different result interpretations | ||
# test: echo "Fail Test Check Pattern" | sudo tee /dev/kmsg | ||
# framework: shell | ||
# duration: 1m | ||
# check: | ||
# - how: dmesg | ||
# failure-pattern: Fail Test Check Pattern | ||
# result: respect | ||
# - how: dmesg | ||
# result: xfail | ||
# - how: dmesg | ||
# failure-pattern: Fail Test Check Pattern | ||
# result: info | ||
# # Expected outcome: FAIL (first dmesg check fails and is respected, second dmesg check passes but xfail expects it to fail, third failing dmesg check is just info) | ||
|
||
/check-override: | ||
summary: Test with failing dmesg check but overridden by test result | ||
test: echo "Fail Test Check Pattern" | sudo tee /dev/kmsg | ||
framework: shell | ||
duration: 1m | ||
result: pass | ||
check: | ||
- how: dmesg | ||
failure-pattern: Fail Test Check Pattern | ||
result: respect | ||
# Expected outcome: PASS (test passes, check fails but is overridden by 'result: pass') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we ok with this? I see no reason to add note when original and actual results are the same, no?