mirror of
https://github.com/nestriness/cdc-file-transfer.git
synced 2026-01-30 14:45:37 +02:00
Fix possible indefinite loop in FileWatcherTest (#23)
The test FileWatcherTest/FileWatcherParameterizedTest.RecreateWatchedDir/ReadDirectoryChangesExW is flaky. This CL doesn't fix the root cause, but it fixes the indefinite spin in GetChangedFiles when there is no file change.
This commit is contained in:
@@ -140,7 +140,11 @@ class FileWatcherParameterizedTest : public ::testing::TestWithParam<bool> {
|
||||
|
||||
// Wait for events, until they are processed.
|
||||
while (modified_files.size() < number_of_files) {
|
||||
EXPECT_TRUE(WaitForChange());
|
||||
if (!WaitForChange()) {
|
||||
LOG_ERROR("No change detected after %s",
|
||||
absl::FormatDuration(kWaitTimeout));
|
||||
return modified_files;
|
||||
}
|
||||
for (const auto& [path, info] : watcher_.GetModifiedFiles())
|
||||
modified_files.insert_or_assign(path, info);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user