@@ -752,39 +752,20 @@ def test_authentication_fail_retry(monkeypatch):
752
752
assert post_retry .retry_count == attempts
753
753
754
754
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 ):
778
760
http_resp = TrinoRequest .http .Response ()
779
- http_resp .status_code = 504
761
+ http_resp .status_code = status_code
780
762
781
763
post_retry = RetryRecorder (result = http_resp )
782
764
monkeypatch .setattr (TrinoRequest .http .Session , "post" , post_retry )
783
765
784
766
get_retry = RetryRecorder (result = http_resp )
785
767
monkeypatch .setattr (TrinoRequest .http .Session , "get" , get_retry )
786
768
787
- attempts = 3
788
769
req = TrinoRequest (
789
770
host = "coordinator" , port = 8080 , user = "test" , max_attempts = attempts
790
771
)
0 commit comments