omaha_client/metrics/
stub.rs1use crate::metrics::{Metrics, MetricsReporter};
10use anyhow::Error;
11use tracing::info;
12
13#[derive(Debug)]
15pub struct StubMetricsReporter;
16
17impl MetricsReporter for StubMetricsReporter {
18 fn report_metrics(&mut self, metrics: Metrics) -> Result<(), Error> {
19 info!("Received request to report metrics: {:?}", metrics);
20 Ok(())
21 }
22}
23
24#[cfg(test)]
25mod tests {
26 use super::*;
27 use std::time::Duration;
28
29 #[test]
30 fn test_stub_metrics_reporter() {
31 let mut stub = StubMetricsReporter;
32 let result = stub.report_metrics(Metrics::UpdateCheckResponseTime {
33 response_time: Duration::from_secs(2),
34 successful: true,
35 });
36 assert!(result.is_ok(), "{result:?}");
37 }
38}