Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle exception when making testing-farm request #655

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions snapshot_manager/snapshot_manager/snapshot_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,17 +368,23 @@ def check_todays_builds(self) -> None:
self.github.flip_test_label(issue, chroot, in_testing)
else:
logging.info(f"Starting tests for chroot {chroot}")
request = tf.TestingFarmRequest.make(
chroot=chroot,
config=self.config,
issue=issue,
copr_build_ids=current_copr_build_ids,
)
logging.info(
f"testing-farm request ID for {chroot}: {request.request_id}"
)
requests[chroot] = request
self.github.flip_test_label(issue, chroot, in_testing)
try:
request = tf.TestingFarmRequest.make(
chroot=chroot,
config=self.config,
issue=issue,
copr_build_ids=current_copr_build_ids,
)
except Exception as ex:
logging.warning(
f"testing-farm request for {chroot} failed with: {ex}"
)
else:
logging.info(
f"testing-farm request ID for {chroot}: {request.request_id}"
)
requests[chroot] = request
self.github.flip_test_label(issue, chroot, in_testing)

# Create or update a comment for testing-farm results display
if len(failed_test_cases) > 0:
Expand Down
21 changes: 21 additions & 0 deletions snapshot_manager/tests/testing_farm_util_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
""" Tests for build_status """

import datetime

import tests.base_test as base_test

import snapshot_manager.github_util as github_util
import snapshot_manager.testing_farm_util as tf


class TestTestingFarmUtil(base_test.TestBase):
def test_make_with_missing_compose(self):
cfg = self.config
cfg.datetime = datetime.datetime(year=2024, month=2, day=27)
self.assertEqual("20240227", cfg.yyyymmdd)
gh = github_util.GithubClient(config=cfg)

issue = gh.get_todays_github_issue(
strategy="big-merge", github_repo="fedora-llvm-team/llvm-snapshots"
)

with self.assertRaises(SystemError):
tf.TestingFarmRequest.make(
chroot="fedora-900-x86_64",
config=self.config,
issue=issue,
copr_build_ids=[1, 2, 3],
)

def test_fetch_failed_test_cases_from_file(self):
request_id = "1f25b0df-71f1-4a13-a4b8-c066f6f5f116"
chroot = "fedora-39-x86_64"
Expand Down