@@ -213,17 +213,11 @@ pub trait Connection: Send + Sync {
213
213
214
214
/// Try and mark the benchmark_request as completed. Will return `true` if
215
215
/// it has been marked as completed else `false` meaning there was no change
216
- async fn try_mark_benchmark_request_as_completed (
216
+ async fn mark_benchmark_request_as_completed (
217
217
& self ,
218
218
benchmark_request : & mut BenchmarkRequest ,
219
219
) -> anyhow:: Result < bool > ;
220
220
221
- /// Given a benchmark request get the id
222
- async fn get_benchmark_request_id (
223
- & self ,
224
- benchmark_request : & BenchmarkRequest ,
225
- ) -> anyhow:: Result < u32 > ;
226
-
227
221
/// Insert a benchmark job into the `job_queue`
228
222
async fn insert_benchmark_job (
229
223
& self ,
@@ -653,6 +647,7 @@ mod tests {
653
647
CodegenBackend :: Llvm ,
654
648
3 ,
655
649
"collector 1" ,
650
+ Utc :: now ( ) ,
656
651
BenchmarkJobStatus :: Queued ,
657
652
) ;
658
653
@@ -673,6 +668,7 @@ mod tests {
673
668
CodegenBackend :: Llvm ,
674
669
3 ,
675
670
"collector 1" ,
671
+ Utc :: now ( ) ,
676
672
BenchmarkJobStatus :: Queued ,
677
673
) ;
678
674
let request = create_try (
@@ -716,20 +712,22 @@ mod tests {
716
712
CodegenBackend :: Llvm ,
717
713
1 ,
718
714
"collector 1" ,
715
+ Utc :: now ( ) ,
719
716
BenchmarkJobStatus :: Success ,
720
717
) ;
721
718
let job_2 = BenchmarkJob :: new (
722
719
Target :: X86_64UnknownLinuxGnu ,
723
720
CodegenBackend :: Llvm ,
724
721
2 ,
725
722
"collector 2" ,
723
+ Utc :: now ( ) ,
726
724
BenchmarkJobStatus :: Success ,
727
725
) ;
728
726
729
727
db_insert_jobs ( & * db, request_id, & [ job_1, job_2] ) . await ;
730
728
731
729
assert ! ( db
732
- . try_mark_benchmark_request_as_completed ( & mut request)
730
+ . mark_benchmark_request_as_completed ( & mut request)
733
731
. await
734
732
. is_err( ) ) ;
735
733
@@ -761,20 +759,22 @@ mod tests {
761
759
CodegenBackend :: Llvm ,
762
760
1 ,
763
761
"collector 1" ,
762
+ Utc :: now ( ) ,
764
763
BenchmarkJobStatus :: Success ,
765
764
) ;
766
765
let job_2 = BenchmarkJob :: new (
767
766
Target :: X86_64UnknownLinuxGnu ,
768
767
CodegenBackend :: Llvm ,
769
768
2 ,
770
769
"collector 2" ,
770
+ Utc :: now ( ) ,
771
771
BenchmarkJobStatus :: Success ,
772
772
) ;
773
773
774
774
db_insert_jobs ( & * db, request_id, & [ job_1, job_2] ) . await ;
775
775
776
776
assert ! ( db
777
- . try_mark_benchmark_request_as_completed ( & mut request)
777
+ . mark_benchmark_request_as_completed ( & mut request)
778
778
. await
779
779
. is_err( ) ) ;
780
780
@@ -807,20 +807,22 @@ mod tests {
807
807
CodegenBackend :: Llvm ,
808
808
1 ,
809
809
"collector 1" ,
810
+ Utc :: now ( ) ,
810
811
BenchmarkJobStatus :: InProgress ,
811
812
) ;
812
813
let job_2 = BenchmarkJob :: new (
813
814
Target :: X86_64UnknownLinuxGnu ,
814
815
CodegenBackend :: Llvm ,
815
816
2 ,
816
817
"collector 2" ,
818
+ Utc :: now ( ) ,
817
819
BenchmarkJobStatus :: Success ,
818
820
) ;
819
821
820
822
db_insert_jobs ( & * db, request_id, & [ job_1, job_2] ) . await ;
821
823
822
824
assert ! ( db
823
- . try_mark_benchmark_request_as_completed ( & mut request)
825
+ . mark_benchmark_request_as_completed ( & mut request)
824
826
. await
825
827
. is_ok( ) ) ;
826
828
assert_eq ! ( request. status( ) , BenchmarkRequestStatus :: InProgress ) ;
@@ -853,20 +855,22 @@ mod tests {
853
855
CodegenBackend :: Llvm ,
854
856
1 ,
855
857
"collector 1" ,
858
+ Utc :: now ( ) ,
856
859
BenchmarkJobStatus :: Success ,
857
860
) ;
858
861
let job_2 = BenchmarkJob :: new (
859
862
Target :: X86_64UnknownLinuxGnu ,
860
863
CodegenBackend :: Llvm ,
861
864
2 ,
862
865
"collector 2" ,
866
+ Utc :: now ( ) ,
863
867
BenchmarkJobStatus :: Success ,
864
868
) ;
865
869
866
870
db_insert_jobs ( & * db, request_id, & [ job_1, job_2] ) . await ;
867
871
868
872
assert ! ( db
869
- . try_mark_benchmark_request_as_completed ( & mut request)
873
+ . mark_benchmark_request_as_completed ( & mut request)
870
874
. await
871
875
. is_ok( ) ) ;
872
876
// The struct should have been mutated
@@ -878,28 +882,4 @@ mod tests {
878
882
} )
879
883
. await ;
880
884
}
881
-
882
- #[ tokio:: test]
883
- async fn get_benchmark_request_id ( ) {
884
- run_postgres_test ( |ctx| async {
885
- let db = ctx. db_client ( ) ;
886
- let db = db. connection ( ) . await ;
887
- let request = create_try (
888
- Some ( "s1" ) ,
889
- Some ( "p1" ) ,
890
- 3 ,
891
- Utc :: now ( ) ,
892
- BenchmarkRequestStatus :: InProgress ,
893
- "" ,
894
- "" ,
895
- ) ;
896
- db. insert_benchmark_request ( & request) . await . unwrap ( ) ;
897
-
898
- let retrieved = db. get_benchmark_request_id ( & request) . await . unwrap ( ) ;
899
- assert_eq ! ( 1 , retrieved) ;
900
-
901
- Ok ( ctx)
902
- } )
903
- . await ;
904
- }
905
885
}
0 commit comments