20260410 完成五个rir 基于cir的三方回放,raw by hash 独立db,发现内存占用大,连续大rir 录制发生oom
This commit is contained in:
@@ -2,8 +2,8 @@ use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
|
||||
use rpki::cir::{
|
||||
encode_cir, materialize_cir, CanonicalInputRepresentation, CirHashAlgorithm, CirObject, CirTal,
|
||||
CIR_VERSION_V1,
|
||||
CIR_VERSION_V1, CanonicalInputRepresentation, CirHashAlgorithm, CirObject, CirTal, encode_cir,
|
||||
materialize_cir,
|
||||
};
|
||||
|
||||
fn apnic_tal_path() -> PathBuf {
|
||||
@@ -59,7 +59,11 @@ fn write_static(root: &Path, date: &str, bytes: &[u8]) {
|
||||
std::fs::write(dir.join(hash), bytes).expect("write static object");
|
||||
}
|
||||
|
||||
fn prepare_reference_ccr(work: &Path, cir: &CanonicalInputRepresentation, mirror_root: &Path) -> PathBuf {
|
||||
fn prepare_reference_ccr(
|
||||
work: &Path,
|
||||
cir: &CanonicalInputRepresentation,
|
||||
mirror_root: &Path,
|
||||
) -> PathBuf {
|
||||
let reference_ccr = work.join("reference.ccr");
|
||||
let rpki_bin = env!("CARGO_BIN_EXE_rpki");
|
||||
let wrapper = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("scripts/cir/cir-rsync-wrapper");
|
||||
@@ -91,7 +95,11 @@ fn prepare_reference_ccr(work: &Path, cir: &CanonicalInputRepresentation, mirror
|
||||
])
|
||||
.output()
|
||||
.expect("run reference rpki");
|
||||
assert!(out.status.success(), "stderr={}", String::from_utf8_lossy(&out.stderr));
|
||||
assert!(
|
||||
out.status.success(),
|
||||
"stderr={}",
|
||||
String::from_utf8_lossy(&out.stderr)
|
||||
);
|
||||
reference_ccr
|
||||
}
|
||||
|
||||
@@ -116,7 +124,8 @@ fn cir_replay_matrix_script_matches_reference_for_all_participants() {
|
||||
materialize_cir(&cir, &static_root, &mirror_root, true).expect("materialize");
|
||||
let reference_ccr = prepare_reference_ccr(td.path(), &cir, &mirror_root);
|
||||
|
||||
let script = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("scripts/cir/run_cir_replay_matrix.sh");
|
||||
let script =
|
||||
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("scripts/cir/run_cir_replay_matrix.sh");
|
||||
let out = Command::new(script)
|
||||
.args([
|
||||
"--cir",
|
||||
@@ -134,13 +143,19 @@ fn cir_replay_matrix_script_matches_reference_for_all_participants() {
|
||||
])
|
||||
.output()
|
||||
.expect("run cir matrix script");
|
||||
assert!(out.status.success(), "stderr={}", String::from_utf8_lossy(&out.stderr));
|
||||
assert!(
|
||||
out.status.success(),
|
||||
"stderr={}",
|
||||
String::from_utf8_lossy(&out.stderr)
|
||||
);
|
||||
|
||||
let summary: serde_json::Value =
|
||||
serde_json::from_slice(&std::fs::read(out_dir.join("summary.json")).expect("read summary"))
|
||||
.expect("parse summary");
|
||||
assert_eq!(summary["allMatch"], true);
|
||||
let participants = summary["participants"].as_array().expect("participants array");
|
||||
let participants = summary["participants"]
|
||||
.as_array()
|
||||
.expect("participants array");
|
||||
assert_eq!(participants.len(), 3);
|
||||
for participant in participants {
|
||||
assert_eq!(participant["exitCode"], 0);
|
||||
|
||||
Reference in New Issue
Block a user