@@ -59,7 +59,7 @@ if Version.match?(System.version(), "~> 1.12") do
59
59
60
60
assert check_in_body [ "check_in_id" ] == "quantum-#{ :erlang . phash2 ( ref ) } "
61
61
assert check_in_body [ "status" ] == "in_progress"
62
- assert check_in_body [ "monitor_slug" ] == "quantum-:test_job "
62
+ assert check_in_body [ "monitor_slug" ] == "quantum-test-job "
63
63
assert check_in_body [ "duration" ] == nil
64
64
assert check_in_body [ "environment" ] == "test"
65
65
@@ -99,7 +99,7 @@ if Version.match?(System.version(), "~> 1.12") do
99
99
100
100
assert check_in_body [ "check_in_id" ] == "quantum-#{ :erlang . phash2 ( ref ) } "
101
101
assert check_in_body [ "status" ] == "error"
102
- assert check_in_body [ "monitor_slug" ] == "quantum-:test_job "
102
+ assert check_in_body [ "monitor_slug" ] == "quantum-test-job "
103
103
assert check_in_body [ "duration" ] == 12.099
104
104
assert check_in_body [ "environment" ] == "test"
105
105
@@ -141,7 +141,7 @@ if Version.match?(System.version(), "~> 1.12") do
141
141
142
142
assert check_in_body [ "check_in_id" ] == "quantum-#{ :erlang . phash2 ( ref ) } "
143
143
assert check_in_body [ "status" ] == "ok"
144
- assert check_in_body [ "monitor_slug" ] == "quantum-:test_job "
144
+ assert check_in_body [ "monitor_slug" ] == "quantum-test-job "
145
145
assert check_in_body [ "duration" ] == 12.099
146
146
assert check_in_body [ "environment" ] == "test"
147
147
@@ -170,5 +170,38 @@ if Version.match?(System.version(), "~> 1.12") do
170
170
171
171
assert_receive { ^ ref , :done } , 1000
172
172
end
173
+
174
+ for { job_name , expected_slug } <- [
175
+ { :some_job , "quantum-some-job" } ,
176
+ { MyApp.MyJob , "quantum-my-app-my-job" }
177
+ ] do
178
+ test "works for a job named #{ inspect ( job_name ) } " , % { bypass: bypass } do
179
+ test_pid = self ( )
180
+ ref = make_ref ( )
181
+
182
+ Bypass . expect_once ( bypass , "POST" , "/api/1/envelope/" , fn conn ->
183
+ { :ok , body , conn } = Plug.Conn . read_body ( conn )
184
+ assert [ { _headers , check_in_body } ] = decode_envelope! ( body )
185
+
186
+ assert check_in_body [ "monitor_slug" ] == unquote ( expected_slug )
187
+ send ( test_pid , { ref , :done } )
188
+
189
+ Plug.Conn . send_resp ( conn , 200 , ~s< {"id": "1923"}> )
190
+ end )
191
+
192
+ duration = System . convert_time_unit ( 12_099 , :millisecond , :native )
193
+
194
+ :telemetry . execute ( [ :quantum , :job , :stop ] , % { duration: duration } , % {
195
+ job:
196
+ Scheduler . new_job (
197
+ name: unquote ( job_name ) ,
198
+ schedule: Crontab.CronExpression.Parser . parse! ( "@daily" )
199
+ ) ,
200
+ telemetry_span_context: ref
201
+ } )
202
+
203
+ assert_receive { ^ ref , :done } , 1000
204
+ end
205
+ end
173
206
end
174
207
end
0 commit comments