diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-02-21 17:38:47 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-02-22 10:06:57 +0000 |
commit | 3d159ee87f54409f0df2e306e698bb1381ec7365 (patch) | |
tree | 7e8b7efdc0d51b761e0988b20235fe9df978c300 /searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp | |
parent | a7e8bb9dcf3c674a3756e0f0383384593856415a (diff) |
- Use common tranport for TlsClient.
- Also refactor to simplify unit tests.
Diffstat (limited to 'searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp')
-rw-r--r-- | searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
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 6e20d30fb36..27636324835 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 @@ -18,7 +18,6 @@ #include <vespa/searchcore/proton/server/fast_access_document_retriever.h> #include <vespa/searchcore/proton/server/i_document_subdb_owner.h> #include <vespa/searchcore/proton/server/igetserialnum.h> -#include <vespa/searchcore/proton/server/executorthreadingservice.h> #include <vespa/searchcore/proton/server/minimal_document_retriever.h> #include <vespa/searchcore/proton/server/searchabledocsubdb.h> #include <vespa/searchcore/proton/server/document_subdb_initializer.h> @@ -288,9 +287,8 @@ struct MyConfigSnapshot template <typename Traits> struct FixtureBase { - TransportMgr _transport; - ThreadStackExecutor _summaryExecutor; - ExecutorThreadingService _writeService; + TransportAndExecutorService _service; + typename Traits::Config _cfg; std::shared_ptr<bucketdb::BucketDBOwner> _bucketDB; BucketDBHandler _bucketDBHandler; @@ -301,15 +299,13 @@ struct FixtureBase typename Traits::SubDB _subDb; IFeedView::SP _tmpFeedView; FixtureBase() - : _transport(), - _summaryExecutor(1, 64_Ki), - _writeService(_summaryExecutor), + : _service(1), _cfg(), _bucketDB(std::make_shared<bucketdb::BucketDBOwner>()), _bucketDBHandler(*_bucketDB), - _ctx(_writeService, _bucketDB, _bucketDBHandler), + _ctx(_service.write(), _bucketDB, _bucketDBHandler), _baseSchema(), - _snapshot(std::make_unique<MyConfigSnapshot>(_transport.transport(), _baseSchema, Traits::ConfigDir::dir())), + _snapshot(std::make_unique<MyConfigSnapshot>(_service.transport(), _baseSchema, Traits::ConfigDir::dir())), _baseDir(BASE_DIR + "/" + SUB_NAME, BASE_DIR), _subDb(_cfg._cfg, _ctx._ctx), _tmpFeedView() @@ -317,8 +313,8 @@ struct FixtureBase init(); } ~FixtureBase() { - _writeService.master().execute(makeLambdaTask([this]() { _subDb.close(); })); - _writeService.shutdown(); + _service.write().master().execute(makeLambdaTask([this]() { _subDb.close(); })); + _service.shutdown(); } void setBucketStateCalculator(const std::shared_ptr<IBucketStateCalculator> & calc) { vespalib::Gate gate; @@ -327,11 +323,11 @@ struct FixtureBase } template <typename FunctionType> void runInMasterAndSync(FunctionType func) { - proton::test::runInMasterAndSync(_writeService, func); + proton::test::runInMasterAndSync(_service.write(), func); } template <typename FunctionType> void runInMaster(FunctionType func) { - proton::test::runInMaster(_writeService, func); + proton::test::runInMaster(_service.write(), func); } void init() { DocumentSubDbInitializer::SP task = @@ -349,7 +345,7 @@ struct FixtureBase runInMasterAndSync([&]() { performReconfig(serialNum, reconfigSchema, reconfigConfigDir); }); } void performReconfig(SerialNum serialNum, const Schema &reconfigSchema, const vespalib::string &reconfigConfigDir) { - auto newCfg = std::make_unique<MyConfigSnapshot>(_transport.transport(), reconfigSchema, reconfigConfigDir); + auto newCfg = std::make_unique<MyConfigSnapshot>(_service.transport(), reconfigSchema, reconfigConfigDir); DocumentDBConfig::ComparisonResult cmpResult; cmpResult.attributesChanged = true; cmpResult.documenttypesChanged = true; |