message: Add unit test for when deleting fails
  Test that when delete fails, we still keep
  the file as managed.
  Remove the error log for windows, as failing
  to delete is expected.
diff: @@ -86,8 +86,10 @@ impl ManagedDirectory {
  managed_has_changed |= managed_paths_write.remove(&file_to_delete);
  }
  FileError::IOError(_) => {
  + if !cfg!(target_os = "windows") {
  error!("Failed to delete {:?}", file_to_delete);
  }
  + }
  }
  @@ -244,4 +246,33 @@ mod tests {
  }
  }
  + #[test]
  + fn test_managed_directory_gc_while_mmapped() {
  + let tempdir = TempDir::new("index").unwrap();
  + let tempdir_path = PathBuf::from(tempdir.path());
  + let living_files = HashSet::new();
  +
  + let mmap_directory = MmapDirectory::open(&tempdir_path).unwrap();
  + let mut managed_directory = ManagedDirectory::new(mmap_directory).unwrap();
  + managed_directory.atomic_write(*TEST_PATH1, &vec!(0u8,1u8)).unwrap();
  + assert!(managed_directory.exists(*TEST_PATH1));
  +
  + let _mmap_read = managed_directory.open_read(*TEST_PATH1).unwrap();
  + managed_directory.garbage_collect(living_files.clone());
  + if cfg!(target_os = "windows") {
  + // On Windows, gc should try and fail the file as it is mmapped.
  + assert!(managed_directory.exists(*TEST_PATH1));
  + // unmap should happen here.
  + drop(_mmap_read);
  + // The file should still be in the list of managed file and
  + // eventually be deleted once mmap is released.
  + managed_directory.garbage_collect(living_files);
  + assert!(!managed_directory.exists(*TEST_PATH1));
  + }
  + else {
  + assert!(!managed_directory.exists(*TEST_PATH1));
  + }
  +
  + }
  +
  }
  