@@ -348,7 +348,7 @@ void ModifyHandlerUnittest::TestHandleBasicDeleteEvent() {
348348
349349 // Actually delete the file
350350 std::string logPath = gRootDir + PATH_SEPARATOR + gLogName ;
351- bfs ::remove (logPath);
351+ fs ::remove (logPath);
352352
353353 // Send DELETE event
354354 Event deleteEvent (gRootDir , gLogName , EVENT_DELETE, 0 );
@@ -537,10 +537,10 @@ void ModifyHandlerUnittest::TestDoublePopFrontBugWhenFileDeletedWithMultipleRead
537537 // Delete the physical file
538538 // In production, Linux marks the fd path with " (deleted)" suffix
539539 // In test environment, this may not be reliably detected
540- bfs ::remove (logPath1);
540+ fs ::remove (logPath1);
541541
542542 // Check if file still exists on filesystem
543- bool fileExists = bfs ::exists (logPath1);
543+ bool fileExists = fs ::exists (logPath1);
544544 LOG_INFO (sLogger ,
545545 (" File status" , " after deletion" )(" file exists" , fileExists)(" fd is open" , reader1->IsFileOpened ()));
546546
@@ -602,7 +602,7 @@ void ModifyHandlerUnittest::TestDoublePopFrontBugWhenFileDeletedWithMultipleRead
602602 APSARA_TEST_EQUAL_FATAL (handlerPtr->mNameReaderMap [gLogName ][0 ]->GetDevInode ().inode , devInode2.inode );
603603 APSARA_TEST_EQUAL_FATAL (handlerPtr->mNameReaderMap [gLogName ][1 ]->GetDevInode ().inode , devInode3.inode );
604604
605- // In this test scenario, the file was physically deleted via bfs ::remove()
605+ // In this test scenario, the file was physically deleted via fs ::remove()
606606 // while the file descriptor was still open. With the refactored code, the
607607 // size > 1 condition is checked first, preventing the double pop_front bug.
608608 // CloseFilePtr should detect the deletion and return isFileReallyDeleted = true.
@@ -717,9 +717,9 @@ void ModifyHandlerUnittest::TestFileDeletedWithTwoReaders_FileReallyDeleted() {
717717
718718 // Physically delete the file while fd is still open
719719 // This simulates the real scenario where file is deleted from filesystem
720- bfs ::remove (logPath1);
720+ fs ::remove (logPath1);
721721
722- bool fileExists = bfs ::exists (logPath1);
722+ bool fileExists = fs ::exists (logPath1);
723723 LOG_INFO (
724724 sLogger ,
725725 (" File status" , " file physically deleted" )(" file exists" , fileExists)(" fd is open" , reader1->IsFileOpened ()));
@@ -744,7 +744,7 @@ void ModifyHandlerUnittest::TestFileDeletedWithTwoReaders_FileReallyDeleted() {
744744 // 3. Enter the first branch (not IsFileDeleted branch)
745745 // 4. ForceReadLogAndPush called
746746 // 5. RemoveReaderFromArrayAndMap called - reader1 removed from array and map
747- // 6. CloseFilePtr called - detects file was deleted (bfs ::remove was called)
747+ // 6. CloseFilePtr called - detects file was deleted (fs ::remove was called)
748748 // 7. isFileReallyDeleted = true (file physically deleted from filesystem)
749749 // 8. reader1 NOT added to mRotatorReaderMap (because file really deleted)
750750 // Result: reader1 removed completely, only reader2 remains in array
@@ -767,7 +767,7 @@ void ModifyHandlerUnittest::TestFileDeletedWithTwoReaders_FileReallyDeleted() {
767767 APSARA_TEST_EQUAL_FATAL (handlerPtr->mDevInodeReaderMap .count (devInode2), 1 );
768768 APSARA_TEST_EQUAL_FATAL (handlerPtr->mNameReaderMap [gLogName ][0 ]->GetDevInode ().inode , devInode2.inode );
769769
770- // In this test scenario, the file was physically deleted via bfs ::remove()
770+ // In this test scenario, the file was physically deleted via fs ::remove()
771771 // while the file descriptor was still open. This means CloseFilePtr should
772772 // detect the deletion and return isFileReallyDeleted = true.
773773 // Therefore, reader1 should NOT be added to mRotatorReaderMap.
@@ -879,7 +879,7 @@ void ModifyHandlerUnittest::TestFileDeletedWithTwoReaders_FileNotDeleted() {
879879 // DON'T delete the file - it still exists on filesystem
880880 // This simulates the case where DELETE event was received but file still exists
881881
882- bool fileExists = bfs ::exists (logPath1);
882+ bool fileExists = fs ::exists (logPath1);
883883 LOG_INFO (sLogger ,
884884 (" File status" , " file NOT physically deleted" )(" file exists" , fileExists)(
885885 " fd is open" , reader1->IsFileOpened ())(" deleted flag" , reader1->IsFileDeleted ()));
@@ -1012,9 +1012,9 @@ void ModifyHandlerUnittest::TestFileDeletedWithSingleReader_FileReallyDeleted()
10121012 APSARA_TEST_TRUE_FATAL (reader->IsFileOpened ());
10131013
10141014 // Physically delete the file while fd is still open
1015- bfs ::remove (logPath);
1015+ fs ::remove (logPath);
10161016
1017- bool fileExists = bfs ::exists (logPath);
1017+ bool fileExists = fs ::exists (logPath);
10181018 LOG_INFO (
10191019 sLogger ,
10201020 (" File status" , " file physically deleted" )(" file exists" , fileExists)(" fd is open" , reader->IsFileOpened ()));
@@ -1037,7 +1037,7 @@ void ModifyHandlerUnittest::TestFileDeletedWithSingleReader_FileReallyDeleted()
10371037 // 1. hasMoreData = false (already at end)
10381038 // 2. readerArrayPtr->size() > 1 is false (size is 1)
10391039 // 3. IsFileDeleted() is true - enter the second branch
1040- // 4. CloseFilePtr called - detects file was deleted (bfs ::remove was called)
1040+ // 4. CloseFilePtr called - detects file was deleted (fs ::remove was called)
10411041 // 5. isFileReallyDeleted = true (file physically deleted from filesystem)
10421042 // 6. RemoveReaderFromArrayAndMap called - reader removed from array and map
10431043 // Result: reader completely removed from both array and map
@@ -1137,7 +1137,7 @@ void ModifyHandlerUnittest::TestFileDeletedWithSingleReader_FileNotDeleted() {
11371137 // DON'T delete the file - it still exists on filesystem
11381138 // This simulates the case where DELETE event was received but file still exists
11391139
1140- bool fileExists = bfs ::exists (logPath);
1140+ bool fileExists = fs ::exists (logPath);
11411141 LOG_INFO (sLogger ,
11421142 (" File status" , " file NOT physically deleted" )(" file exists" , fileExists)(
11431143 " fd is open" , reader->IsFileOpened ())(" deleted flag" , reader->IsFileDeleted ()));
@@ -1269,9 +1269,9 @@ void ModifyHandlerUnittest::TestContainerStoppedWithSingleReader_FileReallyDelet
12691269 APSARA_TEST_TRUE_FATAL (reader->IsFileOpened ());
12701270
12711271 // Physically delete the file while fd is still open
1272- bfs ::remove (logPath);
1272+ fs ::remove (logPath);
12731273
1274- bool fileExists = bfs ::exists (logPath);
1274+ bool fileExists = fs ::exists (logPath);
12751275 LOG_INFO (sLogger ,
12761276 (" File status" , " file physically deleted" )(" file exists" , fileExists)(
12771277 " fd is open" , reader->IsFileOpened ())(" container stopped" , reader->IsContainerStopped ()));
@@ -1297,7 +1297,7 @@ void ModifyHandlerUnittest::TestContainerStoppedWithSingleReader_FileReallyDelet
12971297 // 4. IsContainerStopped() is true - enter the third branch
12981298 // 5. UpdateContainerInfo() - still stopped
12991299 // 6. ForceReadLogAndPush called
1300- // 7. CloseFilePtr called - detects file was deleted (bfs ::remove was called)
1300+ // 7. CloseFilePtr called - detects file was deleted (fs ::remove was called)
13011301 // 8. isFileReallyDeleted = true (file physically deleted from filesystem)
13021302 // 9. RemoveReaderFromArrayAndMap called - reader removed from array and map
13031303 // Result: reader completely removed from both array and map
@@ -1407,7 +1407,7 @@ void ModifyHandlerUnittest::TestContainerStoppedWithSingleReader_FileNotDeleted(
14071407 // DON'T delete the file - it still exists on filesystem
14081408 // This simulates the case where container is stopped but file still exists
14091409
1410- bool fileExists = bfs ::exists (logPath);
1410+ bool fileExists = fs ::exists (logPath);
14111411 LOG_INFO (sLogger ,
14121412 (" File status" , " file NOT physically deleted" )(" file exists" , fileExists)(
14131413 " fd is open" , reader->IsFileOpened ())(" container stopped" , reader->IsContainerStopped ()));
0 commit comments