将fetch pp cache改成使用vcir结构,跑通apnic全量同步
This commit is contained in:
@@ -7,7 +7,8 @@ use rpki::fetch::rsync::LocalDirRsyncFetcher;
|
||||
use rpki::policy::{Policy, SyncPreference};
|
||||
use rpki::storage::RocksStore;
|
||||
use rpki::sync::rrdp::Fetcher;
|
||||
use rpki::validation::run::{fetch_cache_pp_exists, run_publication_point_once};
|
||||
use rpki::validation::manifest::PublicationPointSource;
|
||||
use rpki::validation::run::run_publication_point_once;
|
||||
|
||||
fn fixture_to_rsync_uri(path: &Path) -> String {
|
||||
let rel = path
|
||||
@@ -40,7 +41,7 @@ impl Fetcher for NeverHttpFetcher {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn e2e_offline_uses_rsync_then_writes_fetch_cache_pp_then_outputs_vrps() {
|
||||
fn e2e_offline_uses_rsync_then_writes_latest_vcir_then_outputs_vrps() {
|
||||
let fixture_dir = Path::new("tests/fixtures/repository/rpki.cernet.net/repo/cernet/0");
|
||||
let rsync_base_uri = "rsync://rpki.cernet.net/repo/cernet/0/";
|
||||
let manifest_path = fixture_dir.join("05FC9C5B88506F7C0D3F862C8895BED67E9F8EBA.mft");
|
||||
@@ -80,14 +81,6 @@ fn e2e_offline_uses_rsync_then_writes_fetch_cache_pp_then_outputs_vrps() {
|
||||
let temp = tempfile::tempdir().expect("tempdir");
|
||||
let store = RocksStore::open(temp.path()).expect("open rocksdb");
|
||||
|
||||
let expected_files = std::fs::read_dir(fixture_dir)
|
||||
.expect("read fixture dir")
|
||||
.filter_map(|e| e.ok())
|
||||
.filter_map(|e| e.metadata().ok().map(|m| (e, m)))
|
||||
.filter(|(_e, m)| m.is_file())
|
||||
.count();
|
||||
assert!(expected_files >= 3, "fixture dir seems incomplete");
|
||||
|
||||
let out = run_publication_point_once(
|
||||
&store,
|
||||
&policy,
|
||||
@@ -105,9 +98,14 @@ fn e2e_offline_uses_rsync_then_writes_fetch_cache_pp_then_outputs_vrps() {
|
||||
)
|
||||
.expect("run publication point once");
|
||||
|
||||
assert!(fetch_cache_pp_exists(&store, &manifest_rsync_uri).expect("exists check"));
|
||||
assert_eq!(out.repo_sync.objects_written, expected_files);
|
||||
|
||||
assert!(
|
||||
store
|
||||
.get_vcir(&manifest_rsync_uri)
|
||||
.expect("get vcir")
|
||||
.is_some()
|
||||
);
|
||||
assert_eq!(out.publication_point_source, PublicationPointSource::Fresh);
|
||||
assert!(out.publication_point_warnings.is_empty());
|
||||
assert!(
|
||||
out.objects.vrps.iter().any(|v| v.asn == 4538),
|
||||
"expected VRPs for AS4538"
|
||||
|
||||
Reference in New Issue
Block a user