Skip to content

Commit b0f9480

Browse files
committed
openqa-trigger-bisect-jobs: Also evaluate "exclude_name_regex"
It was observed that openqa-trigger-bisect-jobs were triggered even though according openqa-investigate jobs were not as the variable "exclude_name_regex" would exclude the job. However unlike "exclude_group_regex" the variable "exclude_name_regex" so far was only evaluated within openqa-investigate, not openqa-trigger-bisect-jobs. This commit adds according handling within openqa-trigger-bisect-jobs with according unit test.
1 parent a34dfec commit b0f9480

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

openqa-trigger-bisect-jobs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,10 @@ def main(args):
264264
if re.search(exclude_group_regex, full_group):
265265
return
266266

267+
exclude_name_regex = os.environ.get("exclude_name_regex", "")
268+
if len(exclude_name_regex) > 0 and re.search(exclude_name_regex, job["test"]):
269+
return
270+
267271
log.debug("Received job data: %s" % test_data)
268272
test = job["settings"]["TEST"]
269273
prio = int(job["priority"]) + args.priority_add

tests/test_trigger_bisect_jobs.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
openqa = importlib.util.module_from_spec(spec)
2525
loader.exec_module(openqa)
2626

27-
# should only affect test_exclude_group_regex() as it does not match other tests
28-
os.environ["exclude_group_regex"] = "s.*parent?-group / some-.*"
29-
3027
Incident = openqa.Incident
3128

3229

@@ -301,10 +298,25 @@ def test_exclude_group_regex():
301298
args = args_factory()
302299
openqa.openqa_clone = MagicMock(return_value="")
303300
openqa.fetch_url = MagicMock(side_effect=mocked_fetch_url)
301+
# should only affect test_exclude_group_regex() as it does not match other tests
302+
os.environ["exclude_group_regex"] = "s.*parent?-group / some-.*"
303+
304+
args.url = "http://openqa.opensuse.org/tests/123457"
305+
openqa.main(args)
306+
openqa.openqa_clone.assert_not_called()
307+
del os.environ["exclude_group_regex"]
308+
309+
310+
def test_exclude_name_regex():
311+
args = args_factory()
312+
openqa.openqa_clone = MagicMock(return_value="")
313+
openqa.fetch_url = MagicMock(side_effect=mocked_fetch_url)
304314

315+
os.environ["exclude_name_regex"] = "with.*group"
305316
args.url = "http://openqa.opensuse.org/tests/123457"
306317
openqa.main(args)
307318
openqa.openqa_clone.assert_not_called()
319+
del os.environ["exclude_name_regex"]
308320

309321

310322
def test_exclude_investigated():

0 commit comments

Comments
 (0)