@@ -3112,7 +3112,6 @@ def test_resolve_storage_credentials_empty() -> None:
31123112def test_resolve_storage_credentials_skips_hadoop_only () -> None :
31133113 from pyiceberg .catalog .rest .scan_planning import StorageCredential
31143114
3115- # The longer fs.* prefix would win a blind longest-match; the filter drops it.
31163115 credentials = [
31173116 StorageCredential (prefix = "s3://warehouse/jindo" , config = {"fs.s3.access-key" : "hadoop-k" }),
31183117 StorageCredential (prefix = "s3://warehouse" , config = {"s3.access-key-id" : "native-k" }),
@@ -3141,10 +3140,20 @@ def test_resolve_storage_credentials_all_hadoop_only_returns_empty() -> None:
31413140 assert RestCatalog ._resolve_storage_credentials (credentials , "custom://bucket/path" ) == {}
31423141
31433142
3144- def test_resolve_storage_credentials_root_prefix_fallback_for_s3_compatible_scheme () -> None :
3143+ def test_resolve_storage_credentials_s3a_s3n_match_root_prefix_directly () -> None :
3144+ from pyiceberg .catalog .rest .scan_planning import StorageCredential
3145+
3146+ credentials = [
3147+ StorageCredential (prefix = "s3" , config = {"s3.access-key-id" : "native-k" }),
3148+ ]
3149+ for scheme in ("s3a" , "s3n" ):
3150+ result = RestCatalog ._resolve_storage_credentials (credentials , f"{ scheme } ://bucket/path" )
3151+ assert result == {"s3.access-key-id" : "native-k" }, f"{ scheme } :// should match prefix='s3' directly"
3152+
3153+
3154+ def test_resolve_storage_credentials_root_prefix_fallback_for_oss () -> None :
31453155 from pyiceberg .catalog .rest .scan_planning import StorageCredential
31463156
3147- # oss:// is routed through pyarrow's S3FileSystem, so ROOT_PREFIX "s3" applies.
31483157 credentials = [
31493158 StorageCredential (prefix = "s3" , config = {"s3.access-key-id" : "native-k" }),
31503159 ]
0 commit comments