Skip to content

Commit d41216d

Browse files
authored
Handle exception when making testing-farm request (#655)
* Handle exception when making testing-farm request We also add an exception that checks the exception is really thrown if a compose is determined that doesn't exist.
1 parent e488fdf commit d41216d

File tree

2 files changed

+38
-11
lines changed

2 files changed

+38
-11
lines changed

snapshot_manager/snapshot_manager/snapshot_manager.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -368,17 +368,23 @@ def check_todays_builds(self) -> None:
368368
self.github.flip_test_label(issue, chroot, in_testing)
369369
else:
370370
logging.info(f"Starting tests for chroot {chroot}")
371-
request = tf.TestingFarmRequest.make(
372-
chroot=chroot,
373-
config=self.config,
374-
issue=issue,
375-
copr_build_ids=current_copr_build_ids,
376-
)
377-
logging.info(
378-
f"testing-farm request ID for {chroot}: {request.request_id}"
379-
)
380-
requests[chroot] = request
381-
self.github.flip_test_label(issue, chroot, in_testing)
371+
try:
372+
request = tf.TestingFarmRequest.make(
373+
chroot=chroot,
374+
config=self.config,
375+
issue=issue,
376+
copr_build_ids=current_copr_build_ids,
377+
)
378+
except Exception as ex:
379+
logging.warning(
380+
f"testing-farm request for {chroot} failed with: {ex}"
381+
)
382+
else:
383+
logging.info(
384+
f"testing-farm request ID for {chroot}: {request.request_id}"
385+
)
386+
requests[chroot] = request
387+
self.github.flip_test_label(issue, chroot, in_testing)
382388

383389
# Create or update a comment for testing-farm results display
384390
if len(failed_test_cases) > 0:

snapshot_manager/tests/testing_farm_util_test.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
11
""" Tests for build_status """
22

3+
import datetime
4+
35
import tests.base_test as base_test
46

7+
import snapshot_manager.github_util as github_util
58
import snapshot_manager.testing_farm_util as tf
69

710

811
class TestTestingFarmUtil(base_test.TestBase):
12+
def test_make_with_missing_compose(self):
13+
cfg = self.config
14+
cfg.datetime = datetime.datetime(year=2024, month=2, day=27)
15+
self.assertEqual("20240227", cfg.yyyymmdd)
16+
gh = github_util.GithubClient(config=cfg)
17+
18+
issue = gh.get_todays_github_issue(
19+
strategy="big-merge", github_repo="fedora-llvm-team/llvm-snapshots"
20+
)
21+
22+
with self.assertRaises(SystemError):
23+
tf.TestingFarmRequest.make(
24+
chroot="fedora-900-x86_64",
25+
config=self.config,
26+
issue=issue,
27+
copr_build_ids=[1, 2, 3],
28+
)
29+
930
def test_fetch_failed_test_cases_from_file(self):
1031
request_id = "1f25b0df-71f1-4a13-a4b8-c066f6f5f116"
1132
chroot = "fedora-39-x86_64"

0 commit comments

Comments
 (0)