test(startup): encode observation digests with shared hex helper

This commit is contained in:
overtrue
2026-09-06 15:10:28 +08:00
parent 44333e136b
commit fdb3d9f9bb
3 changed files with 4 additions and 4 deletions
@@ -399,7 +399,7 @@ mod tests {
}
hash.update(&buf[..len]);
}
Ok(format!("{:x}", hash.finalize()))
Ok(rustfs_utils::crypto::hex(hash.finalize()))
}
fn startup_cas_git(args: &[&str]) -> std::io::Result<String> {
+2 -2
View File
@@ -5519,7 +5519,7 @@ where
let observation = std::env::var_os("RUSTFS_E2E_STARTUP_CAS_NONCE").map(|_| {
serde_json::json!({
"kind": "cas", "object": object, "phase": phase,
"payload_sha256": format!("{:x}", Sha256::digest(&data)),
"payload_sha256": rustfs_utils::crypto::hex(Sha256::digest(&data)),
"if_match": opts.http_preconditions.as_ref().and_then(|p| p.if_match.as_deref()),
"if_none_match": opts.http_preconditions.as_ref().and_then(|p| p.if_none_match.as_deref()),
"tail_drained": opts.write_completion == crate::object_api::WriteCompletion::TailDrained,
@@ -6843,7 +6843,7 @@ impl PoolMeta {
#[cfg(feature = "e2e-test-hooks")]
startup_cas_test_observe(serde_json::json!({
"kind": "confirmed", "object": POOL_META_NAME,
"payload_sha256": format!("{:x}", Sha256::digest(&durable)),
"payload_sha256": rustfs_utils::crypto::hex(Sha256::digest(&durable)),
"generation": confirmed.revision.generation,
"transaction_id": confirmed.revision.transaction_id,
}));
+1 -1
View File
@@ -56,7 +56,7 @@ fn startup_cas_rename_observation(
"target": match target { LocalMutationTarget::Ready(_) => "ready", LocalMutationTarget::Bootstrap(_) => "bootstrap", LocalMutationTarget::Unbound => "unbound" },
"disk": request.disk, "src_volume": request.src_volume, "src_path": request.src_path,
"dst_volume": request.dst_volume, "dst_path": request.dst_path,
"body_sha256": format!("{:x}", Sha256::digest(body)),
"body_sha256": rustfs_utils::crypto::hex(Sha256::digest(body)),
"etag": file_info.metadata.get("etag"),
"mod_time": file_info.mod_time.map(|time| time.unix_timestamp_nanos().to_string()),
}))