@@ -235,16 +235,10 @@ pub trait Connection: Send + Sync {
235
235
236
236
/// Try and mark the benchmark_request as completed. Will return `true` if
237
237
/// it has been marked as completed else `false` meaning there was no change
238
- async fn try_mark_benchmark_request_as_completed (
238
+ async fn mark_benchmark_request_as_completed (
239
239
& self ,
240
240
benchmark_request : & mut BenchmarkRequest ,
241
241
) -> anyhow:: Result < bool > ;
242
-
243
- /// Given a benchmark request get the id
244
- async fn get_benchmark_request_id (
245
- & self ,
246
- benchmark_request : & BenchmarkRequest ,
247
- ) -> anyhow:: Result < u32 > ;
248
242
}
249
243
250
244
#[ async_trait:: async_trait]
@@ -762,6 +756,7 @@ mod tests {
762
756
CodegenBackend :: Llvm ,
763
757
3 ,
764
758
"collector 1" ,
759
+ Utc :: now ( ) ,
765
760
BenchmarkJobStatus :: Queued ,
766
761
) ;
767
762
@@ -782,6 +777,7 @@ mod tests {
782
777
CodegenBackend :: Llvm ,
783
778
3 ,
784
779
"collector 1" ,
780
+ Utc :: now ( ) ,
785
781
BenchmarkJobStatus :: Queued ,
786
782
) ;
787
783
let request = create_try (
@@ -825,20 +821,22 @@ mod tests {
825
821
CodegenBackend :: Llvm ,
826
822
1 ,
827
823
"collector 1" ,
824
+ Utc :: now ( ) ,
828
825
BenchmarkJobStatus :: Success ,
829
826
) ;
830
827
let job_2 = BenchmarkJob :: new (
831
828
Target :: X86_64UnknownLinuxGnu ,
832
829
CodegenBackend :: Llvm ,
833
830
2 ,
834
831
"collector 2" ,
832
+ Utc :: now ( ) ,
835
833
BenchmarkJobStatus :: Success ,
836
834
) ;
837
835
838
836
db_insert_jobs ( & * db, request_id, & [ job_1, job_2] ) . await ;
839
837
840
838
assert ! ( db
841
- . try_mark_benchmark_request_as_completed ( & mut request)
839
+ . mark_benchmark_request_as_completed ( & mut request)
842
840
. await
843
841
. is_err( ) ) ;
844
842
@@ -870,20 +868,22 @@ mod tests {
870
868
CodegenBackend :: Llvm ,
871
869
1 ,
872
870
"collector 1" ,
871
+ Utc :: now ( ) ,
873
872
BenchmarkJobStatus :: Success ,
874
873
) ;
875
874
let job_2 = BenchmarkJob :: new (
876
875
Target :: X86_64UnknownLinuxGnu ,
877
876
CodegenBackend :: Llvm ,
878
877
2 ,
879
878
"collector 2" ,
879
+ Utc :: now ( ) ,
880
880
BenchmarkJobStatus :: Success ,
881
881
) ;
882
882
883
883
db_insert_jobs ( & * db, request_id, & [ job_1, job_2] ) . await ;
884
884
885
885
assert ! ( db
886
- . try_mark_benchmark_request_as_completed ( & mut request)
886
+ . mark_benchmark_request_as_completed ( & mut request)
887
887
. await
888
888
. is_err( ) ) ;
889
889
@@ -916,20 +916,22 @@ mod tests {
916
916
CodegenBackend :: Llvm ,
917
917
1 ,
918
918
"collector 1" ,
919
+ Utc :: now ( ) ,
919
920
BenchmarkJobStatus :: InProgress ,
920
921
) ;
921
922
let job_2 = BenchmarkJob :: new (
922
923
Target :: X86_64UnknownLinuxGnu ,
923
924
CodegenBackend :: Llvm ,
924
925
2 ,
925
926
"collector 2" ,
927
+ Utc :: now ( ) ,
926
928
BenchmarkJobStatus :: Success ,
927
929
) ;
928
930
929
931
db_insert_jobs ( & * db, request_id, & [ job_1, job_2] ) . await ;
930
932
931
933
assert ! ( db
932
- . try_mark_benchmark_request_as_completed ( & mut request)
934
+ . mark_benchmark_request_as_completed ( & mut request)
933
935
. await
934
936
. is_ok( ) ) ;
935
937
assert_eq ! ( request. status( ) , BenchmarkRequestStatus :: InProgress ) ;
@@ -962,20 +964,22 @@ mod tests {
962
964
CodegenBackend :: Llvm ,
963
965
1 ,
964
966
"collector 1" ,
967
+ Utc :: now ( ) ,
965
968
BenchmarkJobStatus :: Success ,
966
969
) ;
967
970
let job_2 = BenchmarkJob :: new (
968
971
Target :: X86_64UnknownLinuxGnu ,
969
972
CodegenBackend :: Llvm ,
970
973
2 ,
971
974
"collector 2" ,
975
+ Utc :: now ( ) ,
972
976
BenchmarkJobStatus :: Success ,
973
977
) ;
974
978
975
979
db_insert_jobs ( & * db, request_id, & [ job_1, job_2] ) . await ;
976
980
977
981
assert ! ( db
978
- . try_mark_benchmark_request_as_completed ( & mut request)
982
+ . mark_benchmark_request_as_completed ( & mut request)
979
983
. await
980
984
. is_ok( ) ) ;
981
985
// The struct should have been mutated
@@ -987,28 +991,4 @@ mod tests {
987
991
} )
988
992
. await ;
989
993
}
990
-
991
- #[ tokio:: test]
992
- async fn get_benchmark_request_id ( ) {
993
- run_postgres_test ( |ctx| async {
994
- let db = ctx. db_client ( ) ;
995
- let db = db. connection ( ) . await ;
996
- let request = create_try (
997
- Some ( "s1" ) ,
998
- Some ( "p1" ) ,
999
- 3 ,
1000
- Utc :: now ( ) ,
1001
- BenchmarkRequestStatus :: InProgress ,
1002
- "" ,
1003
- "" ,
1004
- ) ;
1005
- db. insert_benchmark_request ( & request) . await . unwrap ( ) ;
1006
-
1007
- let retrieved = db. get_benchmark_request_id ( & request) . await . unwrap ( ) ;
1008
- assert_eq ! ( 1 , retrieved) ;
1009
-
1010
- Ok ( ctx)
1011
- } )
1012
- . await ;
1013
- }
1014
994
}
0 commit comments