Skip to content

Commit eb5bf47

Browse files
committed
chore(codspeed): add test to force build
1 parent b95dc4e commit eb5bf47

File tree

1 file changed

+17
-0
lines changed
  • crates/codspeed/src/instrument_hooks

1 file changed

+17
-0
lines changed

crates/codspeed/src/instrument_hooks/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,20 @@ pub use unix_impl::InstrumentHooks;
174174

175175
#[cfg(not(unix))]
176176
pub use other_impl::InstrumentHooks;
177+
178+
#[cfg(test)]
179+
mod tests {
180+
use super::InstrumentHooks;
181+
182+
#[test]
183+
fn test_instrument_hooks() {
184+
let hooks = InstrumentHooks::instance();
185+
assert!(!hooks.is_instrumented() || hooks.start_benchmark().is_ok());
186+
assert!(hooks.set_executed_benchmark("test_uri").is_ok());
187+
assert!(hooks.set_integration("test_integration", "1.0.0").is_ok());
188+
let start = InstrumentHooks::current_timestamp();
189+
let end = start + 1_000_000; // Simulate 1ms later
190+
hooks.add_benchmark_timestamps(start, end);
191+
assert!(!hooks.is_instrumented() || hooks.stop_benchmark().is_ok());
192+
}
193+
}

0 commit comments

Comments
 (0)