@@ -15,59 +15,61 @@ defmodule Sentry.Integrations.Oban.CronTest do
1515 end
1616
1717 setup do
18- SentryTest . setup_sentry ( dedup_events: false , environment_name: "test" )
18+ SentryTest . setup_sentry (
19+ dedup_events: false ,
20+ environment_name: "test" ,
21+ collect_envelopes: [ type: "check_in" ]
22+ )
1923 end
2024
2125 for event_type <- [ :start , :stop , :exception ] do
22- test "ignores #{ event_type } events without a cron meta" , % { bypass: bypass } do
23- Bypass . down ( bypass )
26+ test "ignores #{ event_type } events without a cron meta" , % { ref: ref } do
2427 :telemetry . execute ( [ :oban , :job , unquote ( event_type ) ] , % { } , % { job: % Oban.Job { } } )
28+ refute_sentry_check_in ( ref )
2529 end
2630
27- test "ignores #{ event_type } events without a cron_expr meta" , % { bypass: bypass } do
28- Bypass . down ( bypass )
29-
31+ test "ignores #{ event_type } events without a cron_expr meta" , % { ref: ref } do
3032 :telemetry . execute ( [ :oban , :job , unquote ( event_type ) ] , % { } , % {
3133 job: % Oban.Job { meta: % { "cron" => true } }
3234 } )
33- end
3435
35- test "ignores #{ event_type } events with a cron expr of @reboot" , % { bypass: bypass } do
36- Bypass . down ( bypass )
36+ refute_sentry_check_in ( ref )
37+ end
3738
39+ test "ignores #{ event_type } events with a cron expr of @reboot" , % { ref: ref } do
3840 :telemetry . execute ( [ :oban , :job , unquote ( event_type ) ] , % { } , % {
3941 job: % Oban.Job {
4042 worker: "Sentry.MyWorker" ,
4143 meta: % { "cron" => true , "cron_expr" => "@reboot" }
4244 }
4345 } )
46+
47+ refute_sentry_check_in ( ref )
4448 end
4549
4650 test "ignores #{ event_type } events with a cron expr of @reboot even with timezone" , % {
47- bypass: bypass
51+ ref: ref
4852 } do
49- Bypass . down ( bypass )
50-
5153 :telemetry . execute ( [ :oban , :job , unquote ( event_type ) ] , % { } , % {
5254 job: % Oban.Job {
5355 worker: "Sentry.MyWorker" ,
5456 meta: % { "cron" => true , "cron_expr" => "@reboot" , "cron_tz" => "Etc/UTC" }
5557 }
5658 } )
57- end
5859
59- test "ignores #{ event_type } events with a cron expr that is not a string" , % { bypass: bypass } do
60- Bypass . down ( bypass )
60+ refute_sentry_check_in ( ref )
61+ end
6162
63+ test "ignores #{ event_type } events with a cron expr that is not a string" , % { ref: ref } do
6264 :telemetry . execute ( [ :oban , :job , unquote ( event_type ) ] , % { } , % {
6365 job: % Oban.Job { worker: "Sentry.MyWorker" , meta: % { "cron" => true , "cron_expr" => 123 } }
6466 } )
67+
68+ refute_sentry_check_in ( ref )
6569 end
6670 end
6771
68- test "captures start events with monitor config" , % { bypass: bypass } do
69- ref = SentryTest . setup_bypass_envelope_collector ( bypass , type: "check_in" )
70-
72+ test "captures start events with monitor config" , % { ref: ref } do
7173 :telemetry . execute ( [ :oban , :job , :start ] , % { } , % {
7274 job: % Oban.Job {
7375 worker: "Sentry.MyWorker" ,
@@ -111,9 +113,7 @@ defmodule Sentry.Integrations.Oban.CronTest do
111113 { "@annually" , "year" }
112114 ] do
113115 test "captures stop events with monitor config and state of #{ inspect ( oban_state ) } and frequency of #{ frequency } " ,
114- % { bypass: bypass } do
115- ref = SentryTest . setup_bypass_envelope_collector ( bypass , type: "check_in" )
116-
116+ % { ref: ref } do
117117 duration = System . convert_time_unit ( 12_099 , :millisecond , :native )
118118
119119 :telemetry . execute ( [ :oban , :job , :stop ] , % { duration: duration } , % {
@@ -146,9 +146,7 @@ defmodule Sentry.Integrations.Oban.CronTest do
146146 end
147147 end
148148
149- test "captures exception events with monitor config" , % { bypass: bypass } do
150- ref = SentryTest . setup_bypass_envelope_collector ( bypass , type: "check_in" )
151-
149+ test "captures exception events with monitor config" , % { ref: ref } do
152150 duration = System . convert_time_unit ( 12_099 , :millisecond , :native )
153151
154152 :telemetry . execute ( [ :oban , :job , :exception ] , % { duration: duration } , % {
@@ -179,7 +177,7 @@ defmodule Sentry.Integrations.Oban.CronTest do
179177 )
180178 end
181179
182- test "uses default monitor configuration in Sentry's config if present" , % { bypass: bypass } do
180+ test "uses default monitor configuration in Sentry's config if present" , % { ref: ref } do
183181 put_test_config (
184182 integrations: [
185183 monitor_config_defaults: [
@@ -190,8 +188,6 @@ defmodule Sentry.Integrations.Oban.CronTest do
190188 ]
191189 )
192190
193- ref = SentryTest . setup_bypass_envelope_collector ( bypass , type: "check_in" )
194-
195191 :telemetry . execute ( [ :oban , :job , :exception ] , % { duration: 0 } , % {
196192 state: :success ,
197193 job: % Oban.Job {
@@ -219,9 +215,7 @@ defmodule Sentry.Integrations.Oban.CronTest do
219215
220216 @ tag attach_opts: [ monitor_slug_generator: { __MODULE__ , :custom_name_generator } ]
221217 test "monitor_slug is not affected if the custom monitor_name_generator does not target the worker" ,
222- % { bypass: bypass } do
223- ref = SentryTest . setup_bypass_envelope_collector ( bypass , type: "check_in" )
224-
218+ % { ref: ref } do
225219 :telemetry . execute ( [ :oban , :job , :start ] , % { } , % {
226220 job: % Oban.Job {
227221 worker: "Sentry.MyWorker" ,
@@ -236,9 +230,8 @@ defmodule Sentry.Integrations.Oban.CronTest do
236230
237231 @ tag attach_opts: [ monitor_slug_generator: { __MODULE__ , :custom_name_generator } ]
238232 test "monitor_slug is set based on the custom monitor_name_generator if it targets the worker" ,
239- % { bypass: bypass } do
233+ % { ref: ref } do
240234 client_name = "my-client"
241- ref = SentryTest . setup_bypass_envelope_collector ( bypass , type: "check_in" )
242235
243236 :telemetry . execute ( [ :oban , :job , :start ] , % { } , % {
244237 job: % Oban.Job {
@@ -253,9 +246,7 @@ defmodule Sentry.Integrations.Oban.CronTest do
253246 assert_sentry_report ( check_in_body , monitor_slug: "sentry-client-worker-my-client" )
254247 end
255248
256- test "custom options overide job metadata" , % { bypass: bypass } do
257- ref = SentryTest . setup_bypass_envelope_collector ( bypass , type: "check_in" )
258-
249+ test "custom options overide job metadata" , % { ref: ref } do
259250 defmodule WorkerWithCustomOptions do
260251 use Oban.Worker
261252
0 commit comments