@@ -224,11 +224,18 @@ def list_files_recursively(client: WorkspaceClient, path: str):
224224
225225
226226def validate_upload (
227- client : WorkspaceClient , catalog : str , volume : str , volume_path : str , num_files : int
227+ client : WorkspaceClient ,
228+ catalog : str ,
229+ volume : str ,
230+ volume_path : str ,
231+ num_files : int ,
232+ filepath_in_destination : list [str ] = None ,
228233):
229234 files = list_files_recursively (client , _get_volume_path (catalog , volume , volume_path ))
230235
231236 assert len (files ) == num_files
237+ if filepath_in_destination :
238+ assert files == filepath_in_destination
232239
233240 for i in range (num_files ):
234241 resp = client .files .download (files [i ])
@@ -322,3 +329,48 @@ async def test_volumes_native_destination_same_filenames_different_folder(upload
322329 volume_path = volume_path ,
323330 num_files = 2 ,
324331 )
332+
333+
334+ @pytest .mark .asyncio
335+ @pytest .mark .tags (CONNECTOR_TYPE , DESTINATION_TAG , BLOB_STORAGE_TAG )
336+ @requires_env (
337+ "DATABRICKS_HOST" , "DATABRICKS_CLIENT_ID" , "DATABRICKS_CLIENT_SECRET" , "DATABRICKS_CATALOG"
338+ )
339+ async def test_volumes_native_destination_different_fullpath_relative_path (upload_file : Path ):
340+ env_data = get_basic_auth_env_data ()
341+ volume_path = f"databricks-volumes-test-output-{ uuid .uuid4 ()} "
342+ file_data = FileData (
343+ source_identifiers = SourceIdentifiers (
344+ relative_path = f"folder2/{ upload_file .name } " ,
345+ fullpath = f"folder1/folder2/{ upload_file .name } " ,
346+ filename = upload_file .name ,
347+ ),
348+ connector_type = CONNECTOR_TYPE ,
349+ identifier = "mock file data" ,
350+ )
351+ with databricks_destination_context (
352+ volume = "test-platform" , volume_path = volume_path , env_data = env_data
353+ ) as workspace_client :
354+ connection_config = env_data .get_connection_config ()
355+ uploader = DatabricksNativeVolumesUploader (
356+ connection_config = connection_config ,
357+ upload_config = DatabricksNativeVolumesUploaderConfig (
358+ volume = "test-platform" ,
359+ volume_path = volume_path ,
360+ catalog = env_data .catalog ,
361+ ),
362+ )
363+ uploader .precheck ()
364+ uploader .run (path = upload_file , file_data = file_data )
365+
366+ filepath_in_destination = [
367+ f"/Volumes/utic-dev-tech-fixtures/default/test-platform/{ volume_path } /folder1/folder2/DA-1p-with-duplicate-pages.pdf.json.json"
368+ ]
369+ validate_upload (
370+ client = workspace_client ,
371+ catalog = env_data .catalog ,
372+ volume = "test-platform" ,
373+ volume_path = volume_path ,
374+ num_files = 1 ,
375+ filepath_in_destination = filepath_in_destination ,
376+ )
0 commit comments