Skip to content

Commit e56c09a

Browse files
committed
more case
1 parent e1caf26 commit e56c09a

File tree

1 file changed

+34
-0
lines changed
  • opentelemetry-sdk/src/metrics

1 file changed

+34
-0
lines changed

opentelemetry-sdk/src/metrics/mod.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,6 +1514,40 @@ mod tests {
15141514
.await;
15151515
}
15161516

1517+
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
1518+
async fn view_test_match_unit() {
1519+
test_view_customization(
1520+
|i| {
1521+
if i.unit == "my_unit" {
1522+
Some(Stream::new().unit("my_unit_new"))
1523+
} else {
1524+
None
1525+
}
1526+
},
1527+
"my_counter",
1528+
"my_unit_new",
1529+
"my_description",
1530+
)
1531+
.await;
1532+
}
1533+
1534+
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
1535+
async fn view_test_match_none() {
1536+
test_view_customization(
1537+
|i| {
1538+
if i.name == "not_expected_to_match" {
1539+
Some(Stream::new())
1540+
} else {
1541+
None
1542+
}
1543+
},
1544+
"my_counter",
1545+
"my_unit",
1546+
"my_description",
1547+
)
1548+
.await;
1549+
}
1550+
15171551
/// Helper function to test view customizations
15181552
async fn test_view_customization<F>(
15191553
view_function: F,

0 commit comments

Comments
 (0)