@@ -625,113 +625,6 @@ mod tests {
625625 Ok ( ( ) )
626626 }
627627
628- #[ actix_web:: test]
629- async fn test_concurrent_downloads ( ) -> Result < ( ) > {
630- use std:: rc:: Rc ;
631-
632- // Initialize the app
633- let path = TmpDir :: new ( "test_concurrent_downloads" ) . await ?;
634-
635- BACKEND . get_or_init ( || init_backend ( path. to_path_buf ( ) . as_path ( ) ) ) ;
636- {
637- let backend = get_backend ( ) . await ?;
638- backend. start ( ) . await . expect ( "Backend failed to start" ) ;
639- }
640-
641- let app = Rc :: new (
642- test:: init_service (
643- App :: new ( )
644- . service ( status)
645- . service ( web:: scope ( "/api" ) . service ( groups:: scope ( ) ) ) ,
646- )
647- . await
648- ) ;
649-
650- // Step 1: Create a group
651- let create_group_req = test:: TestRequest :: post ( )
652- . uri ( "/api/groups" )
653- . set_json ( json ! ( { "name" : "Test Group" } ) )
654- . to_request ( ) ;
655- let create_group_resp: serde_json:: Value =
656- test:: call_and_read_body_json ( & app, create_group_req) . await ;
657- let group_id = create_group_resp[ "key" ]
658- . as_str ( )
659- . expect ( "No group key returned" ) ;
660-
661- // Step 2: Create a repo
662- let create_repo_req = test:: TestRequest :: post ( )
663- . uri ( & format ! ( "/api/groups/{}/repos" , group_id) )
664- . set_json ( json ! ( { "name" : "Test Repo" } ) )
665- . to_request ( ) ;
666- let create_repo_resp: serde_json:: Value =
667- test:: call_and_read_body_json ( & app, create_repo_req) . await ;
668- let repo_id = create_repo_resp[ "key" ]
669- . as_str ( )
670- . expect ( "No repo key returned" ) ;
671-
672- // Step 3: Upload multiple files
673- let file_contents = vec ! [
674- ( "file1.txt" , b"Content for file 1" ) ,
675- ( "file2.txt" , b"Content for file 2" ) ,
676- ( "file3.txt" , b"Content for file 3" ) ,
677- ] ;
678-
679- for ( file_name, content) in & file_contents {
680- let upload_req = test:: TestRequest :: post ( )
681- . uri ( & format ! (
682- "/api/groups/{}/repos/{}/media/{}" ,
683- group_id, repo_id, file_name
684- ) )
685- . set_payload ( content. to_vec ( ) )
686- . to_request ( ) ;
687- let upload_resp = test:: call_service ( & app, upload_req) . await ;
688- assert ! ( upload_resp. status( ) . is_success( ) , "File upload failed for {}" , file_name) ;
689- }
690-
691- // Step 4: Create download requests
692- let mut download_futures = Vec :: new ( ) ;
693-
694- for ( file_name, content) in & file_contents {
695- let get_file_req = test:: TestRequest :: get ( )
696- . uri ( & format ! (
697- "/api/groups/{}/repos/{}/media/{}" ,
698- group_id, repo_id, file_name
699- ) )
700- . to_request ( ) ;
701-
702- let content = content. to_vec ( ) ;
703- let file_name = file_name. to_string ( ) ;
704- let app = Rc :: clone ( & app) ;
705-
706- // Create a future for each download
707- let download_future = async move {
708- let resp = test:: call_service ( & app, get_file_req) . await ;
709- assert ! ( resp. status( ) . is_success( ) , "File download failed for {}" , file_name) ;
710-
711- let got_file_data = test:: read_body ( resp) . await ;
712- assert_eq ! (
713- got_file_data. to_vec( ) . as_slice( ) ,
714- content. as_slice( ) ,
715- "Downloaded content mismatch for {}" ,
716- file_name
717- ) ;
718- } ;
719-
720- download_futures. push ( download_future) ;
721- }
722-
723- // Execute all downloads concurrently
724- futures:: future:: join_all ( download_futures) . await ;
725-
726- // Clean up: Stop the backend
727- {
728- let backend = get_backend ( ) . await ?;
729- backend. stop ( ) . await . expect ( "Backend failed to stop" ) ;
730- }
731-
732- Ok ( ( ) )
733- }
734-
735628 #[ actix_web:: test]
736629 async fn test_repo_permissions ( ) -> Result < ( ) > {
737630 // Initialize the app
0 commit comments