File tree 4 files changed +35
-12
lines changed
4 files changed +35
-12
lines changed Original file line number Diff line number Diff line change 1
1
cb_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)
4
5
kv_enable_pch(memcached_statistics_test)
5
6
cb_enable_unity_build(memcached_statistics_test)
6
7
target_link_libraries (memcached_statistics_test
7
8
PRIVATE
8
9
GTest::gmock
9
- GTest::gtest_main
10
10
memcached_daemon
11
11
memcached_logger
12
12
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 33
33
#include < chrono>
34
34
#include < vector>
35
35
36
- void PrometheusStatTest::SetUpTestSuite () {
37
- if (!externalAuthManager) {
38
- externalAuthManager = std::make_unique<ExternalAuthManagerThread>();
39
- }
40
- }
41
-
42
36
PrometheusStatTest::EndpointMetrics PrometheusStatTest::getMetrics () const {
43
37
EndpointMetrics metrics;
44
38
@@ -53,7 +47,6 @@ PrometheusStatTest::EndpointMetrics PrometheusStatTest::getMetrics() const {
53
47
TEST_F (PrometheusStatTest, auditStatsNotPerBucket) {
54
48
// confirm audit stats are not labelled with a bucket - they are actually
55
49
// global stats.
56
- initialize_audit ();
57
50
auto metrics = getMetrics ();
58
51
using namespace cb ::stats;
59
52
using namespace ::testing;
Original file line number Diff line number Diff line change @@ -32,7 +32,5 @@ class PrometheusStatTest : public CollectorTest {
32
32
StatMap metering;
33
33
};
34
34
35
- static void SetUpTestSuite ();
36
-
37
35
EndpointMetrics getMetrics () const ;
38
36
};
You can’t perform that action at this time.
0 commit comments