diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-02-21 16:22:32 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-02-21 16:22:32 +0000 |
commit | 83a2ef4c43a00eb09d31e41925260f5ea85c40bd (patch) | |
tree | 697739afd95dd8d7542b2c7a198ae33581bc624f /searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp | |
parent | 1bb2800fb1bf312689115a7230b1d3ead74d4ac6 (diff) |
Add helper classes containg a FNET_Transport and a FastOS_ThreadPool to reduce test boiler plate.
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 | 15 |
1 files changed, 5 insertions, 10 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 397250f3d1e..6e20d30fb36 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 @@ -25,6 +25,7 @@ #include <vespa/searchcore/proton/server/reconfig_params.h> #include <vespa/searchcore/proton/matching/querylimiter.h> #include <vespa/searchcore/proton/test/test.h> +#include <vespa/searchcore/proton/test/transport_helper.h> #include <vespa/searchcore/proton/test/thread_utils.h> #include <vespa/vespalib/util/idestructorcallback.h> #include <vespa/searchlib/index/docbuilder.h> @@ -36,8 +37,6 @@ #include <vespa/vespalib/util/threadstackexecutor.h> #include <vespa/vespalib/util/destructor_callbacks.h> #include <vespa/config/subscription/sourcespec.h> -#include <vespa/fastos/thread.h> -#include <vespa/fnet/transport.h> using namespace cloud::config::filedistribution; using namespace document; @@ -289,8 +288,7 @@ struct MyConfigSnapshot template <typename Traits> struct FixtureBase { - FastOS_ThreadPool _threadPool; - FNET_Transport _transport; + TransportMgr _transport; ThreadStackExecutor _summaryExecutor; ExecutorThreadingService _writeService; typename Traits::Config _cfg; @@ -303,8 +301,7 @@ struct FixtureBase typename Traits::SubDB _subDb; IFeedView::SP _tmpFeedView; FixtureBase() - : _threadPool(64_Ki), - _transport(), + : _transport(), _summaryExecutor(1, 64_Ki), _writeService(_summaryExecutor), _cfg(), @@ -312,18 +309,16 @@ struct FixtureBase _bucketDBHandler(*_bucketDB), _ctx(_writeService, _bucketDB, _bucketDBHandler), _baseSchema(), - _snapshot(std::make_unique<MyConfigSnapshot>(_transport, _baseSchema, Traits::ConfigDir::dir())), + _snapshot(std::make_unique<MyConfigSnapshot>(_transport.transport(), _baseSchema, Traits::ConfigDir::dir())), _baseDir(BASE_DIR + "/" + SUB_NAME, BASE_DIR), _subDb(_cfg._cfg, _ctx._ctx), _tmpFeedView() { - _transport.Start(&_threadPool); init(); } ~FixtureBase() { _writeService.master().execute(makeLambdaTask([this]() { _subDb.close(); })); _writeService.shutdown(); - _transport.ShutDown(true); } void setBucketStateCalculator(const std::shared_ptr<IBucketStateCalculator> & calc) { vespalib::Gate gate; @@ -354,7 +349,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, reconfigSchema, reconfigConfigDir); + auto newCfg = std::make_unique<MyConfigSnapshot>(_transport.transport(), reconfigSchema, reconfigConfigDir); DocumentDBConfig::ComparisonResult cmpResult; cmpResult.attributesChanged = true; cmpResult.documenttypesChanged = true; |