fix failpoint macros

This commit is contained in:
Christian Schwarz
2025-07-11 12:46:33 +02:00
parent 8a04a62ecd
commit fc3f55d236
2 changed files with 7 additions and 7 deletions

View File

@@ -16,13 +16,13 @@ macro_rules! fail_point {
}
}
}};
($name:literal, |$var:ident| $body:expr) => {{
($name:literal, $closure:expr) => {{
if cfg!(feature = "testing") {
match $crate::failpoint($name, None).await {
$crate::FailpointResult::Continue => {},
$crate::FailpointResult::Return(value) => {
let $var = value.as_str();
$body
let closure = $closure;
return closure(value.as_str());
},
$crate::FailpointResult::Cancelled => {},
}
@@ -44,13 +44,13 @@ macro_rules! fail_point_with_context {
}
}
}};
($name:literal, $context:expr, |$var:ident| $body:expr) => {{
($name:literal, $context:expr, $closure:expr) => {{
if cfg!(feature = "testing") {
match $crate::failpoint($name, Some($context)).await {
$crate::FailpointResult::Continue => {},
$crate::FailpointResult::Return(value) => {
let $var = value.as_str();
$body
let closure = $closure;
return closure(value.as_str());
},
$crate::FailpointResult::Cancelled => {},
}

View File

@@ -301,7 +301,7 @@ impl PhysicalStorage {
format!("Failed to open tmp wal file {:?}", &tmp_path)
})?;
fail::fail_point!("sk-zero-segment", |_| {
neon_failpoint::fail_point!("sk-zero-segment", |_| {
info!("sk-zero-segment failpoint hit");
Err(anyhow::anyhow!("failpoint: sk-zero-segment"))
});