串行验证通过
This commit is contained in:
25
tests/test_fetch_rsync_localdir.rs
Normal file
25
tests/test_fetch_rsync_localdir.rs
Normal file
@@ -0,0 +1,25 @@
|
||||
use std::os::unix::net::UnixListener;
|
||||
|
||||
use rpki::fetch::rsync::{LocalDirRsyncFetcher, RsyncFetcher};
|
||||
|
||||
#[test]
|
||||
fn local_dir_rsync_fetcher_normalizes_base_and_skips_non_files() {
|
||||
let td = tempfile::tempdir().expect("tempdir");
|
||||
let dir = td.path();
|
||||
|
||||
std::fs::write(dir.join("a.txt"), b"a").expect("write file");
|
||||
|
||||
// Create a Unix domain socket entry; metadata().is_file() should be false.
|
||||
let _sock = UnixListener::bind(dir.join("sock")).expect("bind unix socket");
|
||||
|
||||
let fetcher = LocalDirRsyncFetcher::new(dir);
|
||||
|
||||
let out = fetcher
|
||||
.fetch_objects("rsync://example.test/repo") // intentionally no trailing slash
|
||||
.expect("fetch objects");
|
||||
|
||||
let uris: Vec<_> = out.iter().map(|(u, _)| u.as_str()).collect();
|
||||
assert!(uris.contains(&"rsync://example.test/repo/a.txt"));
|
||||
assert!(!uris.iter().any(|u| u.ends_with("/sock")));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user