File tree Expand file tree Collapse file tree 4 files changed +35
-12
lines changed
Expand file tree Collapse file tree 4 files changed +35
-12
lines changed Original file line number Diff line number Diff line change 11cb_add_test_executable(memcached_statistics_test
2- prometheus_test.cc
3- collector_test.cc)
2+ collector_test.cc
3+ main.cc
4+ prometheus_test.cc)
45kv_enable_pch(memcached_statistics_test)
56cb_enable_unity_build(memcached_statistics_test)
67target_link_libraries (memcached_statistics_test
78 PRIVATE
89 GTest::gmock
9- GTest::gtest_main
1010 memcached_daemon
1111 memcached_logger
1212 statistics)
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2024-Present Couchbase, Inc.
3+ *
4+ * Use of this software is governed by the Business Source License included
5+ * in the file licenses/BSL-Couchbase.txt. As of the Change Date specified
6+ * in that file, in accordance with the Business Source License, use of this
7+ * software will be governed by the Apache License, Version 2.0, included in
8+ * the file licenses/APL2.txt.
9+ */
10+
11+ #include < daemon/external_auth_manager_thread.h>
12+ #include < daemon/mcaudit.h>
13+ #include < folly/portability/GTest.h>
14+ #include < logger/logger.h>
15+
16+ int main (int argc, char ** argv) {
17+ ::testing::InitGoogleTest (&argc, argv);
18+
19+ cb::logger::createBlackholeLogger ();
20+
21+ externalAuthManager = std::make_unique<ExternalAuthManagerThread>();
22+ initialize_audit ();
23+
24+ int ret = RUN_ALL_TESTS ();
25+
26+ externalAuthManager->shutdown ();
27+ externalAuthManager->waitForState (Couchbase::ThreadState::Zombie);
28+ externalAuthManager.reset ();
29+ shutdown_audit ();
30+ cb::logger::shutdown ();
31+ return ret;
32+ }
Original file line number Diff line number Diff line change 3333#include < chrono>
3434#include < vector>
3535
36- void PrometheusStatTest::SetUpTestSuite () {
37- if (!externalAuthManager) {
38- externalAuthManager = std::make_unique<ExternalAuthManagerThread>();
39- }
40- }
41-
4236PrometheusStatTest::EndpointMetrics PrometheusStatTest::getMetrics () const {
4337 EndpointMetrics metrics;
4438
@@ -53,7 +47,6 @@ PrometheusStatTest::EndpointMetrics PrometheusStatTest::getMetrics() const {
5347TEST_F (PrometheusStatTest, auditStatsNotPerBucket) {
5448 // confirm audit stats are not labelled with a bucket - they are actually
5549 // global stats.
56- initialize_audit ();
5750 auto metrics = getMetrics ();
5851 using namespace cb ::stats;
5952 using namespace ::testing;
Original file line number Diff line number Diff line change @@ -32,7 +32,5 @@ class PrometheusStatTest : public CollectorTest {
3232 StatMap metering;
3333 };
3434
35- static void SetUpTestSuite ();
36-
3735 EndpointMetrics getMetrics () const ;
3836};
You can’t perform that action at this time.
0 commit comments