aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/tests/common/metricstest.cpp
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@verizonmedia.com>2019-06-21 14:32:05 +0000
committerTor Brede Vekterli <vekterli@verizonmedia.com>2019-06-25 11:08:43 +0000
commit0ec1dddb0e75c235edfc68d72f4471ad186c3399 (patch)
tree254cdda75b06c8453a207933a8d556c1db90b997 /storage/src/tests/common/metricstest.cpp
parenta0d854b6a3fab6fe44b1164c071fc994b331c3bc (diff)
Convert remaining CppUnit tests to GTest
Move base message sender stub out to common test module to avoid artificial dependency from persistence tests to the distributor tests.
Diffstat (limited to 'storage/src/tests/common/metricstest.cpp')
-rw-r--r--storage/src/tests/common/metricstest.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/storage/src/tests/common/metricstest.cpp b/storage/src/tests/common/metricstest.cpp
index 9a9f05d500e..d1421845b81 100644
--- a/storage/src/tests/common/metricstest.cpp
+++ b/storage/src/tests/common/metricstest.cpp
@@ -14,6 +14,7 @@
#include <vespa/config/common/exceptions.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
#include <vespa/vespalib/gtest/gtest.h>
+#include <gmock/gmock.h>
#include <thread>
#include <vespa/log/log.h>
@@ -211,16 +212,12 @@ TEST_F(MetricsTest, filestor_metrics) {
std::ostringstream ost;
framework::HttpUrlPath path("metrics?interval=-1&format=text");
bool retVal = _metricsConsumer->reportStatus(ost, path);
- CPPUNIT_ASSERT_MESSAGE("_metricsConsumer->reportStatus failed", retVal);
+ ASSERT_TRUE(retVal) << "_metricsConsumer->reportStatus failed";
std::string s = ost.str();
- CPPUNIT_ASSERT_MESSAGE("No get statistics in:\n" + s,
- s.find("vds.filestor.alldisks.allthreads.get.sum.count count=240") != std::string::npos);
- CPPUNIT_ASSERT_MESSAGE("No put statistics in:\n" + s,
- s.find("vds.filestor.alldisks.allthreads.put.sum.count count=200") != std::string::npos);
- CPPUNIT_ASSERT_MESSAGE("No remove statistics in:\n" + s,
- s.find("vds.filestor.alldisks.allthreads.remove.sum.count count=120") != std::string::npos);
- CPPUNIT_ASSERT_MESSAGE("No removenotfound stats in:\n" + s,
- s.find("vds.filestor.alldisks.allthreads.remove.sum.not_found count=20") != std::string::npos);
+ EXPECT_THAT(s, HasSubstr("vds.filestor.alldisks.allthreads.get.sum.count count=240"));
+ EXPECT_THAT(s, HasSubstr("vds.filestor.alldisks.allthreads.put.sum.count count=200"));
+ EXPECT_THAT(s, HasSubstr("vds.filestor.alldisks.allthreads.remove.sum.count count=120"));
+ EXPECT_THAT(s, HasSubstr("vds.filestor.alldisks.allthreads.remove.sum.not_found count=20"));
}
#define ASSERT_METRIC(interval, metric, count) \