@@ -38,24 +38,28 @@ def test_Connector_init(credentials: FakeCredentials) -> None:
3838 Test to check whether the __init__ method of Connector
3939 properly sets default attributes.
4040 """
41+ print ("RISHABH DEBUG: started test" )
4142 connector = Connector (credentials )
4243 assert connector ._quota_project is None
4344 assert connector ._alloydb_api_endpoint == "alloydb.googleapis.com"
4445 assert connector ._client is None
4546 assert connector ._credentials == credentials
4647 assert connector ._closed is False
4748 connector .close ()
49+ print ("RISHABH DEBUG: completed test" )
4850
4951
5052def test_Connector_init_bad_ip_type (credentials : FakeCredentials ) -> None :
5153 """Test that Connector errors due to bad ip_type str."""
54+ print ("RISHABH DEBUG: started test" )
5255 bad_ip_type = "BAD-IP-TYPE"
5356 with pytest .raises (ValueError ) as exc_info :
5457 Connector (ip_type = bad_ip_type , credentials = credentials )
5558 assert (
5659 exc_info .value .args [0 ]
5760 == f"Incorrect value for ip_type, got '{ bad_ip_type } '. Want one of: 'PUBLIC', 'PRIVATE', 'PSC'."
5861 )
62+ print ("RISHABH DEBUG: completed test" )
5963
6064
6165@pytest .mark .parametrize (
@@ -106,9 +110,11 @@ def test_Connector_init_ip_type(
106110 Test to check whether the __init__ method of Connector
107111 properly sets ip_type.
108112 """
113+ print ("RISHABH DEBUG: started test" )
109114 connector = Connector (credentials = credentials , ip_type = ip_type )
110115 assert connector ._ip_type == expected
111116 connector .close ()
117+ print ("RISHABH DEBUG: completed test" )
112118
113119
114120def test_Connector_init_alloydb_api_endpoint_with_http_prefix (
@@ -118,11 +124,13 @@ def test_Connector_init_alloydb_api_endpoint_with_http_prefix(
118124 Test to check whether the __init__ method of Connector properly sets
119125 alloydb_api_endpoint when its URL has an 'http://' prefix.
120126 """
127+ print ("RISHABH DEBUG: started test" )
121128 connector = Connector (
122129 alloydb_api_endpoint = "http://alloydb.googleapis.com" , credentials = credentials
123130 )
124131 assert connector ._alloydb_api_endpoint == "alloydb.googleapis.com"
125132 connector .close ()
133+ print ("RISHABH DEBUG: completed test" )
126134
127135
128136def test_Connector_init_alloydb_api_endpoint_with_https_prefix (
@@ -132,30 +140,35 @@ def test_Connector_init_alloydb_api_endpoint_with_https_prefix(
132140 Test to check whether the __init__ method of Connector properly sets
133141 alloydb_api_endpoint when its URL has an 'https://' prefix.
134142 """
143+ print ("RISHABH DEBUG: started test" )
135144 connector = Connector (
136145 alloydb_api_endpoint = "https://alloydb.googleapis.com" , credentials = credentials
137146 )
138147 assert connector ._alloydb_api_endpoint == "alloydb.googleapis.com"
139148 connector .close ()
149+ print ("RISHABH DEBUG: completed test" )
140150
141151
142152def test_Connector_context_manager (credentials : FakeCredentials ) -> None :
143153 """
144154 Test to check whether the __init__ method of Connector
145155 properly sets defaults as context manager.
146156 """
157+ print ("RISHABH DEBUG: started test" )
147158 with Connector (credentials ) as connector :
148159 assert connector ._quota_project is None
149160 assert connector ._alloydb_api_endpoint == "alloydb.googleapis.com"
150161 assert connector ._client is None
151162 assert connector ._credentials == credentials
163+ print ("RISHABH DEBUG: completed test" )
152164
153165
154166def test_Connector_close (credentials : FakeCredentials ) -> None :
155167 """
156168 Test that Connector's close method stops event loop and
157169 background thread, and sets the connector as closed.
158170 """
171+ print ("RISHABH DEBUG: started test" )
159172 with Connector (credentials ) as connector :
160173 loop : asyncio .AbstractEventLoop = connector ._loop
161174 thread : Thread = connector ._thread
@@ -165,13 +178,15 @@ def test_Connector_close(credentials: FakeCredentials) -> None:
165178 assert loop .is_running () is False
166179 assert thread .is_alive () is False
167180 assert connector ._closed is True
181+ print ("RISHABH DEBUG: completed test" )
168182
169183
170184@pytest .mark .usefixtures ("proxy_server" )
171185def test_connect (credentials : FakeCredentials , fake_client : FakeAlloyDBClient ) -> None :
172186 """
173187 Test that connector.connect returns connection object.
174188 """
189+ print ("RISHABH DEBUG: started test" )
175190 client = fake_client
176191 with Connector (credentials ) as connector :
177192 connector ._client = client
@@ -187,12 +202,14 @@ def test_connect(credentials: FakeCredentials, fake_client: FakeAlloyDBClient) -
187202 )
188203 # check connection is returned
189204 assert connection is True
205+ print ("RISHABH DEBUG: completed test" )
190206
191207
192208def test_connect_bad_ip_type (
193209 credentials : FakeCredentials , fake_client : FakeAlloyDBClient
194210) -> None :
195211 """Test that Connector.connect errors due to bad ip_type str."""
212+ print ("RISHABH DEBUG: started test" )
196213 with Connector (credentials = credentials ) as connector :
197214 connector ._client = fake_client
198215 bad_ip_type = "BAD-IP-TYPE"
@@ -209,12 +226,14 @@ def test_connect_bad_ip_type(
209226 exc_info .value .args [0 ]
210227 == f"Incorrect value for ip_type, got '{ bad_ip_type } '. Want one of: 'PUBLIC', 'PRIVATE', 'PSC'."
211228 )
229+ print ("RISHABH DEBUG: completed test" )
212230
213231
214232def test_connect_unsupported_driver (credentials : FakeCredentials ) -> None :
215233 """
216234 Test that connector.connect errors with unsupported database driver.
217235 """
236+ print ("RISHABH DEBUG: started test" )
218237 client = FakeAlloyDBClient ()
219238 with Connector (credentials ) as connector :
220239 connector ._client = client
@@ -229,10 +248,12 @@ def test_connect_unsupported_driver(credentials: FakeCredentials) -> None:
229248 exc_info .value .args [0 ]
230249 == "Driver 'bad_driver' is not a supported database driver."
231250 )
251+ print ("RISHABH DEBUG: completed test" )
232252
233253
234254def test_Connector_close_called_multiple_times (credentials : FakeCredentials ) -> None :
235255 """Test that Connector.close can be called multiple times."""
256+ print ("RISHABH DEBUG: started test" )
236257 # open and close Connector object
237258 connector = Connector (credentials = credentials )
238259 # verify background thread exists
@@ -242,6 +263,7 @@ def test_Connector_close_called_multiple_times(credentials: FakeCredentials) ->
242263 assert connector ._thread .is_alive () is False
243264 # call connector.close a second time
244265 connector .close ()
266+ print ("RISHABH DEBUG: completed test" )
245267
246268
247269def test_Connector_remove_cached_bad_instance (
@@ -252,6 +274,7 @@ def test_Connector_remove_cached_bad_instance(
252274 the cache and ensure no background refresh happens (which would be
253275 wasted cycles).
254276 """
277+ print ("RISHABH DEBUG: started test" )
255278 instance_uri = "projects/test-project/locations/test-region/clusters/test-cluster/instances/bad-test-instance"
256279 with Connector (credentials ) as connector :
257280 # The timeout of AlloyDB API methods is set to 60s by default.
@@ -270,13 +293,15 @@ def test_Connector_remove_cached_bad_instance(
270293 with pytest .raises (RetryError ):
271294 connector .connect (instance_uri , "pg8000" )
272295 assert instance_uri not in connector ._cache
296+ print ("RISHABH DEBUG: completed test" )
273297
274298
275299async def test_Connector_remove_cached_no_ip_type (credentials : FakeCredentials ) -> None :
276300 """When a Connector attempts to connect and preferred IP type is not present,
277301 it should delete the instance from the cache and ensure no background refresh
278302 happens (which would be wasted cycles).
279303 """
304+ print ("RISHABH DEBUG: started test" )
280305 instance_uri = "projects/test-project/locations/test-region/clusters/test-cluster/instances/test-instance"
281306 # set instance to only have Public IP
282307 fake_client = FakeAlloyDBClient ()
@@ -296,6 +321,7 @@ async def test_Connector_remove_cached_no_ip_type(credentials: FakeCredentials)
296321 await connector .connect_async (instance_uri , "pg8000" , ip_type = "private" )
297322 # check that cache has been removed from dict
298323 assert instance_uri not in connector ._cache
324+ print ("RISHABH DEBUG: completed test" )
299325
300326
301327@pytest .mark .usefixtures ("proxy_server" )
@@ -306,6 +332,7 @@ def test_Connector_static_connection_info(
306332 Test that Connector.__init__() can specify a static connection info to
307333 connect to an instance.
308334 """
335+ print ("RISHABH DEBUG: started test" )
309336 static_info = write_static_info (fake_client .instance )
310337 with Connector (credentials = credentials , static_conn_info = static_info ) as connector :
311338 connector ._client = fake_client
@@ -321,12 +348,14 @@ def test_Connector_static_connection_info(
321348 )
322349 # check connection is returned
323350 assert connection is True
351+ print ("RISHABH DEBUG: completed test" )
324352
325353
326354def test_connect_when_closed (credentials : FakeCredentials ) -> None :
327355 """
328356 Test that connector.connect errors when the connection is closed.
329357 """
358+ print ("RISHABH DEBUG: started test" )
330359 connector = Connector (credentials = credentials )
331360 connector .close ()
332361 with pytest .raises (ClosedConnectorError ) as exc_info :
@@ -335,3 +364,4 @@ def test_connect_when_closed(credentials: FakeCredentials) -> None:
335364 exc_info .value .args [0 ]
336365 == "Connection attempt failed because the connector has already been closed."
337366 )
367+ print ("RISHABH DEBUG: completed test" )
0 commit comments