mirror of
https://github.com/nestriness/cdc-file-transfer.git
synced 2026-05-01 18:13:06 +03: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.
|
// Wait for events, until they are processed.
|
||||||
while (modified_files.size() < number_of_files) {
|
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())
|
for (const auto& [path, info] : watcher_.GetModifiedFiles())
|
||||||
modified_files.insert_or_assign(path, info);
|
modified_files.insert_or_assign(path, info);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user