mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-08 22:12:56 +00:00
fix failpoint macros
This commit is contained in:
@@ -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 => {},
|
||||
}
|
||||
|
||||
@@ -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"))
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user