Skip to content

Commit bd1d39e

Browse files
authored
Merge pull request #478 from mloviska/no_auto_investigation2
Allow NO_INVESTIGATION=0
2 parents 3cadb1c + cbd85c3 commit bd1d39e

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

openqa-investigate

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +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
382+
user_unset="$(echo "$job_data" | runjq -r '.job.settings.NO_INVESTIGATION')" && [[ ! "$user_unset" =~ "null" ]] && [[ $user_unset -eq 1 ]] && echo "NO_INVESTIGATION=1 detected, skipping" && return 0
383383

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

test/02-investigate.t

Lines changed: 17 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 100
6+
plan tests 102
77

88
host=localhost
99
url=https://localhost
@@ -93,6 +93,9 @@ client-get-job() {
9393
10042)
9494
echo '{"job": { "test": "vim", "result": "failed", "group": "42", "settings": {"NO_INVESTIGATION": "1"} } }'
9595
;;
96+
10043)
97+
echo '{"job": { "test": "vim", "result": "failed", "group": "43", "settings": {"NO_INVESTIGATION": "0"} } }'
98+
;;
9699
404)
97100
echo '404 Not Found'
98101
;;
@@ -144,6 +147,9 @@ client-get-job-comments() {
144147
10035)
145148
echo '[{"id": 1236, "text":"Starting investigation for job 10035"}]'
146149
;;
150+
10043)
151+
echo '[{"id": 10043, "text":"Starting investigation for job 10043"}]'
152+
;;
147153
3000)
148154
echo '[{"id": 1236, "text":"Automatic investigation jobs for job\n*a:investigate:retry*: t#30001\n*a:investigate:last_good_tests:coffee*: t#30002\n*a:investigate:last_good_build:2001*: t#30003\n*a:investigate:last_good_tests_and_build:coffee+2001*: t#30004"}]'
149155
;;
@@ -174,6 +180,9 @@ client-post-job-comment() {
174180
10035)
175181
echo '{"id": 1236}'
176182
;;
183+
10043)
184+
echo '{"id": 10043}'
185+
;;
177186
3000)
178187
warn "Commenting 3000 ($@)"
179188
exit 99
@@ -231,6 +240,9 @@ get-dependencies-ajax() {
231240
10042)
232241
echo '{"cluster":{}, "edges":[], "nodes":[{"id":10042,"state":"done","result":"failed"}]}'
233242
;;
243+
10043)
244+
echo '{"cluster":{}, "edges":[], "nodes":[{"id":10043,"state":"done","result":"failed"}]}'
245+
;;
234246
*)
235247
echo '{"debug": "get-dependencies-ajax '"$tid"'"}'
236248
;;
@@ -316,6 +328,10 @@ try investigate 10042
316328
is "$rc" 0 'NO_INVESTIGATION=1, a failed job with this variable should be skipped'
317329
has "$got" 'NO_INVESTIGATION=1 detected, skipping'
318330

331+
try investigate 10043
332+
is "$rc" 0 "Successful clone, NO_INVESTIGATION != 1 should not change default behavior"
333+
has "$got" '_TRIGGER_JOB_DONE_HOOK=1' "job is cloned with _TRIGGER_JOB_DONE_HOOK"
334+
319335
test-post-investigate() {
320336
# job is one of the other investigation types, e.g. :investigate:last_good_tests
321337
try investigate 3001

0 commit comments

Comments
 (0)