Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Platform
Development
swh-core
Commits
5cb103a2
Commit
5cb103a2
authored
2 years ago
by
vlorentz
Browse files
Options
Downloads
Patches
Plain Diff
raise TransientRemoteException for 502 errors
parent
d9c17435
No related branches found
No related tags found
1 merge request
!344
raise TransientRemoteException for 502 errors
Pipeline
#1343
passed
2 years ago
Stage: external
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
swh/core/api/__init__.py
+1
-1
1 addition, 1 deletion
swh/core/api/__init__.py
swh/core/api/tests/test_rpc_client.py
+2
-2
2 additions, 2 deletions
swh/core/api/tests/test_rpc_client.py
with
3 additions
and
3 deletions
swh/core/api/__init__.py
+
1
−
1
View file @
5cb103a2
...
...
@@ -343,7 +343,7 @@ class RPCClient(metaclass=MetaRPCClient):
elif
status_class
==
5
:
cls
:
Type
[
RemoteException
]
if
status_code
==
503
:
if
status_code
in
(
502
,
503
)
:
# This isn't a generic HTTP client and we know the server does
# not support the Retry-After header, so we do not implement
# it here either.
...
...
This diff is collapsed.
Click to expand it.
swh/core/api/tests/test_rpc_client.py
+
2
−
2
View file @
5cb103a2
...
...
@@ -149,7 +149,7 @@ def test_client_reraise_exception(rpc_client, requests_mock):
assert
str
(
exc_info
.
value
)
==
error_message
@pytest.mark.parametrize
(
"
status_code
"
,
[
400
,
500
,
503
])
@pytest.mark.parametrize
(
"
status_code
"
,
[
400
,
500
,
502
,
503
])
def
test_client_raise_remote_exception
(
rpc_client
,
requests_mock
,
status_code
):
"""
Exception caught server-side and not whitelisted will be wrapped and raised
...
...
@@ -171,7 +171,7 @@ def test_client_raise_remote_exception(rpc_client, requests_mock, status_code):
assert
str
(
exc_info
.
value
.
args
[
0
][
"
type
"
])
==
"
Exception
"
assert
str
(
exc_info
.
value
.
args
[
0
][
"
message
"
])
==
error_message
if
status_code
==
503
:
if
status_code
in
(
502
,
503
)
:
assert
isinstance
(
exc_info
.
value
,
TransientRemoteException
)
else
:
assert
not
isinstance
(
exc_info
.
value
,
TransientRemoteException
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment