summaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/proton_config_fetcher
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-02-21 16:22:32 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-02-21 16:22:32 +0000
commit83a2ef4c43a00eb09d31e41925260f5ea85c40bd (patch)
tree697739afd95dd8d7542b2c7a198ae33581bc624f /searchcore/src/tests/proton/proton_config_fetcher
parent1bb2800fb1bf312689115a7230b1d3ead74d4ac6 (diff)
Add helper classes containg a FNET_Transport and a FastOS_ThreadPool to reduce test boiler plate.
Diffstat (limited to 'searchcore/src/tests/proton/proton_config_fetcher')
-rw-r--r--searchcore/src/tests/proton/proton_config_fetcher/CMakeLists.txt1
-rw-r--r--searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp25
2 files changed, 11 insertions, 15 deletions
diff --git a/searchcore/src/tests/proton/proton_config_fetcher/CMakeLists.txt b/searchcore/src/tests/proton/proton_config_fetcher/CMakeLists.txt
index 88332f360ce..20629733f09 100644
--- a/searchcore/src/tests/proton/proton_config_fetcher/CMakeLists.txt
+++ b/searchcore/src/tests/proton/proton_config_fetcher/CMakeLists.txt
@@ -3,6 +3,7 @@ vespa_add_executable(searchcore_proton_config_fetcher_test_app TEST
SOURCES
proton_config_fetcher_test.cpp
DEPENDS
+ searchcore_test
searchcore_server
searchcore_fconfig
)
diff --git a/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp b/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp
index eaafd089a76..b4193b0e0b2 100644
--- a/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp
+++ b/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp
@@ -9,6 +9,7 @@
#include <vespa/searchcore/proton/common/alloc_config.h>
#include <vespa/searchcore/proton/common/hw_info.h>
#include <vespa/searchcore/proton/common/subdbtype.h>
+#include <vespa/searchcore/proton/test/transport_helper.h>
#include <vespa/searchcore/config/config-ranking-constants.h>
#include <vespa/searchcore/config/config-ranking-expressions.h>
#include <vespa/searchcore/config/config-onnx-models.h>
@@ -19,7 +20,6 @@
#include <vespa/vespalib/util/varholder.h>
#include <vespa/vespalib/util/size_literals.h>
#include <vespa/vespalib/testkit/testapp.h>
-#include <vespa/fnet/transport.h>
#include <vespa/config/common/configcontext.h>
#include <vespa/config-bucketspaces.h>
#include <vespa/config-attributes.h>
@@ -65,8 +65,7 @@ struct DoctypeFixture {
struct ConfigTestFixture {
const std::string configId;
- FastOS_ThreadPool threadPool;
- FNET_Transport transport;
+ TransportMgr transport;
ProtonConfigBuilder protonBuilder;
DocumenttypesConfigBuilder documenttypesBuilder;
FiledistributorrpcConfigBuilder filedistBuilder;
@@ -78,7 +77,6 @@ struct ConfigTestFixture {
ConfigTestFixture(const std::string & id)
: configId(id),
- threadPool(64_Ki),
protonBuilder(),
documenttypesBuilder(),
filedistBuilder(),
@@ -88,7 +86,6 @@ struct ConfigTestFixture {
context(std::make_shared<ConfigContext>(set)),
idcounter(-1)
{
- transport.Start(& threadPool);
set.addBuilder(configId, &protonBuilder);
set.addBuilder(configId, &documenttypesBuilder);
set.addBuilder(configId, &filedistBuilder);
@@ -96,9 +93,7 @@ struct ConfigTestFixture {
addDocType("_alwaysthere_");
}
- ~ConfigTestFixture() {
- transport.ShutDown(true);
- }
+ ~ConfigTestFixture() = default;
DoctypeFixture *addDocType(const std::string &name, bool isGlobal = false) {
DocumenttypesConfigBuilder::Documenttype dt;
@@ -259,7 +254,7 @@ getDocumentDBConfig(ConfigTestFixture &f, DocumentDBConfigManager &mgr, const Hw
{
ConfigRetriever retriever(mgr.createConfigKeySet(), f.context);
mgr.forwardConfig(f.getBootstrapConfig(1, hwInfo));
- mgr.update(f.transport, retriever.getBootstrapConfigs()); // Cheating, but we only need the configs
+ mgr.update(f.transport.transport(), retriever.getBootstrapConfigs()); // Cheating, but we only need the configs
return mgr.getConfig();
}
@@ -310,8 +305,8 @@ TEST_FF("require that documentdb config manager builds schema with imported attr
TEST_FFF("require that proton config fetcher follows changes to bootstrap",
ConfigTestFixture("search"),
ProtonConfigOwner(),
- ProtonConfigFetcher(f1.transport, ConfigUri(f1.configId, f1.context), f2, 60s)) {
- f3.start(f1.threadPool);
+ ProtonConfigFetcher(f1.transport.transport(), ConfigUri(f1.configId, f1.context), f2, 60s)) {
+ f3.start(f1.transport.threadPool());
ASSERT_TRUE(f2._configured);
ASSERT_TRUE(f1.configEqual(f2.getBootstrapConfig()));
f2._configured = false;
@@ -325,8 +320,8 @@ TEST_FFF("require that proton config fetcher follows changes to bootstrap",
TEST_FFF("require that proton config fetcher follows changes to doctypes",
ConfigTestFixture("search"),
ProtonConfigOwner(),
- ProtonConfigFetcher(f1.transport, ConfigUri(f1.configId, f1.context), f2, 60s)) {
- f3.start(f1.threadPool);
+ ProtonConfigFetcher(f1.transport.transport(), ConfigUri(f1.configId, f1.context), f2, 60s)) {
+ f3.start(f1.transport.threadPool());
f2._configured = false;
f1.addDocType("typea");
@@ -345,8 +340,8 @@ TEST_FFF("require that proton config fetcher follows changes to doctypes",
TEST_FFF("require that proton config fetcher reconfigures dbowners",
ConfigTestFixture("search"),
ProtonConfigOwner(),
- ProtonConfigFetcher(f1.transport, ConfigUri(f1.configId, f1.context), f2, 60s)) {
- f3.start(f1.threadPool);
+ ProtonConfigFetcher(f1.transport.transport(), ConfigUri(f1.configId, f1.context), f2, 60s)) {
+ f3.start(f1.transport.threadPool());
ASSERT_FALSE(f2.getDocumentDBConfig("typea"));
// Add db and verify that config for db is provided