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

Fix some tests #627

Merged
merged 1 commit into from
Sep 6, 2023
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
6 changes: 5 additions & 1 deletion janitor/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@
from aiohttp_openmetrics import Counter, Gauge, Histogram, metrics, metrics_middleware
from breezy import debug, urlutils
from breezy.branch import Branch
from breezy.errors import ConnectionError, PermissionDenied, UnexpectedHttpStatus
from breezy.errors import PermissionDenied, UnexpectedHttpStatus
try:
from breezy.errors import ConnectionError # type: ignore
except ImportError: # breezy >= 4
pass
from breezy.transport import Transport, UnsupportedProtocol, UnusableRedirect
from redis.asyncio import Redis
from silver_platter.probers import select_preferred_probers
Expand Down
5 changes: 4 additions & 1 deletion janitor/vcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@
from breezy.controldir import BranchReferenceLoop
from breezy.diff import show_diff_trees
from breezy.errors import (
ConnectionError,
InvalidHttpResponse,
NoSuchRevision,
NotBranchError,
)
try:
from breezy.errors import ConnectionError # type: ignore
except ImportError: # breezy >= 4
pass
from breezy.git.remote import RemoteGitError
from breezy.repository import Repository
from breezy.revision import NULL_REVISION
Expand Down
16 changes: 9 additions & 7 deletions janitor/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,17 @@
from breezy.controldir import ControlDir, format_registry
from breezy.errors import (
AlreadyControlDirError,
ConnectionError,
ConnectionReset,
InvalidHttpResponse,
NoRepositoryPresent,
NotBranchError,
TransportError,
TransportNotPossible,
UnexpectedHttpStatus,
)
try:
from breezy.errors import ConnectionError # type: ignore
except ImportError: # breezy >= 4
pass
from breezy.git.remote import RemoteGitError
from breezy.revision import NULL_REVISION
from breezy.transform import ImmortalLimbo, MalformedTransform, TransformRenameFailed
Expand Down Expand Up @@ -339,7 +341,7 @@ def build(self, local_tree, subpath, output_directory, config):

@backoff.on_exception(
backoff.expo,
(InvalidHttpResponse, IncompleteRead, ConnectionError, ConnectionReset),
(InvalidHttpResponse, IncompleteRead, ConnectionError),
max_tries=10,
on_backoff=lambda m: push_branch_retries.inc())
def import_branches_git(
Expand Down Expand Up @@ -394,7 +396,7 @@ def get_changed_refs(refs):

@backoff.on_exception(
backoff.expo,
(InvalidHttpResponse, IncompleteRead, ConnectionError, ConnectionReset),
(InvalidHttpResponse, IncompleteRead, ConnectionError),
max_tries=10,
on_backoff=lambda m: push_branch_retries.inc())
def import_branches_bzr(
Expand Down Expand Up @@ -480,7 +482,7 @@ def copy_output(output_log: str, tee: bool = False):
@backoff.on_exception(
backoff.expo,
(IncompleteRead, UnexpectedHttpStatus, InvalidHttpResponse,
ConnectionError, ConnectionReset, ssl.SSLEOFError),
ConnectionError, ssl.SSLEOFError),
max_tries=10,
on_backoff=lambda m: push_branch_retries.inc())
def push_branch(
Expand Down Expand Up @@ -535,7 +537,7 @@ def _push_error_to_worker_failure(e, stage):

if isinstance(
e, (InvalidHttpResponse, IncompleteRead,
ConnectionError, ConnectionReset, ssl.SSLEOFError,
ConnectionError, ssl.SSLEOFError,
ssl.SSLError)):
return WorkerFailure(
"push-failed", "Failed to push result branch: %s" % e,
Expand Down Expand Up @@ -942,7 +944,7 @@ def tag_selector(tag_name):
)
except (InvalidHttpResponse, IncompleteRead,
ConnectionError, UnexpectedHttpStatus, RemoteGitError,
TransportNotPossible, ConnectionReset,
TransportNotPossible,
ssl.SSLEOFError, ssl.SSLError, TransportError) as e:
logging.warning(
"unable to push to cache URL %s: %s",
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ module = [
# https://github.com/MagicStack/asyncpg/issues/387
"asyncpg.*",
"testing.*",
"boto3.*",
"google.protobuf.*",
"pytest_asyncio.*",
]
ignore_missing_imports = true

Expand Down
Loading