@@ -752,39 +752,20 @@ def test_authentication_fail_retry(monkeypatch):
752752 assert post_retry .retry_count == attempts
753753
754754
755- def test_503_error_retry (monkeypatch ):
756- http_resp = TrinoRequest .http .Response ()
757- http_resp .status_code = 503
758-
759- post_retry = RetryRecorder (result = http_resp )
760- monkeypatch .setattr (TrinoRequest .http .Session , "post" , post_retry )
761-
762- get_retry = RetryRecorder (result = http_resp )
763- monkeypatch .setattr (TrinoRequest .http .Session , "get" , get_retry )
764-
765- attempts = 3
766- req = TrinoRequest (
767- host = "coordinator" , port = 8080 , user = "test" , max_attempts = attempts
768- )
769-
770- req .post ("URL" )
771- assert post_retry .retry_count == attempts
772-
773- req .get ("URL" )
774- assert post_retry .retry_count == attempts
775-
776-
777- def test_504_error_retry (monkeypatch ):
755+ @pytest .mark .parametrize ("status_code, attempts" , [
756+ (503 , 3 ),
757+ (504 , 3 ),
758+ ])
759+ def test_5XX_error_retry (status_code , attempts , monkeypatch ):
778760 http_resp = TrinoRequest .http .Response ()
779- http_resp .status_code = 504
761+ http_resp .status_code = status_code
780762
781763 post_retry = RetryRecorder (result = http_resp )
782764 monkeypatch .setattr (TrinoRequest .http .Session , "post" , post_retry )
783765
784766 get_retry = RetryRecorder (result = http_resp )
785767 monkeypatch .setattr (TrinoRequest .http .Session , "get" , get_retry )
786768
787- attempts = 3
788769 req = TrinoRequest (
789770 host = "coordinator" , port = 8080 , user = "test" , max_attempts = attempts
790771 )
0 commit comments