@@ -183,7 +183,7 @@ async fn test_files() {
183183 let req_str = format ! ( "/{}?x=1" , test_file_path_string) ;
184184 let resp = req_path_with_app_data ( & req_str, app_data. clone ( ) )
185185 . await
186- . unwrap_or_else ( |_ | panic ! ( "Failed to get response for {req_str}" ) ) ;
186+ . unwrap_or_else ( |e | panic ! ( "Failed to get response for {req_str}: {e }" ) ) ;
187187 let body = test:: read_body ( resp) . await ;
188188 assert ! (
189189 body. starts_with( b"<!DOCTYPE html>" ) ,
@@ -607,7 +607,7 @@ async fn test_official_website_documentation() {
607607 let app_data = make_app_data_for_official_website ( ) . await ;
608608 let resp = req_path_with_app_data ( "/component.sql?component=button" , app_data)
609609 . await
610- . unwrap ( ) ;
610+ . unwrap_or_else ( |e| panic ! ( "Failed to get response for /component.sql?component=button: {e}" ) ) ;
611611 assert_eq ! ( resp. status( ) , http:: StatusCode :: OK ) ;
612612 let body = test:: read_body ( resp) . await ;
613613 let body_str = String :: from_utf8 ( body. to_vec ( ) ) . unwrap ( ) ;
@@ -681,12 +681,18 @@ async fn srv_req_path_with_app_data(
681681 . to_srv_request ( )
682682}
683683
684+ const REQ_TIMEOUT : std:: time:: Duration = std:: time:: Duration :: from_secs ( 3 ) ;
684685async fn req_path_with_app_data (
685686 path : impl AsRef < str > ,
686687 app_data : actix_web:: web:: Data < AppState > ,
687- ) -> Result < actix_web:: dev:: ServiceResponse , actix_web:: Error > {
688+ ) -> anyhow:: Result < actix_web:: dev:: ServiceResponse > {
689+ let path = path. as_ref ( ) ;
688690 let req = srv_req_path_with_app_data ( path, app_data) . await ;
689- main_handler ( req) . await
691+ let resp = tokio:: time:: timeout ( REQ_TIMEOUT , main_handler ( req) )
692+ . await
693+ . map_err ( |e| anyhow:: anyhow!( "Request to {path} timed out: {e}" ) ) ?
694+ . map_err ( |e| anyhow:: anyhow!( "Request to {path} failed: {e}" ) ) ?;
695+ Ok ( resp)
690696}
691697
692698pub fn test_config ( ) -> AppConfig {
0 commit comments