Skip to content

Commit 3cadb1c

Browse files
authored
Merge pull request #477 from mloviska/no_auto_investigation
Allow users to turn off investigation runs
2 parents da4ddbe + b64fc38 commit 3cadb1c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

openqa-investigate

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ investigate() {
379379
group="$(echo "$job_data" | runjq -r '.job.parent_group + " / " + .job.group')" || return $?
380380
[[ "$group" = " / " ]] && [[ "$exclude_no_group" = "true" ]] && echo "Job w/o job group, \$exclude_no_group is set, skipping investigation" && return 0
381381
[[ "$group" =~ $exclude_group_regex ]] && echo "Job group '$group' matches \$exclude_group_regex '$exclude_group_regex', skipping investigation" && return 0
382+
user_unset="$(echo "$job_data" | runjq -r '.job.settings.NO_INVESTIGATION')" && [[ ! "$user_unset" =~ "null" ]] && echo "NO_INVESTIGATION=1 detected, skipping" && return 0
382383

383384
# Optionally we can find "first failed", could extend openQA investigation
384385
# method instead for we are just working based on supplied job which can

test/02-investigate.t

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
source test/init
44
bpan:source bashplus +err +fs +sym
55

6-
plan tests 98
6+
plan tests 100
77

88
host=localhost
99
url=https://localhost
@@ -90,6 +90,9 @@ client-get-job() {
9090
10035)
9191
echo '{"job": { "test": "vim", "result": "failed", "parent_group": "foo", "group": "bar", "settings": {"OPENQA_INVESTIGATE_ORIGIN": "10035"} } }'
9292
;;
93+
10042)
94+
echo '{"job": { "test": "vim", "result": "failed", "group": "42", "settings": {"NO_INVESTIGATION": "1"} } }'
95+
;;
9396
404)
9497
echo '404 Not Found'
9598
;;
@@ -225,6 +228,9 @@ get-dependencies-ajax() {
225228
10035)
226229
echo '{"cluster":{},"edges":[], "nodes":[{"id":10035,"state":"cancelled","result":"none"}]}'
227230
;;
231+
10042)
232+
echo '{"cluster":{}, "edges":[], "nodes":[{"id":10042,"state":"done","result":"failed"}]}'
233+
;;
228234
*)
229235
echo '{"debug": "get-dependencies-ajax '"$tid"'"}'
230236
;;
@@ -306,6 +312,10 @@ try force=true investigate 10031
306312
is "$rc" 0 'success when job is skipped (because of exclude_no_group and job w/o group)'
307313
has "$got" 'Job w/o job group, $exclude_no_group is set, skipping investigation'
308314

315+
try investigate 10042
316+
is "$rc" 0 'NO_INVESTIGATION=1, a failed job with this variable should be skipped'
317+
has "$got" 'NO_INVESTIGATION=1 detected, skipping'
318+
309319
test-post-investigate() {
310320
# job is one of the other investigation types, e.g. :investigate:last_good_tests
311321
try investigate 3001

0 commit comments

Comments
 (0)