fix: ignore scan_dir timeout in tests (#3184)

This commit is contained in:
David Knaack 2021-10-30 10:52:48 +02:00 committed by GitHub
parent 265b92bd51
commit 6e6ab9f212
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -359,7 +359,8 @@ impl DirContents {
fs::read_dir(base)?
.enumerate()
.take_while(|(n, _)| {
n & 0xFF != 0 // only check timeout once every 2^8 entries
cfg!(test) // ignore timeout during tests
|| n & 0xFF != 0 // only check timeout once every 2^8 entries
|| start.elapsed() < timeout
})
.filter_map(|(_, entry)| entry.ok())