Skip to content

Commit

Permalink
Merge pull request #207 from perlpunk/improve-regex
Browse files Browse the repository at this point in the history
Make regex more performant
  • Loading branch information
mergify[bot] authored Jan 25, 2023
2 parents 268471c + aaf5d44 commit 22e25fa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion openqa-label-known-issues
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ label_on_issues_from_issue_tracker() {
}

label_on_issues_without_tickets() {
if label_on_issue "$id" '(?s)([dD]ownload.*failed.*404).*Result: setup failure' 'label:non_existing asset, candidate for removal or wrong settings'; then return
if label_on_issue "$id" '([dD]ownload.*failed.*404)[\S\s]*Result: setup failure' 'label:non_existing asset, candidate for removal or wrong settings'; then return
elif label_on_issue "$id" 'File .*\.yaml.* does not exist at .*scheduler.pm' 'label:missing_schedule_file'; then return
elif label_on_issue "$id" 'Compilation failed in require at .*isotovideo line 28.' 'label:schedule_compilation_error'; then return
elif label_on_issue "$id" 'qemu-img: Could not open .*: No such file or directory' 'label:missing_asset'; then return
Expand Down
10 changes: 7 additions & 3 deletions test/01-label-known-issues.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source test/init

plan tests 25
plan tests 26

source _common

Expand All @@ -14,6 +14,7 @@ mock-client() {
client_call=(mock-client "${client_call[@]}")
logfile1=$dir/data/01-os-autoinst.txt.1
logfile2=$dir/data/01-os-autoinst.txt.2
logfile3=$dir/data/01-os-autoinst.txt.3

try-client-output() {
out=$logfile1
Expand All @@ -25,12 +26,15 @@ try-client-output comment_on_job 123 Label
is "$rc" 0 'successful comment_on_job'
is "$got" "client_call -X POST jobs/123/comments text=Label" 'comment_on_job works'

try search_log 123 'foo.*bar' "$logfile1"
try "search_log 123 'foo.*bar'" "$logfile1"
is "$rc" 0 'successful search_log'

try search_log 123 'foo.*bar' "$logfile2"
try "search_log 123 'foo.*bar'" "$logfile2"
is "$rc" 1 'failing search_log'

try "search_log 123 '([dD]ownload.*failed.*404)[\S\s]*Result: setup failure'" "$logfile3"
is "$rc" 0 'successful search_log'

try "search_log 123 'foo [z-a]' $logfile2"
is "$rc" 2 'search_log with invalid pattern'
has "$got" 'range out of order in character class' 'correct error message'
Expand Down
6 changes: 6 additions & 0 deletions test/data/01-os-autoinst.txt.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
test
aaaaa Download of bbbb failed: 404
test
test
ccc Result: setup failure
test

0 comments on commit 22e25fa

Please sign in to comment.