@@ -59,7 +59,7 @@ if Version.match?(System.version(), "~> 1.12") do
5959
6060 assert check_in_body [ "check_in_id" ] == "quantum-#{ :erlang . phash2 ( ref ) } "
6161 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 "
6363 assert check_in_body [ "duration" ] == nil
6464 assert check_in_body [ "environment" ] == "test"
6565
@@ -99,7 +99,7 @@ if Version.match?(System.version(), "~> 1.12") do
9999
100100 assert check_in_body [ "check_in_id" ] == "quantum-#{ :erlang . phash2 ( ref ) } "
101101 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 "
103103 assert check_in_body [ "duration" ] == 12.099
104104 assert check_in_body [ "environment" ] == "test"
105105
@@ -141,7 +141,7 @@ if Version.match?(System.version(), "~> 1.12") do
141141
142142 assert check_in_body [ "check_in_id" ] == "quantum-#{ :erlang . phash2 ( ref ) } "
143143 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 "
145145 assert check_in_body [ "duration" ] == 12.099
146146 assert check_in_body [ "environment" ] == "test"
147147
@@ -170,5 +170,38 @@ if Version.match?(System.version(), "~> 1.12") do
170170
171171 assert_receive { ^ ref , :done } , 1000
172172 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
173206 end
174207end
0 commit comments