aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-03-01 05:42:38 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-03-03 11:39:52 +0000
commit64c08801e0ac5094fb111c5fe3ea63cc7597506d (patch)
treea34f000d2743b864e22e322d9ce94b655c86ac97 /searchcore/src/tests/proton
parent6f78fdc9750ad3ac03b14166b6838c628487458c (diff)
Let the InvocationService drive the clock instead of having its own ticking loop.
Also use sleep_until to get intervals indendant of invoke cost as long as cost is within interval. This also also saves a clock sample and simplifies implementation.
Diffstat (limited to 'searchcore/src/tests/proton')
-rw-r--r--searchcore/src/tests/proton/docsummary/docsummary.cpp4
-rw-r--r--searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp7
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp9
-rw-r--r--searchcore/src/tests/proton/documentdb/documentdb_test.cpp6
-rw-r--r--searchcore/src/tests/proton/matching/matching_test.cpp6
-rw-r--r--searchcore/src/tests/proton/matching/request_context/request_context_test.cpp5
6 files changed, 18 insertions, 19 deletions
diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp
index faea1cc8b7c..ef8dc17dc0e 100644
--- a/searchcore/src/tests/proton/docsummary/docsummary.cpp
+++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp
@@ -183,7 +183,6 @@ public:
storage::spi::dummy::DummyBucketExecutor _bucketExecutor;
bool _mkdirOk;
matching::QueryLimiter _queryLimiter;
- vespalib::Clock _clock;
DummyWireService _dummy;
::config::DirSpec _spec;
DocumentDBConfigHelper _configMgr;
@@ -204,7 +203,6 @@ public:
_bucketExecutor(2),
_mkdirOk(FastOS_File::MakeDirectory("tmpdb")),
_queryLimiter(),
- _clock(),
_dummy(),
_spec(TEST_PATH("")),
_configMgr(_spec, getDocTypeName()),
@@ -227,7 +225,7 @@ public:
if (! FastOS_File::MakeDirectory((std::string("tmpdb/") + docTypeName).c_str())) {
LOG_ABORT("should not be reached");
}
- _ddb = DocumentDB::create("tmpdb", _configMgr.getConfig(), "tcp/localhost:9013", _queryLimiter, _clock,
+ _ddb = DocumentDB::create("tmpdb", _configMgr.getConfig(), "tcp/localhost:9013", _queryLimiter,
DocTypeName(docTypeName), makeBucketSpace(), *b->getProtonConfigSP(), *this,
_shared_service, _bucketExecutor, _tls, _dummy, _fileHeaderContext,
std::make_unique<MemoryConfigStore>(),
diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
index 0e9eb926514..9e77047e578 100644
--- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
@@ -28,6 +28,7 @@
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/util/size_literals.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
+#include <vespa/vespalib/util/testclock.h>
using namespace config;
using namespace document;
@@ -146,7 +147,7 @@ struct MyDocumentDBReferenceResolver : public IDocumentDBReferenceResolver {
struct Fixture
{
- vespalib::Clock _clock;
+ vespalib::TestClock _clock;
matching::QueryLimiter _queryLimiter;
EmptyConstantValueFactory _constantValueFactory;
ConstantValueRepo _constantValueRepo;
@@ -175,7 +176,7 @@ Fixture::Fixture()
vespalib::mkdir(BASE_DIR);
initViewSet(_views);
_configurer = std::make_unique<Configurer>(_views._summaryMgr, _views.searchView, _views.feedView, _queryLimiter,
- _constantValueRepo, _clock, "test", 0);
+ _constantValueRepo, _clock.clock(), "test", 0);
}
Fixture::~Fixture() = default;
@@ -184,7 +185,7 @@ Fixture::initViewSet(ViewSet &views)
{
using IndexManager = proton::index::IndexManager;
using IndexConfig = proton::index::IndexConfig;
- auto matchers = std::make_shared<Matchers>(_clock, _queryLimiter, _constantValueRepo);
+ auto matchers = std::make_shared<Matchers>(_clock.clock(), _queryLimiter, _constantValueRepo);
auto indexMgr = make_shared<IndexManager>(BASE_DIR, IndexConfig(searchcorespi::index::WarmupConfig(), 2, 0), Schema(), 1,
views._reconfigurer, views._service.write(), _summaryExecutor,
TuneFileIndexManager(), TuneFileAttributes(), views._fileHeaderContext);
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 27636324835..68a92c73b44 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
@@ -35,6 +35,7 @@
#include <vespa/vespalib/util/size_literals.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/vespalib/util/destructor_callbacks.h>
+#include <vespa/vespalib/util/testclock.h>
#include <vespa/config/subscription/sourcespec.h>
using namespace cloud::config::filedistribution;
@@ -215,9 +216,9 @@ struct MySearchableConfig
struct MySearchableContext
{
MyFastAccessContext _fastUpdCtx;
- QueryLimiter _queryLimiter;
- vespalib::Clock _clock;
- SearchableContext _ctx;
+ QueryLimiter _queryLimiter;
+ vespalib::TestClock _clock;
+ SearchableContext _ctx;
MySearchableContext(IThreadingService &writeService,
std::shared_ptr<bucketdb::BucketDBOwner> bucketDB,
IBucketDBHandlerInitializer & bucketDBHandlerInitializer);
@@ -236,7 +237,7 @@ MySearchableContext::MySearchableContext(IThreadingService &writeService,
IBucketDBHandlerInitializer & bucketDBHandlerInitializer)
: _fastUpdCtx(writeService, bucketDB, bucketDBHandlerInitializer),
_queryLimiter(), _clock(),
- _ctx(_fastUpdCtx._ctx, _queryLimiter, _clock, writeService.shared())
+ _ctx(_fastUpdCtx._ctx, _queryLimiter, _clock.clock(), writeService.shared())
{}
MySearchableContext::~MySearchableContext() = default;
diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
index c6a8df79a5e..1f3be7511da 100644
--- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
@@ -127,7 +127,6 @@ struct Fixture : public FixtureBase {
DummyFileHeaderContext _fileHeaderContext;
TransLogServer _tls;
matching::QueryLimiter _queryLimiter;
- vespalib::Clock _clock;
std::unique_ptr<ConfigStore> make_config_store();
Fixture();
@@ -151,8 +150,7 @@ Fixture::Fixture(bool file_config)
_db(),
_fileHeaderContext(),
_tls(_shared_service.transport(), "tmp", 9014, ".", _fileHeaderContext),
- _queryLimiter(),
- _clock()
+ _queryLimiter()
{
auto documenttypesConfig = std::make_shared<DocumenttypesConfig>();
DocumentType docType("typea", 0);
@@ -167,7 +165,7 @@ Fixture::Fixture(bool file_config)
tuneFileDocumentDB, HwInfo());
mgr.forwardConfig(b);
mgr.nextGeneration(_shared_service.transport(), 0ms);
- _db = DocumentDB::create(".", mgr.getConfig(), "tcp/localhost:9014", _queryLimiter, _clock, DocTypeName("typea"),
+ _db = DocumentDB::create(".", mgr.getConfig(), "tcp/localhost:9014", _queryLimiter, DocTypeName("typea"),
makeBucketSpace(),
*b->getProtonConfigSP(), _myDBOwner, _shared_service, _bucketExecutor, _tls, _dummy,
_fileHeaderContext, make_config_store(),
diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp
index 09bb67dbac9..187c0463da3 100644
--- a/searchcore/src/tests/proton/matching/matching_test.cpp
+++ b/searchcore/src/tests/proton/matching/matching_test.cpp
@@ -8,7 +8,6 @@
#include <vespa/searchcore/proton/documentmetastore/documentmetastore.h>
#include <vespa/searchcore/proton/matching/fakesearchcontext.h>
#include <vespa/searchcore/proton/matching/i_constant_value_repo.h>
-#include <vespa/searchcore/proton/matching/isearchcontext.h>
#include <vespa/searchcore/proton/matching/matcher.h>
#include <vespa/searchcore/proton/matching/querynodes.h>
#include <vespa/searchcore/proton/matching/sessionmanager.h>
@@ -37,6 +36,7 @@
#include <vespa/eval/eval/tensor_spec.h>
#include <vespa/eval/eval/value_codec.h>
#include <vespa/vespalib/objects/nbostream.h>
+#include <vespa/vespalib/util/testclock.h>
#include <vespa/log/log.h>
LOG_SETUP("matching_test");
@@ -120,7 +120,7 @@ struct MyWorld {
SessionManager::SP sessionManager;
DocumentMetaStore metaStore;
MatchingStats matchingStats;
- vespalib::Clock clock;
+ vespalib::TestClock clock;
QueryLimiter queryLimiter;
EmptyConstantValueRepo constantValueRepo;
@@ -344,7 +344,7 @@ struct MyWorld {
}
Matcher::SP createMatcher() {
- return std::make_shared<Matcher>(schema, config, clock, queryLimiter, constantValueRepo, RankingExpressions(), OnnxModels(), 0);
+ return std::make_shared<Matcher>(schema, config, clock.clock(), queryLimiter, constantValueRepo, RankingExpressions(), OnnxModels(), 0);
}
struct MySearchHandler : ISearchHandler {
diff --git a/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp b/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp
index 8ede5277d71..191c1718f61 100644
--- a/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp
+++ b/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp
@@ -6,6 +6,7 @@
#include <vespa/searchcore/proton/matching/requestcontext.h>
#include <vespa/searchlib/attribute/attribute_blueprint_params.h>
#include <vespa/searchlib/fef/properties.h>
+#include <vespa/vespalib/util/testclock.h>
#include <vespa/vespalib/gtest/gtest.h>
#include <vespa/vespalib/objects/nbostream.h>
@@ -29,7 +30,7 @@ public:
class RequestContextTest : public ::testing::Test {
private:
- vespalib::Clock _clock;
+ vespalib::TestClock _clock;
vespalib::Doom _doom;
MyAttributeContext _attr_ctx;
Properties _props;
@@ -45,7 +46,7 @@ private:
public:
RequestContextTest()
: _clock(),
- _doom(_clock, vespalib::steady_time(), vespalib::steady_time(), false),
+ _doom(_clock.clock(), vespalib::steady_time(), vespalib::steady_time(), false),
_attr_ctx(),
_props(),
_request_ctx(_doom, _attr_ctx, _props, AttributeBlueprintParams()),