fix(release): retry FRP tunnel reconnection responses
Gitea CI / Check code and tests (pull_request) Successful in 5m11s
Gitea CI / Build Android APK (pull_request) Failing after 4m12s
Gitea CI / Audit and package Windows x64 (pull_request) Canceled after 0s
Gitea CI / Assemble and validate CI artifacts (pull_request) Canceled after 0s
Gitea CI / Gitea CI passed (pull_request) Canceled after 0s
Gitea CI / Build Windows x64 app (pull_request) Canceled after 5m11s
Gitea CI / Check code and tests (pull_request) Successful in 5m11s
Gitea CI / Build Android APK (pull_request) Failing after 4m12s
Gitea CI / Audit and package Windows x64 (pull_request) Canceled after 0s
Gitea CI / Assemble and validate CI artifacts (pull_request) Canceled after 0s
Gitea CI / Gitea CI passed (pull_request) Canceled after 0s
Gitea CI / Build Windows x64 app (pull_request) Canceled after 5m11s
This commit is contained in:
1 parent
2497865d0e
commit
933ace4e51
3 files changed
+34
No files matched your search
@@ -9,6 +9,33 @@ import release_transport as transfers
|
||||
|
||||
|
||||
class TransferToolsTests(unittest.TestCase):
|
||||
def test_frp_tunnel_not_found_page_is_retried_as_a_temporary_failure(self):
|
||||
calls = 0
|
||||
|
||||
def transport(url, data=None, method=None, content_type=None):
|
||||
nonlocal calls
|
||||
if method is None:
|
||||
return []
|
||||
calls += 1
|
||||
if calls == 1:
|
||||
body = b'<h1>Not Found</h1><a href="https://github.com/fatedier/frp">frp</a>'
|
||||
raise urllib.error.HTTPError(url, 404, 'Not Found',
|
||||
{'Content-Type': 'text/html; charset=utf-8'}, io.BytesIO(body))
|
||||
return {}
|
||||
|
||||
with patch.object(transfers.time, 'sleep') as sleep:
|
||||
transfers.upload_contents('base', 3, {'app.zip': b'app'}, transport=transport)
|
||||
self.assertEqual(calls, 2)
|
||||
sleep.assert_called_once_with(5)
|
||||
|
||||
def test_ordinary_html_not_found_and_json_api_errors_are_not_retried(self):
|
||||
for content_type, body in [('text/html', b'<h1>Not Found</h1>'),
|
||||
('application/json', b'Not Found github.com/fatedier/frp')]:
|
||||
with self.subTest(content_type=content_type):
|
||||
error = urllib.error.HTTPError('url', 404, 'Not Found',
|
||||
{'Content-Type': content_type}, io.BytesIO(body))
|
||||
self.assertFalse(transfers.transient(error))
|
||||
|
||||
def test_transient_upload_failure_retries_without_restarting_other_files(self):
|
||||
calls = []
|
||||
|
||||
|
||||
Reference in new issue
Block a user