#![cfg(all(target_os = "linux", feature = "fuse"))]
use std::{
fs,
time::{Duration, Instant},
};
use mount::{ContentAddressedMount, FuseShell};
use repo::Repository;
use tempfile::TempDir;
#[test]
#[ignore = "requires FUSE on host; opt-in via --ignored"]
fn fuse_mount_serves_blob_content() {
let repo_dir = TempDir::new().unwrap();
let repo = Repository::init_default(repo_dir.path()).unwrap();
fs::write(repo_dir.path().join("hello.txt"), b"world").unwrap();
repo.snapshot(Some("fixture".into()), None).unwrap();
let mount = ContentAddressedMount::new(repo, "main").unwrap();
let mountpoint = TempDir::new().unwrap();
let session = FuseShell::new(mount)
.mount_background(mountpoint.path())
.expect("mount session");
let target = mountpoint.path().join("hello.txt");
let deadline = Instant::now() + Duration::from_secs(5);
while !target.exists() && Instant::now() < deadline {
std::thread::sleep(Duration::from_millis(50));
}
let read = fs::read_to_string(&target).expect("read mounted file");
assert_eq!(read, "world");
drop(session); }