Skip to content

Commit 22e25fa

Browse files
authored
Merge pull request #207 from perlpunk/improve-regex
Make regex more performant
2 parents 268471c + aaf5d44 commit 22e25fa

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

openqa-label-known-issues

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ label_on_issues_from_issue_tracker() {
9191
}
9292

9393
label_on_issues_without_tickets() {
94-
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
94+
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
9595
elif label_on_issue "$id" 'File .*\.yaml.* does not exist at .*scheduler.pm' 'label:missing_schedule_file'; then return
9696
elif label_on_issue "$id" 'Compilation failed in require at .*isotovideo line 28.' 'label:schedule_compilation_error'; then return
9797
elif label_on_issue "$id" 'qemu-img: Could not open .*: No such file or directory' 'label:missing_asset'; then return

test/01-label-known-issues.t

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
source test/init
44

5-
plan tests 25
5+
plan tests 26
66

77
source _common
88

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

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

28-
try search_log 123 'foo.*bar' "$logfile1"
29+
try "search_log 123 'foo.*bar'" "$logfile1"
2930
is "$rc" 0 'successful search_log'
3031

31-
try search_log 123 'foo.*bar' "$logfile2"
32+
try "search_log 123 'foo.*bar'" "$logfile2"
3233
is "$rc" 1 'failing search_log'
3334

35+
try "search_log 123 '([dD]ownload.*failed.*404)[\S\s]*Result: setup failure'" "$logfile3"
36+
is "$rc" 0 'successful search_log'
37+
3438
try "search_log 123 'foo [z-a]' $logfile2"
3539
is "$rc" 2 'search_log with invalid pattern'
3640
has "$got" 'range out of order in character class' 'correct error message'

test/data/01-os-autoinst.txt.3

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
test
2+
aaaaa Download of bbbb failed: 404
3+
test
4+
test
5+
ccc Result: setup failure
6+
test

0 commit comments

Comments
 (0)