@@ -251,12 +251,14 @@ pub trait Connection: Send + Sync {
251251 ) -> anyhow:: Result < Option < CollectorConfig > > ;
252252
253253 /// Dequeues a single job for the given collector, target and benchmark set.
254+ /// Also returns detailed information about the compiler artifact that should be benchmarked
255+ /// in the job.
254256 async fn dequeue_benchmark_job (
255257 & self ,
256258 collector_name : & str ,
257259 target : Target ,
258260 benchmark_set : BenchmarkSet ,
259- ) -> anyhow:: Result < Option < BenchmarkJob > > ;
261+ ) -> anyhow:: Result < Option < ( BenchmarkJob , ArtifactId ) > > ;
260262
261263 /// Try and mark the benchmark_request as completed. Will return `true` if
262264 /// it has been marked as completed else `false` meaning there was no change
@@ -839,12 +841,10 @@ mod tests {
839841 let db = ctx. db_client ( ) . connection ( ) . await ;
840842 let time = chrono:: DateTime :: from_str ( "2021-09-01T00:00:00.000Z" ) . unwrap ( ) ;
841843
842- let insert_result = db
844+ let collector_config = db
843845 . add_collector_config ( "collector-1" , Target :: X86_64UnknownLinuxGnu , 1 , true )
844- . await ;
845- assert ! ( insert_result. is_ok( ) ) ;
846-
847- let collector_config = insert_result. unwrap ( ) ;
846+ . await
847+ . unwrap ( ) ;
848848
849849 let benchmark_request =
850850 BenchmarkRequest :: create_master ( "sha-1" , "parent-sha-1" , 42 , time) ;
@@ -855,32 +855,28 @@ mod tests {
855855 . unwrap ( ) ;
856856
857857 // Now we can insert the job
858- let enqueue_result = db
859- . enqueue_benchmark_job (
860- benchmark_request. tag ( ) . unwrap ( ) ,
861- Target :: X86_64UnknownLinuxGnu ,
862- CodegenBackend :: Llvm ,
863- Profile :: Opt ,
864- 1u32 ,
865- )
866- . await ;
867- assert ! ( enqueue_result. is_ok( ) ) ;
858+ db. enqueue_benchmark_job (
859+ benchmark_request. tag ( ) . unwrap ( ) ,
860+ Target :: X86_64UnknownLinuxGnu ,
861+ CodegenBackend :: Llvm ,
862+ Profile :: Opt ,
863+ 1u32 ,
864+ )
865+ . await
866+ . unwrap ( ) ;
868867
869- let benchmark_job = db
868+ let ( benchmark_job, artifact_id ) = db
870869 . dequeue_benchmark_job (
871870 collector_config. name ( ) ,
872871 collector_config. target ( ) ,
873872 collector_config. benchmark_set ( ) ,
874873 )
875- . await ;
876- assert ! ( benchmark_job. is_ok( ) ) ;
877-
878- let benchmark_job = benchmark_job. unwrap ( ) ;
879- assert ! ( benchmark_job. is_some( ) ) ;
874+ . await
875+ . unwrap ( )
876+ . unwrap ( ) ;
880877
881878 // Ensure the properties of the job match both the request and the
882879 // collector configuration
883- let benchmark_job = benchmark_job. unwrap ( ) ;
884880 assert_eq ! (
885881 benchmark_job. request_tag( ) ,
886882 benchmark_request. tag( ) . unwrap( )
@@ -894,6 +890,15 @@ mod tests {
894890 collector_config. name( ) ,
895891 ) ;
896892
893+ assert_eq ! (
894+ artifact_id,
895+ ArtifactId :: Commit ( Commit {
896+ sha: "sha-1" . to_string( ) ,
897+ date: Date ( time) ,
898+ r#type: CommitType :: Master ,
899+ } )
900+ ) ;
901+
897902 Ok ( ctx)
898903 } )
899904 . await ;
0 commit comments