@@ -62,16 +62,6 @@ def make_ref_time(**kwargs):
62
62
return task_run_ts , sub_task_run_ts , trimmed_ts
63
63
64
64
65
- def get_checkin_timeout_kwargs (checkin : MonitorCheckIn ):
66
- return {
67
- "monitor_id" : checkin .monitor .id ,
68
- "monitor_environment_id" : checkin .monitor_environment .id ,
69
- "status" : checkin .status ,
70
- "date_added" : checkin .date_added ,
71
- "timeout_at" : checkin .timeout_at ,
72
- }
73
-
74
-
75
65
class MonitorTaskCheckMissingTest (TestCase ):
76
66
@mock .patch ("sentry.monitors.tasks.mark_environment_missing" )
77
67
def test_missing_checkin (self , mark_environment_missing_mock ):
@@ -662,18 +652,15 @@ def test_timeout(self, mark_checkin_timeout_mock):
662
652
assert mark_checkin_timeout_mock .delay .call_count == 0
663
653
664
654
# Timout at 12:30
665
- checkin_kwargs = get_checkin_timeout_kwargs (checkin )
666
655
check_timeout (task_run_ts + timedelta (minutes = 30 ))
667
656
assert mark_checkin_timeout_mock .delay .call_count == 1
668
657
assert mark_checkin_timeout_mock .delay .mock_calls [0 ] == mock .call (
669
658
checkin .id ,
670
659
sub_task_run_ts + timedelta (minutes = 30 ),
671
- ** checkin_kwargs ,
672
660
)
673
661
mark_checkin_timeout (
674
662
checkin .id ,
675
663
sub_task_run_ts + timedelta (minutes = 30 ),
676
- ** checkin_kwargs ,
677
664
)
678
665
679
666
# Check in is marked as timed out
@@ -757,19 +744,16 @@ def test_timeout_with_overlapping_concurrent_checkins(self, mark_checkin_timeout
757
744
assert mark_checkin_timeout_mock .delay .call_count == 0
758
745
759
746
# First checkin timed out
760
- checkin_kwargs = get_checkin_timeout_kwargs (checkin1 )
761
747
check_timeout (task_run_ts + timedelta (minutes = 30 ))
762
748
assert mark_checkin_timeout_mock .delay .call_count == 1
763
749
assert mark_checkin_timeout_mock .delay .mock_calls [0 ] == mock .call (
764
750
checkin1 .id ,
765
751
sub_task_run_ts + timedelta (minutes = 30 ),
766
- ** checkin_kwargs ,
767
752
)
768
753
769
754
mark_checkin_timeout (
770
755
checkin1 .id ,
771
756
sub_task_run_ts + timedelta (minutes = 30 ),
772
- ** checkin_kwargs ,
773
757
)
774
758
775
759
# First checkin is marked as timed out
@@ -835,15 +819,13 @@ def test_timeout_at_next_checkin_time(self, mark_checkin_timeout_mock):
835
819
)
836
820
837
821
# Check in was marked as timed out
838
- checkin_kwargs = get_checkin_timeout_kwargs (checkin )
839
822
check_timeout (task_run_ts )
840
823
assert mark_checkin_timeout_mock .delay .call_count == 1
841
824
assert mark_checkin_timeout_mock .delay .mock_calls [0 ] == mock .call (
842
825
checkin .id ,
843
826
sub_task_run_ts ,
844
- ** checkin_kwargs ,
845
827
)
846
- mark_checkin_timeout (checkin .id , sub_task_run_ts , ** checkin_kwargs )
828
+ mark_checkin_timeout (checkin .id , sub_task_run_ts )
847
829
848
830
# First checkin is marked as timed out
849
831
assert MonitorCheckIn .objects .filter (id = checkin .id , status = CheckInStatus .TIMEOUT ).exists ()
@@ -897,18 +879,15 @@ def test_timeout_using_interval(self, mark_checkin_timeout_mock):
897
879
)
898
880
899
881
# Timout at 12:05
900
- checkin_kwargs = get_checkin_timeout_kwargs (checkin )
901
882
check_timeout (task_run_ts + timedelta (minutes = 5 ))
902
883
assert mark_checkin_timeout_mock .delay .call_count == 1
903
884
assert mark_checkin_timeout_mock .delay .mock_calls [0 ] == mock .call (
904
885
checkin .id ,
905
886
sub_task_run_ts + timedelta (minutes = 5 ),
906
- ** checkin_kwargs ,
907
887
)
908
888
mark_checkin_timeout (
909
889
checkin .id ,
910
890
sub_task_run_ts + timedelta (minutes = 5 ),
911
- ** checkin_kwargs ,
912
891
)
913
892
914
893
# Check in is marked as timed out
@@ -979,18 +958,16 @@ def test_timeout_with_future_complete_checkin(self, mark_checkin_timeout_mock):
979
958
980
959
# Running check monitor will mark the first checkin as timed out. The
981
960
# second checkin was already marked as OK.
982
- checkin_kwargs = get_checkin_timeout_kwargs (checkin1 )
983
961
check_timeout (task_run_ts )
984
962
985
963
# assert that task is called for the specific checkin
986
964
assert mark_checkin_timeout_mock .delay .call_count == 1
987
965
assert mark_checkin_timeout_mock .delay .mock_calls [0 ] == mock .call (
988
966
checkin1 .id ,
989
967
sub_task_run_ts ,
990
- ** checkin_kwargs ,
991
968
)
992
969
993
- mark_checkin_timeout (checkin1 .id , sub_task_run_ts , ** checkin_kwargs )
970
+ mark_checkin_timeout (checkin1 .id , sub_task_run_ts )
994
971
995
972
# The first checkin is marked as timed out
996
973
assert MonitorCheckIn .objects .filter (id = checkin1 .id , status = CheckInStatus .TIMEOUT ).exists ()
0 commit comments