You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by js...@apache.org on 2025/06/30 02:51:13 UTC

(gravitino) branch branch-0.9 updated: [#7432] fix(client-python): Fix test error in TestGvfsWithS3 with credential (#7499)

This is an automated email from the ASF dual-hosted git repository.

jshao pushed a commit to branch branch-0.9
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/branch-0.9 by this push:
     new d1e69cd67b [#7432] fix(client-python): Fix test error in TestGvfsWithS3 with credential (#7499)
d1e69cd67b is described below

commit d1e69cd67b4769852f43b82eea3a588157641d85
Author: github-actions[bot] <41...@users.noreply.github.com>
AuthorDate: Mon Jun 30 10:51:10 2025 +0800

    [#7432] fix(client-python): Fix test error in TestGvfsWithS3 with credential (#7499)
    
    ### 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"
    />
    
    Co-authored-by: Mini Yu <yu...@datastrato.com>
---
 .../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 53c265c539..b155b903cc 100644
--- a/clients/client-python/tests/integration/test_gvfs_with_abs.py
+++ b/clients/client-python/tests/integration/test_gvfs_with_abs.py
@@ -146,6 +146,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 a2fc0d2868..f7c68c664b 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 40e83d0081..f532599e4e 100644
--- a/clients/client-python/tests/integration/test_gvfs_with_gcs.py
+++ b/clients/client-python/tests/integration/test_gvfs_with_gcs.py
@@ -139,6 +139,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 00c0237ead..347d4b1e03 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 f07a2e0328..4a5f049544 100644
--- a/clients/client-python/tests/integration/test_gvfs_with_hdfs.py
+++ b/clients/client-python/tests/integration/test_gvfs_with_hdfs.py
@@ -326,7 +326,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 97219a8414..c9b7aeffce 100644
--- a/clients/client-python/tests/integration/test_gvfs_with_oss.py
+++ b/clients/client-python/tests/integration/test_gvfs_with_oss.py
@@ -149,6 +149,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 18a3eec152..4fd9b36d16 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 fadcf352d4..73b977fe4d 100644
--- a/clients/client-python/tests/integration/test_gvfs_with_s3.py
+++ b/clients/client-python/tests/integration/test_gvfs_with_s3.py
@@ -147,6 +147,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 5ee41fb5c0..2fe348ca33 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):