Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#7432] fix(client-python): Fix test error in TestGvfsWithS3 with credential (#7461)

Mini Yufaaa078f15fd
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):