From 71dbecee118a6bd491bfb87e9fab1aab6f52be32 Mon Sep 17 00:00:00 2001 From: qicosmos Date: Wed, 25 Dec 2024 10:04:19 +0800 Subject: [PATCH] metric expired test --- src/metric/tests/test_metric.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/metric/tests/test_metric.cpp b/src/metric/tests/test_metric.cpp index 2bbf7553b..d0a7560c1 100644 --- a/src/metric/tests/test_metric.cpp +++ b/src/metric/tests/test_metric.cpp @@ -1964,9 +1964,12 @@ TEST_CASE("test metric manager clean expired label") { CHECK(c->label_value_count() == 2); CHECK(summary->label_value_count() == 1); CHECK(h->label_value_count() == 1); - std::this_thread::sleep_for(std::chrono::seconds(2)); + std::this_thread::sleep_for(std::chrono::seconds(3)); c->inc({"/index"}); size_t count = c->label_value_count(); + if (count != 1) { + std::this_thread::sleep_for(std::chrono::seconds(2)); + } CHECK(count == 1); auto ct1 = summary->label_value_count(); CHECK(ct1 == 0);