@@ -703,6 +703,8 @@ mod test {
703703 checkin_margin : Some ( 5 ) ,
704704 max_runtime : Some ( 30 ) ,
705705 timezone : Some ( "UTC" . into ( ) ) ,
706+ failure_issue_threshold : None ,
707+ recovery_threshold : None ,
706708 } ) ,
707709 } ;
708710 let envelope: Envelope = check_in. into ( ) ;
@@ -715,6 +717,37 @@ mod test {
715717 )
716718 }
717719
720+ #[ test]
721+ fn test_monitor_checkin_with_thresholds ( ) {
722+ let check_in_id = Uuid :: parse_str ( "22d00b3f-d1b1-4b5d-8d20-49d138cd8a9c" ) . unwrap ( ) ;
723+
724+ let check_in = MonitorCheckIn {
725+ check_in_id,
726+ monitor_slug : "my-monitor" . into ( ) ,
727+ status : MonitorCheckInStatus :: Ok ,
728+ duration : Some ( 123.4 ) ,
729+ environment : Some ( "production" . into ( ) ) ,
730+ monitor_config : Some ( MonitorConfig {
731+ schedule : MonitorSchedule :: Crontab {
732+ value : "12 0 * * *" . into ( ) ,
733+ } ,
734+ checkin_margin : Some ( 5 ) ,
735+ max_runtime : Some ( 30 ) ,
736+ timezone : Some ( "UTC" . into ( ) ) ,
737+ failure_issue_threshold : Some ( 4 ) ,
738+ recovery_threshold : Some ( 7 ) ,
739+ } ) ,
740+ } ;
741+ let envelope: Envelope = check_in. into ( ) ;
742+ assert_eq ! (
743+ to_str( envelope) ,
744+ r#"{}
745+ {"type":"check_in","length":310}
746+ {"check_in_id":"22d00b3fd1b14b5d8d2049d138cd8a9c","monitor_slug":"my-monitor","status":"ok","environment":"production","duration":123.4,"monitor_config":{"schedule":{"type":"crontab","value":"12 0 * * *"},"checkin_margin":5,"max_runtime":30,"timezone":"UTC","failure_issue_threshold":4,"recovery_threshold":7}}
747+ "#
748+ )
749+ }
750+
718751 #[ test]
719752 fn test_event_with_attachment ( ) {
720753 let event_id = Uuid :: parse_str ( "22d00b3f-d1b1-4b5d-8d20-49d138cd8a9c" ) . unwrap ( ) ;
0 commit comments