This is an automated email from the ASF dual-hosted git repository. mchades pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push: new faaa078f15 [#7432] fix(client-python): Fix test error in TestGvfsWithS3 with credential (#7461) faaa078f15 is described below commit faaa078f15fdc3c96a21ec6f76e4b0dc6bb1f754 Author: Mini Yu <y...@datastrato.com> AuthorDate: Mon Jun 30 09:40:24 2025 +0800 [#7432] fix(client-python): Fix test error in TestGvfsWithS3 with credential (#7461) ### What changes were proposed in this pull request? Fix test errors in python gvfs client test with credential ### Why are the changes needed? It's bug. Fix: #7432 ### Does this PR introduce _any_ user-facing change? N/A. ### How was this patch tested? Test locally. <img width="1579" alt="image" src="https://github.com/user-attachments/assets/61bc6c68-1d4c-46e7-b426-21b2001b8bde" /> --- .../gravitino/filesystem/gvfs_storage_handler.py | 4 +-- .../tests/integration/test_gvfs_with_abs.py | 28 +++++++++++++++++++++ .../integration/test_gvfs_with_abs_credential.py | 28 +++++++++++++++++++++ .../tests/integration/test_gvfs_with_gcs.py | 26 +++++++++++++++++++ .../integration/test_gvfs_with_gcs_credential.py | 26 +++++++++++++++++++ .../tests/integration/test_gvfs_with_hdfs.py | 3 ++- .../tests/integration/test_gvfs_with_oss.py | 26 +++++++++++++++++++ .../integration/test_gvfs_with_oss_credential.py | 26 +++++++++++++++++++ .../tests/integration/test_gvfs_with_s3.py | 26 +++++++++++++++++++ .../integration/test_gvfs_with_s3_credential.py | 29 ++++++++++++++++++++-- 10 files changed, 217 insertions(+), 5 deletions(-) diff --git a/clients/client-python/gravitino/filesystem/gvfs_storage_handler.py b/clients/client-python/gravitino/filesystem/gvfs_storage_handler.py index 518e706261..89da81f10a 100644 --- a/clients/client-python/gravitino/filesystem/gvfs_storage_handler.py +++ b/clients/client-python/gravitino/filesystem/gvfs_storage_handler.py @@ -371,7 +371,7 @@ class S3StorageHandler(StorageHandler): return None def _get_last_modified(self, entry: Dict): - return entry["LastModified"] + return entry["LastModified"] if "LastModified" in entry else None class GCSStorageHandler(StorageHandler): @@ -534,7 +534,7 @@ class OSSStorageHandler(StorageHandler): ) def _get_last_modified(self, entry: Dict): - return entry["LastModified"] + return entry["LastModified"] if "LastModified" in entry else None def _get_actual_prefix( self, diff --git a/clients/client-python/tests/integration/test_gvfs_with_abs.py b/clients/client-python/tests/integration/test_gvfs_with_abs.py index 48a1a18e30..4706a10542 100644 --- a/clients/client-python/tests/integration/test_gvfs_with_abs.py +++ b/clients/client-python/tests/integration/test_gvfs_with_abs.py @@ -148,6 +148,34 @@ class TestGvfsWithABS(TestGvfsWithHDFS): properties=cls.fileset_properties, ) + cls.multiple_locations_fileset_storage_location: str = ( + f"abfss://{cls.azure_abs_container_name}@{cls.azure_abs_account_name}.dfs.core.windows.net/" + f"{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}" + ) + cls.multiple_locations_fileset_storage_location1: str = ( + f"abfss://{cls.azure_abs_container_name}@{cls.azure_abs_account_name}.dfs.core.windows.net/" + f"{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}_1" + ) + cls.multiple_locations_fileset_gvfs_location = ( + f"gvfs://fileset/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}" + ) + catalog.as_fileset_catalog().create_multiple_location_fileset( + ident=cls.multiple_locations_fileset_ident, + fileset_type=Fileset.Type.MANAGED, + comment=cls.fileset_comment, + storage_locations={ + "default": cls.multiple_locations_fileset_storage_location, + "location1": cls.multiple_locations_fileset_storage_location1, + }, + properties={ + Fileset.PROPERTY_DEFAULT_LOCATION_NAME: "default", + **cls.fileset_properties, + }, + ) + cls.fs = AzureBlobFileSystem( account_name=cls.azure_abs_account_name, account_key=cls.azure_abs_account_key, diff --git a/clients/client-python/tests/integration/test_gvfs_with_abs_credential.py b/clients/client-python/tests/integration/test_gvfs_with_abs_credential.py index 7aeb0f3ff7..869a17c7c9 100644 --- a/clients/client-python/tests/integration/test_gvfs_with_abs_credential.py +++ b/clients/client-python/tests/integration/test_gvfs_with_abs_credential.py @@ -117,6 +117,34 @@ class TestGvfsWithCredentialABS(TestGvfsWithABS): properties=cls.fileset_properties, ) + cls.multiple_locations_fileset_storage_location: str = ( + f"abfss://{cls.azure_abs_container_name}@{cls.azure_abs_account_name}.dfs.core.windows.net/" + f"{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}" + ) + cls.multiple_locations_fileset_storage_location1: str = ( + f"abfss://{cls.azure_abs_container_name}@{cls.azure_abs_account_name}.dfs.core.windows.net/" + f"{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}_1" + ) + cls.multiple_locations_fileset_gvfs_location = ( + f"gvfs://fileset/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}" + ) + catalog.as_fileset_catalog().create_multiple_location_fileset( + ident=cls.multiple_locations_fileset_ident, + fileset_type=Fileset.Type.MANAGED, + comment=cls.fileset_comment, + storage_locations={ + "default": cls.multiple_locations_fileset_storage_location, + "location1": cls.multiple_locations_fileset_storage_location1, + }, + properties={ + Fileset.PROPERTY_DEFAULT_LOCATION_NAME: "default", + **cls.fileset_properties, + }, + ) + cls.fs = AzureBlobFileSystem( account_name=cls.azure_abs_account_name, account_key=cls.azure_abs_account_key, diff --git a/clients/client-python/tests/integration/test_gvfs_with_gcs.py b/clients/client-python/tests/integration/test_gvfs_with_gcs.py index 1c87709f0b..b3db3db27a 100644 --- a/clients/client-python/tests/integration/test_gvfs_with_gcs.py +++ b/clients/client-python/tests/integration/test_gvfs_with_gcs.py @@ -141,6 +141,32 @@ class TestGvfsWithGCS(TestGvfsWithHDFS): properties=cls.fileset_properties, ) + cls.multiple_locations_fileset_storage_location: str = ( + f"gs://{cls.bucket_name}/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}" + ) + cls.multiple_locations_fileset_storage_location1: str = ( + f"gs://{cls.bucket_name}/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}_1" + ) + cls.multiple_locations_fileset_gvfs_location = ( + f"gvfs://fileset/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}" + ) + catalog.as_fileset_catalog().create_multiple_location_fileset( + ident=cls.multiple_locations_fileset_ident, + fileset_type=Fileset.Type.MANAGED, + comment=cls.fileset_comment, + storage_locations={ + "default": cls.multiple_locations_fileset_storage_location, + "location1": cls.multiple_locations_fileset_storage_location1, + }, + properties={ + Fileset.PROPERTY_DEFAULT_LOCATION_NAME: "default", + **cls.fileset_properties, + }, + ) + cls.fs = GCSFileSystem(token=cls.key_file) # Object storage like GCS does not support making directory and can only create diff --git a/clients/client-python/tests/integration/test_gvfs_with_gcs_credential.py b/clients/client-python/tests/integration/test_gvfs_with_gcs_credential.py index f4dea40d6f..ca60b1a72a 100644 --- a/clients/client-python/tests/integration/test_gvfs_with_gcs_credential.py +++ b/clients/client-python/tests/integration/test_gvfs_with_gcs_credential.py @@ -94,6 +94,32 @@ class TestGvfsWithGCSCredential(TestGvfsWithGCS): properties=cls.fileset_properties, ) + cls.multiple_locations_fileset_storage_location: str = ( + f"gs://{cls.bucket_name}/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}" + ) + cls.multiple_locations_fileset_storage_location1: str = ( + f"gs://{cls.bucket_name}/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}_1" + ) + cls.multiple_locations_fileset_gvfs_location = ( + f"gvfs://fileset/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}" + ) + catalog.as_fileset_catalog().create_multiple_location_fileset( + ident=cls.multiple_locations_fileset_ident, + fileset_type=Fileset.Type.MANAGED, + comment=cls.fileset_comment, + storage_locations={ + "default": cls.multiple_locations_fileset_storage_location, + "location1": cls.multiple_locations_fileset_storage_location1, + }, + properties={ + Fileset.PROPERTY_DEFAULT_LOCATION_NAME: "default", + **cls.fileset_properties, + }, + ) + cls.fs = GCSFileSystem(token=cls.key_file) def test_mkdir(self): diff --git a/clients/client-python/tests/integration/test_gvfs_with_hdfs.py b/clients/client-python/tests/integration/test_gvfs_with_hdfs.py index 5a63ff8cd1..9f79b10b1a 100644 --- a/clients/client-python/tests/integration/test_gvfs_with_hdfs.py +++ b/clients/client-python/tests/integration/test_gvfs_with_hdfs.py @@ -327,7 +327,8 @@ class TestGvfsWithHDFS(IntegrationTestEnv): server_uri="http://localhost:8090", metalake_name=self.metalake_name, options={ - f"{GVFSConfig.GVFS_FILESYSTEM_CURRENT_LOCATION_NAME}": "location1" + f"{GVFSConfig.GVFS_FILESYSTEM_CURRENT_LOCATION_NAME}": "location1", + **self.options, }, ) diff --git a/clients/client-python/tests/integration/test_gvfs_with_oss.py b/clients/client-python/tests/integration/test_gvfs_with_oss.py index 2fa9a3f062..6227a34418 100644 --- a/clients/client-python/tests/integration/test_gvfs_with_oss.py +++ b/clients/client-python/tests/integration/test_gvfs_with_oss.py @@ -151,6 +151,32 @@ class TestGvfsWithOSS(TestGvfsWithHDFS): properties=cls.fileset_properties, ) + cls.multiple_locations_fileset_storage_location: str = ( + f"oss://{cls.bucket_name}/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}" + ) + cls.multiple_locations_fileset_storage_location1: str = ( + f"oss://{cls.bucket_name}/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}_1" + ) + cls.multiple_locations_fileset_gvfs_location = ( + f"gvfs://fileset/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}" + ) + catalog.as_fileset_catalog().create_multiple_location_fileset( + ident=cls.multiple_locations_fileset_ident, + fileset_type=Fileset.Type.MANAGED, + comment=cls.fileset_comment, + storage_locations={ + "default": cls.multiple_locations_fileset_storage_location, + "location1": cls.multiple_locations_fileset_storage_location1, + }, + properties={ + Fileset.PROPERTY_DEFAULT_LOCATION_NAME: "default", + **cls.fileset_properties, + }, + ) + cls.fs = OSSFileSystem( key=cls.oss_access_key, secret=cls.oss_secret_key, diff --git a/clients/client-python/tests/integration/test_gvfs_with_oss_credential.py b/clients/client-python/tests/integration/test_gvfs_with_oss_credential.py index 0b7c90b430..14f005ad0a 100644 --- a/clients/client-python/tests/integration/test_gvfs_with_oss_credential.py +++ b/clients/client-python/tests/integration/test_gvfs_with_oss_credential.py @@ -115,6 +115,32 @@ class TestGvfsWithOSSCredential(TestGvfsWithOSS): properties=cls.fileset_properties, ) + cls.multiple_locations_fileset_storage_location: str = ( + f"oss://{cls.bucket_name}/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}" + ) + cls.multiple_locations_fileset_storage_location1: str = ( + f"oss://{cls.bucket_name}/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}_1" + ) + cls.multiple_locations_fileset_gvfs_location = ( + f"gvfs://fileset/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}" + ) + catalog.as_fileset_catalog().create_multiple_location_fileset( + ident=cls.multiple_locations_fileset_ident, + fileset_type=Fileset.Type.MANAGED, + comment=cls.fileset_comment, + storage_locations={ + "default": cls.multiple_locations_fileset_storage_location, + "location1": cls.multiple_locations_fileset_storage_location1, + }, + properties={ + Fileset.PROPERTY_DEFAULT_LOCATION_NAME: "default", + **cls.fileset_properties, + }, + ) + cls.fs = OSSFileSystem( key=cls.oss_access_key, secret=cls.oss_secret_key, diff --git a/clients/client-python/tests/integration/test_gvfs_with_s3.py b/clients/client-python/tests/integration/test_gvfs_with_s3.py index e23b4ccc48..20200234b6 100644 --- a/clients/client-python/tests/integration/test_gvfs_with_s3.py +++ b/clients/client-python/tests/integration/test_gvfs_with_s3.py @@ -149,6 +149,32 @@ class TestGvfsWithS3(TestGvfsWithHDFS): properties=cls.fileset_properties, ) + cls.multiple_locations_fileset_storage_location: str = ( + f"s3a://{cls.bucket_name}/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}" + ) + cls.multiple_locations_fileset_storage_location1: str = ( + f"s3a://{cls.bucket_name}/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}_1" + ) + cls.multiple_locations_fileset_gvfs_location = ( + f"gvfs://fileset/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}" + ) + catalog.as_fileset_catalog().create_multiple_location_fileset( + ident=cls.multiple_locations_fileset_ident, + fileset_type=Fileset.Type.MANAGED, + comment=cls.fileset_comment, + storage_locations={ + "default": cls.multiple_locations_fileset_storage_location, + "location1": cls.multiple_locations_fileset_storage_location1, + }, + properties={ + Fileset.PROPERTY_DEFAULT_LOCATION_NAME: "default", + **cls.fileset_properties, + }, + ) + cls.fs = S3FileSystem( key=cls.s3_access_key, secret=cls.s3_secret_key, diff --git a/clients/client-python/tests/integration/test_gvfs_with_s3_credential.py b/clients/client-python/tests/integration/test_gvfs_with_s3_credential.py index b90c782a10..2eb86ef8ad 100644 --- a/clients/client-python/tests/integration/test_gvfs_with_s3_credential.py +++ b/clients/client-python/tests/integration/test_gvfs_with_s3_credential.py @@ -112,6 +112,32 @@ class TestGvfsWithS3Credential(TestGvfsWithS3): properties=cls.fileset_properties, ) + cls.multiple_locations_fileset_storage_location: str = ( + f"s3a://{cls.bucket_name}/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}" + ) + cls.multiple_locations_fileset_storage_location1: str = ( + f"s3a://{cls.bucket_name}/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}_1" + ) + cls.multiple_locations_fileset_gvfs_location = ( + f"gvfs://fileset/{cls.catalog_name}/{cls.schema_name}/" + f"{cls.multiple_locations_fileset_name}" + ) + catalog.as_fileset_catalog().create_multiple_location_fileset( + ident=cls.multiple_locations_fileset_ident, + fileset_type=Fileset.Type.MANAGED, + comment=cls.fileset_comment, + storage_locations={ + "default": cls.multiple_locations_fileset_storage_location, + "location1": cls.multiple_locations_fileset_storage_location1, + }, + properties={ + Fileset.PROPERTY_DEFAULT_LOCATION_NAME: "default", + **cls.fileset_properties, + }, + ) + cls.fs = S3FileSystem( key=cls.s3_access_key, secret=cls.s3_secret_key, @@ -134,8 +160,7 @@ class TestGvfsWithS3Credential(TestGvfsWithS3): # it actually takes no effect. self.check_mkdir(mkdir_dir, mkdir_actual_dir, fs) - with self.assertRaises(ValueError): - fs.mkdir(mkdir_dir, create_parents=True) + fs.mkdir(mkdir_dir, create_parents=True) self.assertFalse(fs.exists(mkdir_dir)) def test_makedirs(self):