Skip to content

Commit

Permalink
chore: add missing tests for u32 i32 that already work in metrics (#215)
Browse files Browse the repository at this point in the history
Signed-off-by: Léo Gillot-Lamure <[email protected]>
  • Loading branch information
navaati authored Jul 17, 2024
1 parent 87442a2 commit 4216fa6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/encoding/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,14 +709,17 @@ mod tests {
use crate::metrics::{counter::Counter, exemplar::CounterWithExemplar};
use pyo3::{prelude::*, types::PyModule};
use std::borrow::Cow;
use std::sync::atomic::AtomicU32;
use std::sync::atomic::{AtomicI32, AtomicU32};

#[test]
fn encode_counter() {
let counter: Counter = Counter::default();
let mut registry = Registry::default();
registry.register("my_counter", "My counter", counter);

let counter_u32 = Counter::<u32, AtomicU32>::default();
registry.register("u32_counter", "Counter::<u32, AtomicU32>", counter_u32);

let mut encoded = String::new();

encode(&mut encoded, &registry).unwrap();
Expand Down Expand Up @@ -780,6 +783,9 @@ mod tests {
let gauge = Gauge::<u32, AtomicU32>::default();
registry.register("u32_gauge", "Gauge::<u32, AtomicU32>", gauge);

let gauge_i32 = Gauge::<i32, AtomicI32>::default();
registry.register("i32_gauge", "Gauge::<i32, AtomicU32>", gauge_i32);

let mut encoded = String::new();

encode(&mut encoded, &registry).unwrap();
Expand Down

0 comments on commit 4216fa6

Please sign in to comment.