@@ -48,7 +48,9 @@ def integration_env() -> Dict[str, str]:
4848 missing_vars .append (var )
4949
5050 if missing_vars :
51- pytest .skip (f"Missing required environment variables for cloud integration tests: { missing_vars } " )
51+ pytest .skip (
52+ f"Missing required environment variables for cloud integration tests: { missing_vars } "
53+ )
5254
5355 # Ensure SSL is enabled for cloud services
5456 env_vars ["CLOUD_SDK_CFG_OBJECTSTORE_DEFAULT_SSL_ENABLED" ] = os .getenv (
@@ -66,19 +68,17 @@ def integration_env() -> Dict[str, str]:
6668
6769@pytest .fixture (scope = "session" )
6870def objectstore_client (integration_env ):
69- """Create an ObjectStore client for cloud testing using explicit configuration ."""
71+ """Create an ObjectStore client via ConfigFactory (reads CLOUD_SDK_CFG_* env vars) ."""
7072 try :
71- config = ObjectStoreBindingData (
72- host = integration_env ["CLOUD_SDK_CFG_OBJECTSTORE_DEFAULT_HOST" ],
73- access_key_id = integration_env ["CLOUD_SDK_CFG_OBJECTSTORE_DEFAULT_ACCESS_KEY_ID" ],
74- secret_access_key = integration_env ["CLOUD_SDK_CFG_OBJECTSTORE_DEFAULT_SECRET_ACCESS_KEY" ],
75- bucket = integration_env ["CLOUD_SDK_CFG_OBJECTSTORE_DEFAULT_BUCKET" ],
76- )
77- disable_ssl = integration_env .get ("CLOUD_SDK_CFG_OBJECTSTORE_DEFAULT_SSL_ENABLED" , "true" ).lower () in ("false" , "0" )
78- client = create_client ("default" , config = config , disable_ssl = disable_ssl )
73+ disable_ssl = integration_env .get (
74+ "CLOUD_SDK_CFG_OBJECTSTORE_DEFAULT_SSL_ENABLED" , "true"
75+ ).lower () in ("false" , "0" )
76+ client = create_client ("default" , disable_ssl = disable_ssl )
7977 return client
8078 except Exception as e :
81- pytest .fail (f"Failed to create ObjectStore client for cloud integration tests: { e } " )
79+ pytest .fail (
80+ f"Failed to create ObjectStore client for cloud integration tests: { e } "
81+ )
8282
8383
8484@pytest .fixture
@@ -89,6 +89,7 @@ def test_prefix() -> str:
8989
9090# ===== CLEANUP INFRASTRUCTURE =====
9191
92+
9293def cleanup_by_prefix (client , prefix : str , timeout : float = 10.0 ) -> bool :
9394 """Timeout-controlled cleanup with eventual consistency handling."""
9495 start_time = time .time ()
@@ -103,7 +104,9 @@ def cleanup_by_prefix(client, prefix: str, timeout: float = 10.0) -> bool:
103104
104105 # Check timeout
105106 if time .time () - start_time > timeout :
106- logger .warning (f"Cleanup timeout reached after { timeout } s, cleaned { cleaned_count } objects" )
107+ logger .warning (
108+ f"Cleanup timeout reached after { timeout } s, cleaned { cleaned_count } objects"
109+ )
107110 break
108111
109112 if cleaned_count > 0 :
@@ -126,8 +129,12 @@ def cleanup_all_test_objects():
126129 try :
127130 objects = objectstore_client .list_objects ("sdk-python-integration-tests/" )
128131 if objects :
129- logger .info (f"Found { len (objects )} leftover integration test objects, cleaning up..." )
130- cleanup_by_prefix (objectstore_client , "sdk-python-integration-tests/" , timeout = 30.0 )
132+ logger .info (
133+ f"Found { len (objects )} leftover integration test objects, cleaning up..."
134+ )
135+ cleanup_by_prefix (
136+ objectstore_client , "sdk-python-integration-tests/" , timeout = 30.0
137+ )
131138 logger .info ("Session cleanup completed" )
132139 except Exception as e :
133140 logger .warning (f"Session cleanup failed: { e } " )
@@ -166,7 +173,9 @@ def register_object(object_name: str):
166173
167174 # Respect timeout
168175 if time .time () - start_time > 10.0 :
169- logger .warning (f"Object cleanup timeout reached, cleaned { cleaned_count } /{ len (created_objects )} objects" )
176+ logger .warning (
177+ f"Object cleanup timeout reached, cleaned { cleaned_count } /{ len (created_objects )} objects"
178+ )
170179 break
171180
172181 except Exception as e :
@@ -182,11 +191,17 @@ def failure_simulation(integration_env):
182191 """Utilities for simulating various failure conditions using explicit configuration."""
183192 base_config = ObjectStoreBindingData (
184193 host = integration_env ["CLOUD_SDK_CFG_OBJECTSTORE_DEFAULT_HOST" ],
185- access_key_id = integration_env ["CLOUD_SDK_CFG_OBJECTSTORE_DEFAULT_ACCESS_KEY_ID" ],
186- secret_access_key = integration_env ["CLOUD_SDK_CFG_OBJECTSTORE_DEFAULT_SECRET_ACCESS_KEY" ],
194+ access_key_id = integration_env [
195+ "CLOUD_SDK_CFG_OBJECTSTORE_DEFAULT_ACCESS_KEY_ID"
196+ ],
197+ secret_access_key = integration_env [
198+ "CLOUD_SDK_CFG_OBJECTSTORE_DEFAULT_SECRET_ACCESS_KEY"
199+ ],
187200 bucket = integration_env ["CLOUD_SDK_CFG_OBJECTSTORE_DEFAULT_BUCKET" ],
188201 )
189- disable_ssl = integration_env .get ("CLOUD_SDK_CFG_OBJECTSTORE_DEFAULT_SSL_ENABLED" , "true" ).lower () in ("false" , "0" )
202+ disable_ssl = integration_env .get (
203+ "CLOUD_SDK_CFG_OBJECTSTORE_DEFAULT_SSL_ENABLED" , "true"
204+ ).lower () in ("false" , "0" )
190205
191206 class FailureSimulator :
192207 def create_client_with_network_failure (self ):
@@ -219,10 +234,7 @@ def setup_intermittent_failure(self):
219234# Configure pytest markers for integration tests
220235def pytest_configure (config ):
221236 """Configure pytest markers."""
222- config .addinivalue_line (
223- "markers" ,
224- "integration: mark test as integration test"
225- )
237+ config .addinivalue_line ("markers" , "integration: mark test as integration test" )
226238
227239
228240def pytest_collection_modifyitems (config , items ):
0 commit comments