@@ -976,13 +976,63 @@ mod tests {
976976        . await ; 
977977    } 
978978
979+     #[ tokio:: test]  
979980    async  fn  get_status_page_data ( )  { 
980981        run_postgres_test ( |ctx| async  { 
981982            let  db = ctx. db_client ( ) . connection ( ) . await ; 
982-             db. add_collector_config ( "collector-1" ,  & Target :: X86_64UnknownLinuxGnu ,  1 ,  true ) 
983+             let  benchmark_set = BenchmarkSet ( 0u32 ) ; 
984+             let  time = chrono:: DateTime :: from_str ( "2021-09-01T00:00:00.000Z" ) . unwrap ( ) ; 
985+             let  tag = "sha-1" ; 
986+             let  collector_name = "collector-1" ; 
987+             let  target = Target :: X86_64UnknownLinuxGnu ; 
988+ 
989+             db. add_collector_config ( collector_name,  & target,  benchmark_set. 0 ,  true ) 
990+                 . await 
991+                 . unwrap ( ) ; 
992+ 
993+             let  benchmark_request = BenchmarkRequest :: create_release ( tag,  time) ; 
994+             db. insert_benchmark_request ( & benchmark_request) 
995+                 . await 
996+                 . unwrap ( ) ; 
997+ 
998+             /* Create job for the request */ 
999+             db. enqueue_benchmark_job ( 
1000+                 benchmark_request. tag ( ) . unwrap ( ) , 
1001+                 & target, 
1002+                 & CodegenBackend :: Llvm , 
1003+                 & Profile :: Opt , 
1004+                 benchmark_set. 0 , 
1005+             ) 
1006+             . await 
1007+             . unwrap ( ) ; 
1008+ 
1009+             let  job = db
1010+                 . dequeue_benchmark_job ( collector_name,  & target,  & benchmark_set) 
1011+                 . await 
1012+                 . unwrap ( ) 
1013+                 . unwrap ( ) ; 
1014+ 
1015+             assert_eq ! ( job. request_tag( ) ,  benchmark_request. tag( ) . unwrap( ) ) ; 
1016+ 
1017+             /* Mark the job as complete */ 
1018+             db. mark_benchmark_job_as_completed ( job. id ( ) ,  & BenchmarkJobConclusion :: Success ) 
9831019                . await 
9841020                . unwrap ( ) ; 
9851021
1022+             // record a couple of errors against the tag 
1023+             let  artifact_id = db. artifact_id ( & ArtifactId :: Tag ( tag. to_string ( ) ) ) . await ; 
1024+ 
1025+             db. record_error ( artifact_id,  "example-1" ,  "This is an error" ) 
1026+                 . await ; 
1027+             db. record_error ( artifact_id,  "example-2" ,  "This is another error" ) 
1028+                 . await ; 
1029+ 
1030+             db. mark_benchmark_request_as_completed ( tag) . await . unwrap ( ) ; 
1031+ 
1032+             let  status_page_data = db. get_status_page_data ( ) . await . unwrap ( ) ; 
1033+ 
1034+             dbg ! ( "{:?}" ,  status_page_data) ; 
1035+ 
9861036            Ok ( ctx) 
9871037        } ) 
9881038        . await ; 
0 commit comments