@@ -796,6 +796,25 @@ class PresignedUrlDownloadTestCase:
796796 }
797797 """
798798
799+ model_serving_presigned_url_internal_error_response = """
800+ {
801+ "error_code": "INTERNAL_ERROR",
802+ "message": "Can't infer requester network zone.",
803+ "details": [
804+ {
805+ "@type": "type.googleapis.com/google.rpc.ErrorInfo",
806+ "reason": "FILES_API_REQUESTER_NETWORK_ZONE_UNKNOWN",
807+ "domain": "filesystem.databricks.com"
808+ },
809+ {
810+ "@type": "type.googleapis.com/google.rpc.RequestInfo",
811+ "request_id": "b2ffb201-ff61-41ad-93e3-50d47654e924",
812+ "serving_data": ""
813+ }
814+ ]
815+ }
816+ """
817+
799818 expired_url_aws_response = (
800819 '<?xml version="1.0" encoding="utf-8"?><Error><Code>'
801820 "AuthenticationFailed</Code><Message>Server failed to authenticate "
@@ -1098,6 +1117,16 @@ def run(self, config: Config, monkeypatch) -> None:
10981117 code = 403 , only_invocation = 1 , body = PresignedUrlDownloadTestCase .presigned_url_disabled_response
10991118 ),
11001119 ),
1120+ PresignedUrlDownloadTestCase (
1121+ name = "Presigned URL is not issued because NetworkZone is not populated, should fallback to Files API" ,
1122+ file_size = 100 * 1024 * 1024 ,
1123+ expected_download_api = "files_api" ,
1124+ custom_response_create_presigned_url = CustomResponse (
1125+ code = 500 ,
1126+ only_invocation = 1 ,
1127+ body = PresignedUrlDownloadTestCase .model_serving_presigned_url_internal_error_response ,
1128+ ),
1129+ ),
11011130 PresignedUrlDownloadTestCase (
11021131 name = "Presigned URL fails with 403 when downloading, should fallback to Files API" ,
11031132 file_size = 100 * 1024 * 1024 ,
@@ -1496,6 +1525,25 @@ class MultipartUploadTestCase(UploadTestCase):
14961525 }
14971526 """
14981527
1528+ model_serving_presigned_url_internal_error_response = """
1529+ {
1530+ "error_code": "INTERNAL_ERROR",
1531+ "message": "Can't infer requester network zone.",
1532+ "details": [
1533+ {
1534+ "@type": "type.googleapis.com/google.rpc.ErrorInfo",
1535+ "reason": "FILES_API_REQUESTER_NETWORK_ZONE_UNKNOWN",
1536+ "domain": "filesystem.databricks.com"
1537+ },
1538+ {
1539+ "@type": "type.googleapis.com/google.rpc.RequestInfo",
1540+ "request_id": "b2ffb201-ff61-41ad-93e3-50d47654e924",
1541+ "serving_data": ""
1542+ }
1543+ ]
1544+ }
1545+ """
1546+
14991547 def __init__ (
15001548 self ,
15011549 name : str ,
@@ -1963,6 +2011,18 @@ def to_string(test_case: "MultipartUploadTestCase") -> str:
19632011 expected_multipart_upload_aborted = True ,
19642012 expected_single_shot_upload = True ,
19652013 ),
2014+ MultipartUploadTestCase (
2015+ "Create upload URL: fallback to single-shot upload when presigned URLs are not issue because of the NetworkZone is not populated to Filesystem service" ,
2016+ content_size = 1024 * 1024 ,
2017+ custom_response_on_create_multipart_url = CustomResponse (
2018+ code = 500 ,
2019+ body = MultipartUploadTestCase .model_serving_presigned_url_internal_error_response ,
2020+ # 1 failure is enough
2021+ only_invocation = 1 ,
2022+ ),
2023+ expected_multipart_upload_aborted = True ,
2024+ expected_single_shot_upload = True ,
2025+ ),
19662026 # -------------------------- failures on part upload --------------------------
19672027 MultipartUploadTestCase (
19682028 "Upload part: 403 response will trigger fallback to single-shot upload on Azure" ,
@@ -2502,6 +2562,17 @@ def to_string(test_case: "ResumableUploadTestCase") -> str:
25022562 expected_multipart_upload_aborted = False , # upload didn't start
25032563 expected_single_shot_upload = True ,
25042564 ),
2565+ ResumableUploadTestCase (
2566+ "Create resumable URL: fallback to single-shot upload when presigned URLs are not issued because of the NetworkZone is not populated to Filesystem service" ,
2567+ stream_size = 1024 * 1024 ,
2568+ custom_response_on_create_resumable_url = CustomResponse (
2569+ code = 500 ,
2570+ body = MultipartUploadTestCase .model_serving_presigned_url_internal_error_response ,
2571+ only_invocation = 1 ,
2572+ ),
2573+ expected_multipart_upload_aborted = False , # upload didn't start
2574+ expected_single_shot_upload = True ,
2575+ ),
25052576 ResumableUploadTestCase (
25062577 "Create resumable URL: 500 response is not retried" ,
25072578 stream_size = 1024 * 1024 ,
0 commit comments