|
5 | 5 | #include <gmock/gmock.h> |
6 | 6 |
|
7 | 7 | #include "prometheus/client_metric.h" |
| 8 | +#include "prometheus/detail/future_std.h" |
8 | 9 | #include "prometheus/histogram.h" |
9 | 10 |
|
10 | 11 | namespace prometheus { |
@@ -63,22 +64,23 @@ TEST(FamilyTest, add_twice) { |
63 | 64 | ASSERT_EQ(&counter, &counter1); |
64 | 65 | } |
65 | 66 |
|
66 | | -#ifndef NDEBUG |
67 | 67 | TEST(FamilyTest, should_assert_on_invalid_metric_name) { |
68 | 68 | auto create_family_with_invalid_name = []() { |
69 | | - new Family<Counter>("", "empty name", {}); |
| 69 | + return detail::make_unique<Family<Counter>>( |
| 70 | + "", "empty name", std::map<std::string, std::string>{}); |
70 | 71 | }; |
71 | | - EXPECT_DEATH(create_family_with_invalid_name(), ".*"); |
| 72 | + EXPECT_DEBUG_DEATH(create_family_with_invalid_name(), |
| 73 | + ".*Assertion `CheckMetricName.*"); |
72 | 74 | } |
73 | 75 |
|
74 | 76 | TEST(FamilyTest, should_assert_on_invalid_labels) { |
75 | 77 | Family<Counter> family{"total_requests", "Counts all requests", {}}; |
76 | 78 | auto add_metric_with_invalid_label_name = [&family]() { |
77 | 79 | family.Add({{"__invalid", "counter1"}}); |
78 | 80 | }; |
79 | | - EXPECT_DEATH(add_metric_with_invalid_label_name(), ".*"); |
| 81 | + EXPECT_DEBUG_DEATH(add_metric_with_invalid_label_name(), |
| 82 | + ".*Assertion `CheckLabelName.*"); |
80 | 83 | } |
81 | | -#endif |
82 | 84 |
|
83 | 85 | } // namespace |
84 | 86 | } // namespace prometheus |
0 commit comments