11use crate :: {
22 RateLimitReached ,
33 config:: Config ,
4- retry:: NoRateLimitRetryStrategy ,
4+ retry:: RepositoryForgeRetryStrategy ,
55 updater:: { FetchRepositoriesResult , Repository , RepositoryForge , RepositoryName } ,
66} ;
77use anyhow:: { Result , anyhow, bail} ;
@@ -84,7 +84,7 @@ impl GitHub {
8484 )
8585 . with ( RetryTransientMiddleware :: new_with_policy_and_strategy (
8686 ExponentialBackoff :: builder ( ) . build_with_max_retries ( config. github_api_retries ) ,
87- NoRateLimitRetryStrategy ,
87+ RepositoryForgeRetryStrategy ,
8888 ) )
8989 . build ( ) ;
9090
@@ -309,6 +309,7 @@ mod tests {
309309 use anyhow:: Result ;
310310 use docs_rs_config:: AppConfig as _;
311311 use reqwest:: header:: AUTHORIZATION ;
312+ use test_case:: test_case;
312313
313314 const TEST_TOKEN : & str = "qsjdnfqdq" ;
314315
@@ -426,7 +427,9 @@ mod tests {
426427 }
427428
428429 #[ tokio:: test]
429- async fn retries_server_errors ( ) -> Result < ( ) > {
430+ #[ test_case( 499 ) ]
431+ #[ test_case( 500 ) ]
432+ async fn retries_server_errors ( status_code : usize ) -> Result < ( ) > {
430433 const RETRIES : u32 = 2 ;
431434
432435 let mut config = github_config ( ) ?;
@@ -436,7 +439,7 @@ mod tests {
436439 let mock = server
437440 . mock ( "POST" , "/graphql" )
438441 . with_header ( "content-type" , "application/json" )
439- . with_status ( 500 )
442+ . with_status ( status_code )
440443 . expect ( ( RETRIES + 1 ) as usize )
441444 . create ( ) ;
442445
@@ -447,7 +450,7 @@ mod tests {
447450 . await
448451 . unwrap_err ( ) ;
449452
450- assert ! ( err. to_string( ) . contains( "500 Internal Server Error" ) ) ;
453+ assert ! ( err. to_string( ) . contains( & status_code . to_string ( ) ) ) ;
451454 mock. assert ( ) ;
452455
453456 Ok ( ( ) )
0 commit comments