@@ -175,6 +175,52 @@ async def my_callback(did_name: str, info: Dict[str, Any]) \
175175 SXAdaptor .post_status_update .assert_any_call (ANY , severity = 'fatal' )
176176
177177
178+ def test_failed_file_after_good (rabbitmq , SXAdaptor ):
179+ 'Test a callback that fails before any files are sent'
180+
181+ async def my_callback (did_name : str , info : Dict [str , Any ]) \
182+ -> AsyncGenerator [Dict [str , Any ], None ]:
183+ yield {
184+ 'paths' : ["fork/it/over" ],
185+ 'adler32' : 'no clue' ,
186+ 'file_size' : 22323 ,
187+ 'file_events' : 0 ,
188+ }
189+ raise Exception ('that did not work' )
190+
191+ init_rabbit_mq (my_callback , 'http://myrabbit.com' , 'test_queue_name' , retries = 12 ,
192+ retry_interval = 10 )
193+ rabbitmq .send_did_request ('hi-there' )
194+
195+ # Make sure the file was sent along, along with the completion
196+ SXAdaptor .put_file_add .assert_called_once ()
197+ SXAdaptor .put_fileset_complete .assert_not_called ()
198+ SXAdaptor .post_status_update .assert_any_call (ANY , severity = 'fatal' )
199+
200+
201+ def test_failed_file_after_good_with_avail (rabbitmq , SXAdaptor ):
202+ 'Test a callback that fails before any files are sent'
203+
204+ async def my_callback (did_name : str , info : Dict [str , Any ]) \
205+ -> AsyncGenerator [Dict [str , Any ], None ]:
206+ yield {
207+ 'paths' : ["fork/it/over" ],
208+ 'adler32' : 'no clue' ,
209+ 'file_size' : 22323 ,
210+ 'file_events' : 0 ,
211+ }
212+ raise Exception ('that did not work' )
213+
214+ init_rabbit_mq (my_callback , 'http://myrabbit.com' , 'test_queue_name' , retries = 12 ,
215+ retry_interval = 10 )
216+ rabbitmq .send_did_request ('hi-there?get=available' )
217+
218+ # Make sure the file was sent along, along with the completion
219+ SXAdaptor .put_file_add .assert_called_once ()
220+ SXAdaptor .put_fileset_complete .assert_called_once ()
221+ SXAdaptor .post_status_update .assert_any_call ("Completed load of files in 0 seconds" )
222+
223+
178224def test_no_files_returned (rabbitmq , SXAdaptor ):
179225 'Test a callback that fails before any files are sent'
180226
0 commit comments