aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton
diff options
context:
space:
mode:
authorGeir Storli <geirstorli@yahoo.no>2019-01-21 16:06:53 +0100
committerGitHub <noreply@github.com>2019-01-21 16:06:53 +0100
commit8372a883c5a5fa100f88fc9b80824359b5bb70cd (patch)
tree660ce3ef61f060b33bd97eac1185715606b8e2bd /searchcore/src/tests/proton
parent3722c1cdd91fce30d1c2538b2a8749d9321e194b (diff)
parenteb0b1134a66507e3bd8f09793c22cd824d01dff5 (diff)
Merge pull request #8198 from vespa-engine/7
7 MERGEOK
Diffstat (limited to 'searchcore/src/tests/proton')
-rw-r--r--searchcore/src/tests/proton/docsummary/docsummary.cpp10
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp15
-rw-r--r--searchcore/src/tests/proton/metrics/metrics_engine/metrics_engine_test.cpp38
-rw-r--r--searchcore/src/tests/proton/server/CMakeLists.txt8
-rw-r--r--searchcore/src/tests/proton/server/legacy_attribute_metrics_test.cpp55
5 files changed, 14 insertions, 112 deletions
diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp
index c0c706383f6..40c2733d230 100644
--- a/searchcore/src/tests/proton/docsummary/docsummary.cpp
+++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp
@@ -1108,13 +1108,13 @@ Test::requireThatPositionsAreUsed()
EXPECT_EQUAL(1u, rep->docsums[0].docid);
EXPECT_EQUAL(gid1, rep->docsums[0].gid);
EXPECT_TRUE(assertSlime("{sp2:'1047758'"
- ",sp2x:'<position x=\"1002\" y=\"1003\" latlong=\"N0.001003;E0.001002\" />'"
+ ",sp2x:{x:1002, y:1003, latlong:'N0.001003;E0.001002'}"
",ap2:[1047806,1048322]"
- ",ap2x:'<position x=\"1006\" y=\"1007\" latlong=\"N0.001007;E0.001006\" />"
- "<position x=\"1008\" y=\"1009\" latlong=\"N0.001009;E0.001008\" />'"
+ ",ap2x:[{x:1006, y:1007, latlong:'N0.001007;E0.001006'},"
+ "{x:1008, y:1009, latlong:'N0.001009;E0.001008'}]"
",wp2:[{item:1048370,weight:43},{item:1048382,weight:44}]"
- ",wp2x:'<position x=\"1012\" y=\"1013\" latlong=\"N0.001013;E0.001012\" />"
- "<position x=\"1014\" y=\"1015\" latlong=\"N0.001015;E0.001014\" />'}",
+ ",wp2x:[{ x:1012, y:1013, latlong:'N0.001013;E0.001012'},"
+ "{ x:1014, y:1015, latlong:'N0.001015;E0.001014'}]}",
*rep, 0, false));
}
diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
index 45c9ae71bc9..32cf0584768 100644
--- a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
@@ -7,9 +7,7 @@
#include <vespa/searchcore/proton/common/hw_info.h>
#include <vespa/searchcore/proton/initializer/task_runner.h>
#include <vespa/searchcore/proton/metrics/attribute_metrics.h>
-#include <vespa/searchcore/proton/metrics/attribute_metrics_collection.h>
-#include <vespa/searchcore/proton/metrics/documentdb_metrics_collection.h>
-#include <vespa/searchcore/proton/metrics/legacy_attribute_metrics.h>
+#include <vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h>
#include <vespa/searchcore/proton/metrics/metricswireservice.h>
#include <vespa/searchcore/proton/reference/i_document_db_reference_resolver.h>
#include <vespa/searchcore/proton/reprocessing/i_reprocessing_task.h>
@@ -108,7 +106,7 @@ struct MyMetricsWireService : public DummyWireService
{
std::set<vespalib::string> _attributes;
MyMetricsWireService() : _attributes() {}
- virtual void addAttribute(const AttributeMetricsCollection &, LegacyAttributeMetrics *, const std::string &name) override {
+ virtual void addAttribute(AttributeMetrics &, const std::string &name) override {
_attributes.insert(name);
}
};
@@ -142,7 +140,7 @@ struct MyStoreOnlyContext
MySyncProxy _syncProxy;
MyGetSerialNum _getSerialNum;
MyFileHeaderContext _fileHeader;
- DocumentDBMetricsCollection _metrics;
+ DocumentDBTaggedMetrics _metrics;
std::mutex _configMutex;
HwInfo _hwInfo;
StoreOnlyContext _ctx;
@@ -182,8 +180,6 @@ struct MyFastAccessContext
{
MyStoreOnlyContext _storeOnlyCtx;
AttributeMetrics _attributeMetrics;
- LegacyAttributeMetrics _legacyAttributeMetrics;
- AttributeMetricsCollection _attributeMetricsCollection;
MyMetricsWireService _wireService;
FastAccessContext _ctx;
MyFastAccessContext(IThreadingService &writeService,
@@ -203,10 +199,9 @@ MyFastAccessContext::MyFastAccessContext(IThreadingService &writeService, Thread
std::shared_ptr<BucketDBOwner> bucketDB,
IBucketDBHandlerInitializer & bucketDBHandlerInitializer)
: _storeOnlyCtx(writeService, summaryExecutor, bucketDB, bucketDBHandlerInitializer),
- _attributeMetrics(NULL), _legacyAttributeMetrics(NULL),
- _attributeMetricsCollection(_attributeMetrics, _legacyAttributeMetrics),
+ _attributeMetrics(NULL),
_wireService(),
- _ctx(_storeOnlyCtx._ctx, _attributeMetricsCollection, NULL, _wireService)
+ _ctx(_storeOnlyCtx._ctx, _attributeMetrics, _wireService)
{}
MyFastAccessContext::~MyFastAccessContext() = default;
diff --git a/searchcore/src/tests/proton/metrics/metrics_engine/metrics_engine_test.cpp b/searchcore/src/tests/proton/metrics/metrics_engine/metrics_engine_test.cpp
index e10fd41ffed..c798de01804 100644
--- a/searchcore/src/tests/proton/metrics/metrics_engine/metrics_engine_test.cpp
+++ b/searchcore/src/tests/proton/metrics/metrics_engine/metrics_engine_test.cpp
@@ -1,12 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-// Unit tests for metrics_engine.
#include <vespa/metrics/metricset.h>
-#include <vespa/searchcore/proton/metrics/attribute_metrics_collection.h>
#include <vespa/searchcore/proton/metrics/attribute_metrics.h>
-#include <vespa/searchcore/proton/metrics/documentdb_metrics_collection.h>
-
-
#include <vespa/searchcore/proton/metrics/metrics_engine.h>
#include <vespa/vespalib/testkit/testapp.h>
@@ -23,56 +18,31 @@ struct AttributeMetricsFixture {
MetricsEngine engine;
DummyMetricSet parent;
AttributeMetrics metrics;
- LegacyAttributeMetrics legacyMetrics;
- LegacyAttributeMetrics totalLegacyMetrics;
AttributeMetricsFixture()
: engine(),
parent("parent"),
- metrics(&parent),
- legacyMetrics(nullptr),
- totalLegacyMetrics(nullptr)
+ metrics(&parent)
{}
void addAttribute(const vespalib::string &attrName) {
- engine.addAttribute(AttributeMetricsCollection(metrics, legacyMetrics), &totalLegacyMetrics, attrName);
+ engine.addAttribute(metrics, attrName);
}
void removeAttribute(const vespalib::string &attrName) {
- engine.removeAttribute(AttributeMetricsCollection(metrics, legacyMetrics), &totalLegacyMetrics, attrName);
+ engine.removeAttribute(metrics, attrName);
}
void cleanAttributes() {
- engine.cleanAttributes(AttributeMetricsCollection(metrics, legacyMetrics), &totalLegacyMetrics);
+ engine.cleanAttributes(metrics);
}
void assertRegisteredMetrics(size_t expNumMetrics) const {
EXPECT_EQUAL(expNumMetrics, parent.getRegisteredMetrics().size());
- EXPECT_EQUAL(expNumMetrics, legacyMetrics.list.getRegisteredMetrics().size());
- EXPECT_EQUAL(expNumMetrics, totalLegacyMetrics.list.getRegisteredMetrics().size());
}
void assertMetricsExists(const vespalib::string &attrName) {
EXPECT_TRUE(metrics.get(attrName) != nullptr);
- EXPECT_TRUE(legacyMetrics.list.get(attrName) != nullptr);
- EXPECT_TRUE(totalLegacyMetrics.list.get(attrName) != nullptr);
}
void assertMetricsNotExists(const vespalib::string &attrName) {
EXPECT_TRUE(metrics.get(attrName) == nullptr);
- EXPECT_TRUE(legacyMetrics.list.get(attrName) == nullptr);
- EXPECT_TRUE(totalLegacyMetrics.list.get(attrName) == nullptr);
}
};
-TEST("require that the metric proton.diskusage is the sum of the documentDB diskusage metrics")
-{
- MetricsEngine metrics_engine;
-
- DocumentDBMetricsCollection metrics1("type1", 1);
- DocumentDBMetricsCollection metrics2("type2", 1);
- metrics1.getLegacyMetrics().index.diskUsage.addValue(100);
- metrics2.getLegacyMetrics().index.diskUsage.addValue(1000);
-
- metrics_engine.addDocumentDBMetrics(metrics1);
- metrics_engine.addDocumentDBMetrics(metrics2);
-
- EXPECT_EQUAL(1100, metrics_engine.legacyRoot().diskUsage.getLongValue("value"));
-}
-
TEST_F("require that attribute metrics can be added", AttributeMetricsFixture)
{
TEST_DO(f.assertRegisteredMetrics(0));
diff --git a/searchcore/src/tests/proton/server/CMakeLists.txt b/searchcore/src/tests/proton/server/CMakeLists.txt
index 31f67bdd0ac..51595daf407 100644
--- a/searchcore/src/tests/proton/server/CMakeLists.txt
+++ b/searchcore/src/tests/proton/server/CMakeLists.txt
@@ -1,12 +1,4 @@
# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchcore_legacy_attribute_metrics_test_app TEST
- SOURCES
- legacy_attribute_metrics_test.cpp
- DEPENDS
- searchcore_server
- searchcore_proton_metrics
-)
-vespa_add_test(NAME searchcore_legacy_attribute_metrics_test_app COMMAND searchcore_legacy_attribute_metrics_test_app)
vespa_add_executable(searchcore_documentretriever_test_app TEST
SOURCES
documentretriever_test.cpp
diff --git a/searchcore/src/tests/proton/server/legacy_attribute_metrics_test.cpp b/searchcore/src/tests/proton/server/legacy_attribute_metrics_test.cpp
deleted file mode 100644
index bf68deafb96..00000000000
--- a/searchcore/src/tests/proton/server/legacy_attribute_metrics_test.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
-LOG_SETUP("attribute_metrics_test");
-#include <vespa/vespalib/testkit/testapp.h>
-
-#include <vespa/searchcore/proton/metrics/legacy_attribute_metrics.h>
-
-using namespace proton;
-
-class Test : public vespalib::TestApp
-{
-public:
- int Main() override;
-};
-
-int
-Test::Main()
-{
- TEST_INIT("attribute_metrics_test");
- {
- LegacyAttributeMetrics attrMetrics(0);
- EXPECT_EQUAL(0u, attrMetrics.list.release().size());
- {
- LegacyAttributeMetrics::List::Entry *e1 = attrMetrics.list.add("foo");
- LegacyAttributeMetrics::List::Entry *e2 = attrMetrics.list.add("bar");
- LegacyAttributeMetrics::List::Entry *e3 = attrMetrics.list.add("foo");
- EXPECT_TRUE(e1 != nullptr);
- EXPECT_TRUE(e2 != nullptr);
- EXPECT_TRUE(e3 == nullptr);
- }
- {
- const LegacyAttributeMetrics &constMetrics = attrMetrics;
- LegacyAttributeMetrics::List::Entry *e1 = constMetrics.list.get("foo");
- LegacyAttributeMetrics::List::Entry *e2 = constMetrics.list.get("bar");
- LegacyAttributeMetrics::List::Entry *e3 = constMetrics.list.get("baz");
- EXPECT_TRUE(e1 != nullptr);
- EXPECT_TRUE(e2 != nullptr);
- EXPECT_TRUE(e3 == nullptr);
- }
- EXPECT_EQUAL(2u, attrMetrics.list.release().size());
- {
- const LegacyAttributeMetrics &constMetrics = attrMetrics;
- LegacyAttributeMetrics::List::Entry *e1 = constMetrics.list.get("foo");
- LegacyAttributeMetrics::List::Entry *e2 = constMetrics.list.get("bar");
- LegacyAttributeMetrics::List::Entry *e3 = constMetrics.list.get("baz");
- EXPECT_TRUE(e1 == nullptr);
- EXPECT_TRUE(e2 == nullptr);
- EXPECT_TRUE(e3 == nullptr);
- }
- EXPECT_EQUAL(0u, attrMetrics.list.release().size());
- }
- TEST_DONE();
-}
-
-TEST_APPHOOK(Test);