3
3
source test/init
4
4
bpan:source bashplus +err +fs +sym
5
5
6
- plan tests 27
6
+ plan tests 35
7
7
8
8
host=localhost
9
9
url=https://localhost
@@ -33,6 +33,12 @@ openqa-cli() {
33
33
echo ' {"job": { "test": "vim", "priority": 50, "settings" : {} } }'
34
34
elif [[ " $1 $2 " == " --json jobs/27" ]]; then
35
35
echo ' {"job": { "test": "vim", "clone_id" : 28 } }'
36
+ elif [[ " $1 $2 " == " --json jobs/33" ]]; then
37
+ echo ' {"job": { "test": "vim", "test": "vim:investigate:abc", "result": "failed" } }'
38
+ elif [[ " $1 $2 " == " --json jobs/34" ]]; then
39
+ echo ' {"job": { "test": "vim:investigate:retry", "result": "failed", "settings": {"OPENQA_INVESTIGATE_ORIGIN": "35"} } }'
40
+ elif [[ " $1 $2 " == " --json jobs/35" ]]; then
41
+ echo ' {"job": { "test": "vim:investigate:retry", "result": "passed", "settings": {"OPENQA_INVESTIGATE_ORIGIN": "35"} } }'
36
42
elif [[ $@ == " -X POST jobs/30/comments text=Starting investigation for job 31" ]]; then
37
43
echo ' {"id": 1234}'
38
44
elif [[ $@ == $' -X PUT jobs/30/comments/1234 text=Automatic investigation jobs for job 31:\n\n foo' ]]; then
@@ -47,10 +53,15 @@ openqa-cli() {
47
53
echo ' {"id": 1237}'
48
54
elif [[ $@ == " -X GET jobs/32/comments" ]]; then
49
55
echo ' [{"id": 1236, "text":"Starting investigation for job 32"},{"id": 1237, "text":"Starting investigation for job 32"}]'
56
+ elif [[ $@ =~ " -X POST jobs/35/comments" ]]; then
57
+ warn " Commenting 35 ($@ )"
58
+ exit 99
50
59
elif [[ $@ == ' --apibase --json tests/27/dependencies_ajax' ]]; then
51
60
echo ' {"cluster":{}, "edges":[], "nodes":[{"id":27,"state":"done","result":"passed"}]}'
52
61
elif [[ $@ == ' --apibase --json tests/28/dependencies_ajax' ]]; then
53
62
echo ' {"cluster":{}, "edges":[], "nodes":[{"id":28,"state":"done","result":"failed"}]}'
63
+ elif [[ $@ == ' --apibase --json tests/33/dependencies_ajax' ]]; then
64
+ echo ' {"cluster":{}, "edges":[], "nodes":[]}'
54
65
elif [[ $@ == ' --apibase --json tests/29/dependencies_ajax' ]]; then
55
66
echo ' {"cluster":{"cluster_foo":[28],"cluster_bar":[29]}, "edges":[], "nodes":[{"id":28,"state":"done","result":"failed"},{"id":29,"state":"done","result":"passed"}]}'
56
67
elif [[ $@ == ' --apibase --json tests/30/dependencies_ajax' ]]; then
@@ -94,6 +105,20 @@ try force=true investigate 31
94
105
is " $rc " 0 ' success when job is skipped (because of exclude_no_group and job w/o group)'
95
106
has " $got " ' Job w/o job group, $exclude_no_group is set, skipping investigation'
96
107
108
+ try investigate 33
109
+ is " $rc " 0 ' success (33)'
110
+ has " $got " " Job is ':investigate:' already, skipping investigation" " skip :investigate: (33)"
111
+
112
+ try investigate 34
113
+ is " $rc " 2 ' mocked function returned failure (34)'
114
+ has " $got " " Commenting 35" " Posting comment on OPENQA_INVESTIGATE_ORIGIN (34)"
115
+ has " $got " " likely not a sporadic" " not sporadic (34)"
116
+
117
+ try investigate 35
118
+ is " $rc " 2 ' mocked function returned failure (35)'
119
+ has " $got " " Commenting 35" " Posting comment on OPENQA_INVESTIGATE_ORIGIN (35)"
120
+ has " $got " " likely a sporadic" " sporadic (35)"
121
+
97
122
# test syncing via investigation comment; we're first
98
123
try force=true sync_via_investigation_comment 31 30
99
124
is " $rc " 255 ' do not skip if we own first investigation comment'
0 commit comments