20260326 完成数据库model迁移;20260327 增加一键replay脚本

This commit is contained in:
2026-03-27 11:24:34 +08:00
parent fe8b89d829
commit cd0ba15286
28 changed files with 1956 additions and 930 deletions

View File

@@ -17,6 +17,15 @@ impl Fetcher for MapFetcher {
}
}
fn assert_current_object(store: &RocksStore, uri: &str, expected: &[u8]) {
assert_eq!(
store
.load_current_object_bytes_by_uri(uri)
.expect("load current object"),
Some(expected.to_vec())
);
}
#[test]
fn notification_parses_and_snapshot_is_applied_and_state_written() {
let notification_xml =
@@ -47,28 +56,18 @@ fn notification_parses_and_snapshot_is_applied_and_state_written() {
.expect("sync");
assert_eq!(published, 2);
let obj1 = store
.get_raw("rsync://example.net/repo/obj1.cer")
.expect("get obj1")
.expect("obj1 exists");
assert_eq!(obj1, b"abc");
assert_current_object(&store, "rsync://example.net/repo/obj1.cer", b"abc");
assert_current_object(&store, "rsync://example.net/repo/obj2.crl", b"def");
let obj2 = store
.get_raw("rsync://example.net/repo/obj2.crl")
.expect("get obj2")
.expect("obj2 exists");
assert_eq!(obj2, b"def");
let state_bytes = store
.get_rrdp_state("https://example.net/rrdp/notification.xml")
.expect("get state")
.expect("state exists");
let state = rpki::sync::rrdp::RrdpState::decode(&state_bytes).expect("decode state");
let source = store
.get_rrdp_source_record("https://example.net/rrdp/notification.xml")
.expect("get source")
.expect("source exists");
assert_eq!(
state.session_id,
source.last_session_id.expect("session id"),
"9df4b597-af9e-4dca-bdda-719cce2c4e28".to_string()
);
assert_eq!(state.serial, 1);
assert_eq!(source.last_serial, Some(1));
}
#[test]