@@ -304,15 +304,20 @@ async def test_sync_invocation_request_log(self):
304
304
await self ._check_if_function_is_ok (host )
305
305
)
306
306
307
- mock_logger .info .assert_any_call (
308
- 'Received FunctionInvocationRequest, '
309
- f'request ID: { request_id } , '
310
- f'function ID: { func_id } , '
311
- f'function name: { func_name } , '
312
- f'invocation ID: { invoke_id } , '
313
- 'function type: sync, '
314
- f'sync threadpool max workers: { self ._default_workers } '
315
- )
307
+ logs , _ = mock_logger .info .call_args
308
+ self .assertRegex (logs [0 ],
309
+ 'Received FunctionInvocationRequest, '
310
+ f'request ID: { request_id } , '
311
+ f'function ID: { func_id } , '
312
+ f'function name: { func_name } , '
313
+ f'invocation ID: { invoke_id } , '
314
+ 'function type: sync, '
315
+ r'timestamp \(UTC\): '
316
+ r'(\d{4}-\d{2}-\d{2} '
317
+ r'\d{2}:\d{2}:\d{2}.\d{6}), '
318
+ 'sync threadpool max workers: '
319
+ f'{ self ._default_workers } '
320
+ )
316
321
317
322
async def test_async_invocation_request_log (self ):
318
323
with patch ('azure_functions_worker.dispatcher.logger' ) as mock_logger :
@@ -323,14 +328,18 @@ async def test_async_invocation_request_log(self):
323
328
await self ._check_if_async_function_is_ok (host )
324
329
)
325
330
326
- mock_logger .info .assert_any_call (
327
- 'Received FunctionInvocationRequest, '
328
- f'request ID: { request_id } , '
329
- f'function ID: { func_id } , '
330
- f'function name: { func_name } , '
331
- f'invocation ID: { invoke_id } , '
332
- 'function type: async'
333
- )
331
+ logs , _ = mock_logger .info .call_args
332
+ self .assertRegex (logs [0 ],
333
+ 'Received FunctionInvocationRequest, '
334
+ f'request ID: { request_id } , '
335
+ f'function ID: { func_id } , '
336
+ f'function name: { func_name } , '
337
+ f'invocation ID: { invoke_id } , '
338
+ 'function type: async, '
339
+ r'timestamp \(UTC\): '
340
+ r'(\d{4}-\d{2}-\d{2} '
341
+ r'\d{2}:\d{2}:\d{2}.\d{6})'
342
+ )
334
343
335
344
async def test_sync_invocation_request_log_threads (self ):
336
345
os .environ .update ({PYTHON_THREADPOOL_THREAD_COUNT : '5' })
@@ -342,15 +351,19 @@ async def test_sync_invocation_request_log_threads(self):
342
351
await self ._check_if_function_is_ok (host )
343
352
)
344
353
345
- mock_logger .info .assert_any_call (
346
- 'Received FunctionInvocationRequest, '
347
- f'request ID: { request_id } , '
348
- f'function ID: { func_id } , '
349
- f'function name: { func_name } , '
350
- f'invocation ID: { invoke_id } , '
351
- 'function type: sync, '
352
- 'sync threadpool max workers: 5'
353
- )
354
+ logs , _ = mock_logger .info .call_args
355
+ self .assertRegex (logs [0 ],
356
+ 'Received FunctionInvocationRequest, '
357
+ f'request ID: { request_id } , '
358
+ f'function ID: { func_id } , '
359
+ f'function name: { func_name } , '
360
+ f'invocation ID: { invoke_id } , '
361
+ 'function type: sync, '
362
+ r'timestamp \(UTC\): '
363
+ r'(\d{4}-\d{2}-\d{2} '
364
+ r'\d{2}:\d{2}:\d{2}.\d{6}), '
365
+ 'sync threadpool max workers: 5'
366
+ )
354
367
355
368
async def test_async_invocation_request_log_threads (self ):
356
369
os .environ .update ({PYTHON_THREADPOOL_THREAD_COUNT : '4' })
@@ -362,14 +375,18 @@ async def test_async_invocation_request_log_threads(self):
362
375
await self ._check_if_async_function_is_ok (host )
363
376
)
364
377
365
- mock_logger .info .assert_any_call (
366
- 'Received FunctionInvocationRequest, '
367
- f'request ID: { request_id } , '
368
- f'function ID: { func_id } , '
369
- f'function name: { func_name } , '
370
- f'invocation ID: { invoke_id } , '
371
- 'function type: async'
372
- )
378
+ logs , _ = mock_logger .info .call_args
379
+ self .assertRegex (logs [0 ],
380
+ 'Received FunctionInvocationRequest, '
381
+ f'request ID: { request_id } , '
382
+ f'function ID: { func_id } , '
383
+ f'function name: { func_name } , '
384
+ f'invocation ID: { invoke_id } , '
385
+ 'function type: async, '
386
+ r'timestamp \(UTC\): '
387
+ r'(\d{4}-\d{2}-\d{2} '
388
+ r'\d{2}:\d{2}:\d{2}.\d{6})'
389
+ )
373
390
374
391
async def test_sync_invocation_request_log_in_placeholder_threads (self ):
375
392
with patch ('azure_functions_worker.dispatcher.logger' ) as mock_logger :
@@ -383,15 +400,19 @@ async def test_sync_invocation_request_log_in_placeholder_threads(self):
383
400
await self ._check_if_function_is_ok (host )
384
401
)
385
402
386
- mock_logger .info .assert_any_call (
387
- 'Received FunctionInvocationRequest, '
388
- f'request ID: { request_id } , '
389
- f'function ID: { func_id } , '
390
- f'function name: { func_name } , '
391
- f'invocation ID: { invoke_id } , '
392
- 'function type: sync, '
393
- 'sync threadpool max workers: 5'
394
- )
403
+ logs , _ = mock_logger .info .call_args
404
+ self .assertRegex (logs [0 ],
405
+ 'Received FunctionInvocationRequest, '
406
+ f'request ID: { request_id } , '
407
+ f'function ID: { func_id } , '
408
+ f'function name: { func_name } , '
409
+ f'invocation ID: { invoke_id } , '
410
+ 'function type: sync, '
411
+ r'timestamp \(UTC\): '
412
+ r'(\d{4}-\d{2}-\d{2} '
413
+ r'\d{2}:\d{2}:\d{2}.\d{6}), '
414
+ 'sync threadpool max workers: 5'
415
+ )
395
416
396
417
async def test_async_invocation_request_log_in_placeholder_threads (self ):
397
418
with patch ('azure_functions_worker.dispatcher.logger' ) as mock_logger :
@@ -405,14 +426,18 @@ async def test_async_invocation_request_log_in_placeholder_threads(self):
405
426
await self ._check_if_async_function_is_ok (host )
406
427
)
407
428
408
- mock_logger .info .assert_any_call (
409
- 'Received FunctionInvocationRequest, '
410
- f'request ID: { request_id } , '
411
- f'function ID: { func_id } , '
412
- f'function name: { func_name } , '
413
- f'invocation ID: { invoke_id } , '
414
- 'function type: async'
415
- )
429
+ logs , _ = mock_logger .info .call_args
430
+ self .assertRegex (logs [0 ],
431
+ 'Received FunctionInvocationRequest, '
432
+ f'request ID: { request_id } , '
433
+ f'function ID: { func_id } , '
434
+ f'function name: { func_name } , '
435
+ f'invocation ID: { invoke_id } , '
436
+ 'function type: async, '
437
+ r'timestamp \(UTC\): '
438
+ r'(\d{4}-\d{2}-\d{2} '
439
+ r'\d{2}:\d{2}:\d{2}.\d{6})'
440
+ )
416
441
417
442
async def _assert_workers_threadpool (self , ctrl , host ,
418
443
expected_worker_count ):
0 commit comments