mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 16:02:10 +00:00
feat: S3 objects are now typed in Python and TS SDK (#2878)
* feat: S3 objects are now typed in Python and TS SDK * fix ts and python SDK after testing * cleanup
This commit is contained in:
committed by
GitHub
parent
ba036e0576
commit
fd55c3d8e3
@@ -15,17 +15,6 @@ class TestStringMethods(unittest.TestCase):
|
||||
os.environ["BASE_INTERNAL_URL"] = self._host
|
||||
|
||||
def test_duckdb_connection_settings(self):
|
||||
s3_resource = {
|
||||
"port": 9000,
|
||||
"bucket": "windmill",
|
||||
"region": "fr-paris",
|
||||
"useSSL": False,
|
||||
"endPoint": "localhost:9000",
|
||||
"accessKey": "ACCESS_KEY",
|
||||
"pathStyle": True,
|
||||
"secretKey": "SECRET_KEY",
|
||||
}
|
||||
|
||||
settings = wmill.duckdb_connection_settings(self._resource_path)
|
||||
self.assertIsNotNone(settings)
|
||||
|
||||
@@ -38,31 +27,36 @@ SET s3_use_ssl=0;
|
||||
SET s3_access_key_id='IeuKPSYLKTO2h9CWfCVR';
|
||||
SET s3_secret_access_key='80yMndIMcyXwEujxVNINQbf0tBlIzRaLPyM2m1n4';
|
||||
"""
|
||||
self.assertEqual(settings, {"connection_settings_str": expected_settings_str})
|
||||
|
||||
self.assertEqual(settings["connection_settings_str"], expected_settings_str)
|
||||
self.assertEqual(settings.connection_settings_str, expected_settings_str)
|
||||
|
||||
settings = wmill.polars_connection_settings(self._resource_path)
|
||||
print(settings)
|
||||
|
||||
def test_polars_connection_settings(self):
|
||||
settings = wmill.polars_connection_settings(self._resource_path)
|
||||
expected_settings = {
|
||||
"s3fs_args": {
|
||||
"endpoint_url": "http://localhost:9000",
|
||||
"key": "IeuKPSYLKTO2h9CWfCVR",
|
||||
"secret": "80yMndIMcyXwEujxVNINQbf0tBlIzRaLPyM2m1n4",
|
||||
"use_ssl": False,
|
||||
"cache_regions": False,
|
||||
"client_kwargs": {"region_name": "fr-paris"},
|
||||
},
|
||||
"polars_cloud_options": {
|
||||
"aws_endpoint_url": "http://localhost:9000",
|
||||
"aws_access_key_id": "IeuKPSYLKTO2h9CWfCVR",
|
||||
"aws_secret_access_key": "80yMndIMcyXwEujxVNINQbf0tBlIzRaLPyM2m1n4",
|
||||
"aws_region": "fr-paris",
|
||||
"aws_allow_http": True,
|
||||
},
|
||||
s3fs_args_expected = {
|
||||
"endpoint_url": "http://localhost:9000",
|
||||
"key": "IeuKPSYLKTO2h9CWfCVR",
|
||||
"secret": "80yMndIMcyXwEujxVNINQbf0tBlIzRaLPyM2m1n4",
|
||||
"use_ssl": False,
|
||||
"cache_regions": False,
|
||||
"client_kwargs": {"region_name": "fr-paris"},
|
||||
}
|
||||
self.assertEqual(settings, expected_settings)
|
||||
polars_cloud_options_expected = {
|
||||
"aws_endpoint_url": "http://localhost:9000",
|
||||
"aws_access_key_id": "IeuKPSYLKTO2h9CWfCVR",
|
||||
"aws_secret_access_key": "80yMndIMcyXwEujxVNINQbf0tBlIzRaLPyM2m1n4",
|
||||
"aws_region": "fr-paris",
|
||||
"aws_allow_http": True,
|
||||
}
|
||||
self.assertEqual(settings["s3fs_args"], s3fs_args_expected)
|
||||
self.assertEqual(settings.s3fs_args, s3fs_args_expected)
|
||||
self.assertEqual(
|
||||
settings["polars_cloud_options"], polars_cloud_options_expected
|
||||
)
|
||||
self.assertEqual(settings.polars_cloud_options, polars_cloud_options_expected)
|
||||
|
||||
def test_boto3_connection_settings(self):
|
||||
settings = wmill.boto3_connection_settings(self._resource_path)
|
||||
@@ -74,6 +68,8 @@ SET s3_secret_access_key='80yMndIMcyXwEujxVNINQbf0tBlIzRaLPyM2m1n4';
|
||||
"aws_secret_access_key": "80yMndIMcyXwEujxVNINQbf0tBlIzRaLPyM2m1n4",
|
||||
}
|
||||
self.assertEqual(settings, expected_settings)
|
||||
self.assertEqual(settings["endpoint_url"], "http://localhost:9000")
|
||||
self.assertEqual(settings.endpoint_url, "http://localhost:9000")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user