@@ -276,7 +276,7 @@ public async Task Run_GetMessageFails_ErrorLoggedAndFileSentToPoisonQueue()
276276 }
277277
278278 [ Fact ]
279- public async Task Run_AcknowledgeMessageFails_ErrorLoggedAndFileSentToPoisonQueue ( )
279+ public async Task Run_AcknowledgeMessageFails_WarningLoggedAndProcessingContinuesAsNormal ( )
280280 {
281281 // Arrange
282282 var fileId = "file-4" ;
@@ -293,6 +293,7 @@ public async Task Run_AcknowledgeMessageFails_ErrorLoggedAndFileSentToPoisonQueu
293293 await _dbContext . SaveChangesAsync ( ) ;
294294
295295 var content = new byte [ ] { 1 , 2 , 3 } ;
296+ const string blobPath = "directory/fileName" ;
296297
297298 _meshInboxServiceMock . Setup ( s => s . GetMessageByIdAsync ( file . MailboxId , fileId ) )
298299 . ReturnsAsync ( new MeshResponse < GetMessageResponse >
@@ -318,19 +319,21 @@ public async Task Run_AcknowledgeMessageFails_ErrorLoggedAndFileSentToPoisonQueu
318319 // Assert
319320 _loggerMock . Verify (
320321 x => x . Log (
321- LogLevel . Error ,
322+ LogLevel . Warning ,
322323 It . IsAny < EventId > ( ) ,
323- It . Is < It . IsAnyType > ( ( v , t ) => v . ToString ( ) == $ "An exception occurred during file extraction for fileId: { fileId } ") ,
324- It . Is < InvalidOperationException > ( e => e . Message . StartsWith ( "Mesh acknowledgement failed: " ) ) ,
324+ It . Is < It . IsAnyType > ( ( v , t ) =>
325+ v . ToString ( ) . StartsWith ( "Mesh acknowledgement failed: " ) &&
326+ v . ToString ( ) . EndsWith ( "This is not a fatal error so processing will continue." ) ) ,
327+ null ,
325328 It . IsAny < Func < It . IsAnyType , Exception ? , string > > ( )
326329 ) , Times . Once ) ;
327330 _blobStoreMock . Verify ( b => b . UploadAsync ( file , content ) , Times . Once ) ;
328331 _meshInboxServiceMock . Verify ( m => m . AcknowledgeMessageByIdAsync ( file . MailboxId , file . FileId ) , Times . Once ) ;
329- _fileTransformQueueClientMock . Verify ( q => q . EnqueueFileTransformAsync ( It . IsAny < MeshFile > ( ) ) , Times . Never ) ;
330- _fileExtractQueueClientMock . Verify ( q => q . SendToPoisonQueueAsync ( message ) , Times . Once ) ;
332+ _fileTransformQueueClientMock . Verify ( q => q . EnqueueFileTransformAsync ( file ) , Times . Once ) ;
333+ _fileExtractQueueClientMock . Verify ( q => q . SendToPoisonQueueAsync ( message ) , Times . Never ) ;
331334 var updatedFile = _dbContext . MeshFiles . First ( ) ;
332- Assert . Null ( updatedFile . BlobPath ) ;
333- Assert . Equal ( MeshFileStatus . FailedExtract , updatedFile . Status ) ;
335+ Assert . Equal ( blobPath , updatedFile . BlobPath ) ;
336+ Assert . Equal ( MeshFileStatus . Extracted , updatedFile . Status ) ;
334337 Assert . True ( updatedFile . LastUpdatedUtc > originalLastUpdatedUtc ) ;
335338 }
336339}
0 commit comments