From 567a25cb75a5cc23e8f7ce3dfe2a79f47461140b Mon Sep 17 00:00:00 2001 From: Yaroslav Dynnikov <yaroslav.dynnikov@gmail.com> Date: Mon, 11 Dec 2023 17:31:11 +0300 Subject: [PATCH] chore: more error injection logs --- src/error_injection.rs | 9 ++++++--- src/luamod.rs | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/error_injection.rs b/src/error_injection.rs index 0f6ef7fafc..8cc3a6a8ee 100644 --- a/src/error_injection.rs +++ b/src/error_injection.rs @@ -1,3 +1,4 @@ +use crate::tlog; use std::collections::HashSet; static mut INJECTED_ERRORS: Option<HashSet<String>> = None; @@ -9,7 +10,9 @@ pub fn enable(error: &str, enable: bool) { let injected_errors = injected_errors.get_or_insert_with(Default::default); if enable { injected_errors.insert(error.into()); + tlog!(Info, "ERROR INJECTION '{error}': fused"); } else { + tlog!(Info, "ERROR INJECTION '{error}': defused"); injected_errors.remove(error); } } @@ -38,7 +41,7 @@ macro_rules! error_injection { #[rustfmt::skip] if $crate::error_injection::is_enabled($error) { $crate::tlog!(Info, "################################################################"); - $crate::tlog!(Info, "ERROR INJECTED '{}': EXITING", $error); + $crate::tlog!(Info, "ERROR INJECTION '{}': EXITING", $error); $crate::tlog!(Info, "################################################################"); $crate::tarantool::exit(69); }; @@ -48,7 +51,7 @@ macro_rules! error_injection { #[rustfmt::skip] if $crate::error_injection::is_enabled(error) { $crate::tlog!(Info, "################################################################"); - $crate::tlog!(Info, "ERROR INJECTED '{}': BLOCKING", error); + $crate::tlog!(Info, "ERROR INJECTION '{}': BLOCKING", error); $crate::tlog!(Info, "################################################################"); while $crate::error_injection::is_enabled(error) { @@ -56,7 +59,7 @@ macro_rules! error_injection { } $crate::tlog!(Info, "################################################################"); - $crate::tlog!(Info, "ERROR UNINJECTED '{}': UNBLOCKING", error); + $crate::tlog!(Info, "ERROR INJECTION '{}': UNBLOCKING", error); $crate::tlog!(Info, "################################################################"); }; }}; diff --git a/src/luamod.rs b/src/luamod.rs index 1e798d3236..f8c577654c 100644 --- a/src/luamod.rs +++ b/src/luamod.rs @@ -1462,8 +1462,11 @@ pub(crate) fn setup(args: &args::Run) { 1. error (string) 2. enable (bool) "}, - tlua::Function::new(|error: String, enable: bool| { - crate::error_injection::enable(&error, enable); - }), + { + tlog!(Info, "error injection enabled"); + tlua::Function::new(|error: String, enable: bool| { + crate::error_injection::enable(&error, enable); + }) + }, ); } -- GitLab