Skip to content

Commit 34c8cbf

Browse files
committed
Avoid un-throttled maintenance incidents for Leap 15.6
* Make `has_pending_submission` work with maintenance incidents because this function is called individually for maintenance incidents as of commit e2ab39f * See https://progress.opensuse.org/issues/191106
1 parent e5c7db4 commit 34c8cbf

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

os-autoinst-obs-auto-submit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,8 @@ has_pending_submission() {
311311
else
312312
# check for SR on OBS
313313
# note: Avoid using `grep --quiet` here to keep consuming input so osc does not run into "BrokenPipeError: [Errno 32] Broken pipe".
314-
requestlist=$($osc request list --project "$target" --package "$package" --type submit --state new,review --mine --days "$throttle_days_value")
315-
if echo "$requestlist" | grep 'Created by' > /dev/null; then
314+
requestlist=$($osc request list --project "$dst_project" --package "$package" --type submit,maintenance_incident --state new,review --days "$throttle_days_value")
315+
if echo "$requestlist" | grep --perl-regexp "(-> $target|release in $target)" > /dev/null; then
316316
log-info "Skipping submission, there is still a pending SR for package $package in project $target younger than $throttle_days_value days."
317317
echo "$requestlist"
318318
return 1

test/08-auto-submit.t

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
#!/usr/bin/env bash
22

33
source test/init
4-
plan tests 11
4+
plan tests 13
55

66
mock_osc() {
77
local cmd=$1
88
local args=(${@:2})
9-
if [[ $cmd == 'request' && ${args[0]} == 'list' ]]; then
9+
if [[ $cmd == 'request' && ${args[0]} == 'list' && ${args[9]} == '--days' && ${args[10]} == "$throttle_days" ]]; then
1010
_request_list
1111
fi
1212
}
1313

14-
_request_list() {
15-
echo "Created by: foo"
16-
}
14+
_requests=(
15+
'submit: devel:openQA:tested/openQA@c0f8ee6a233ed250dbc54c19dee50118 -> openSUSE:Factory'
16+
'maintenance_incident: devel:openQA:tested/openQA@ae3d930a703dc411e249d644ad8b6802 -> openSUSE:Maintenance (release in openSUSE:Backports:SLE-15-SP6:Update)'
17+
)
18+
19+
_request_list() { echo "${_requests[@]}"; }
1720

1821
mock_git_obs() {
1922
if [[ $3 == 'repos/pool/openQA/pulls?state=open&sort=recentupdate' ]]; then
@@ -42,12 +45,10 @@ is "$rc" 0 "returns 0 with throttle_days=0"
4245

4346
throttle_days=1
4447
try has_pending_submission "$package" "$submit_target"
45-
is "$rc" 1 "returns 1 with existing SRs"
46-
like "$got" "Created by: foo" "expected output"
48+
is "$rc" 1 "returns 1 with existing SR"
49+
like "$got" "Skipping submission, there is still a pending SR for package os-autoinst" "expected output"
4750

48-
_request_list() {
49-
echo ""
50-
}
51+
_request_list() { echo; }
5152
try has_pending_submission "$package" "$submit_target"
5253
is "$rc" 0 "returns 0 without existing SRs"
5354
like "$got" "info.*has_pending_submission" "no output"
@@ -66,5 +67,11 @@ like "$got" "info.*has_pending_submission\\($package, $submit_target\\)$" "no ou
6667

6768
throttle_days_leap_16=3
6869
try has_pending_submission "$package" "$submit_target"
69-
is "$rc" 1 "returns 1 with existing PR recent than throttle config of $throttle_days days"
70+
is "$rc" 1 "returns 1 with existing PR that is more recent than throttle config of $throttle_days days"
7071
like "$got" "info.*Skipping submission.*pending PR.*https://foo/bar" "expected output (recent PR)"
72+
73+
_request_list() { echo "${_requests[@]}"; }
74+
submit_target=openSUSE:Backports:SLE-15-SP6:Update
75+
try has_pending_submission "$package" "$submit_target"
76+
is "$rc" 1 "returns 1 with existing maintenance incident that is more recent than throttle config of $throttle_days days"
77+
like "$got" "info.*Skipping submission.*pending SR"

0 commit comments

Comments
 (0)