summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/apps/tests/persistenceconformance_test.cpp26
-rw-r--r--searchcore/src/tests/proton/docsummary/docsummary_test.cpp16
-rw-r--r--searchcore/src/tests/proton/documentdb/documentdb_test.cpp12
-rw-r--r--searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp12
-rw-r--r--searchcore/src/tests/proton/persistenceconformance/.gitignore2
-rw-r--r--searchcore/src/tests/proton/persistenceconformance/CMakeLists.txt17
-rw-r--r--searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp6
-rw-r--r--searchcore/src/tests/proton/proton_disk_layout/proton_disk_layout_test.cpp3
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/port_numbers.h22
9 files changed, 99 insertions, 17 deletions
diff --git a/searchcore/src/apps/tests/persistenceconformance_test.cpp b/searchcore/src/apps/tests/persistenceconformance_test.cpp
index 71a1f475d1d..80d5174946c 100644
--- a/searchcore/src/apps/tests/persistenceconformance_test.cpp
+++ b/searchcore/src/apps/tests/persistenceconformance_test.cpp
@@ -17,6 +17,7 @@
#include <vespa/searchcore/proton/server/threading_service_config.h>
#include <vespa/searchcore/proton/test/disk_mem_usage_notifier.h>
#include <vespa/searchcore/proton/test/mock_shared_threading_service.h>
+#include <vespa/searchcore/proton/test/port_numbers.h>
#include <vespa/searchlib/attribute/interlock.h>
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/searchlib/transactionlog/translogserver.h>
@@ -33,6 +34,8 @@
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/document/test/make_bucket_space.h>
#include <vespa/vespalib/util/hw_info.h>
+#include <vespa/vespalib/util/stringfmt.h>
+#include <cstdlib>
#include <filesystem>
#include <vespa/log/log.h>
@@ -66,6 +69,25 @@ using DocumenttypesConfigSP = DocumentDBConfig::DocumenttypesConfigSP;
using DocumentDBMap = std::map<DocTypeName, DocumentDB::SP>;
using DocTypeVector = std::vector<DocTypeName>;
+namespace {
+
+constexpr int tls_port_base = proton::test::port_numbers::persistenceconformance_tls_port_base;
+constexpr int tls_port_max_bias = proton::test::port_numbers::persistenceconformance_tls_port_max_bias;
+
+int shard_index = 0;
+
+void
+calc_shard_index()
+{
+ const auto* shard = std::getenv("GTEST_SHARD_INDEX");
+ if (shard != nullptr) {
+ shard_index = std::atoi(shard);
+ assert(shard_index >= 0 && shard_index <= tls_port_max_bias);
+ }
+}
+
+}
+
void
storeDocType(DocTypeVector *types, const DocumentType &type)
{
@@ -381,12 +403,14 @@ public:
std::unique_ptr<PersistenceFactory>
makeMyPersistenceFactory(const std::string &docType)
{
- return std::make_unique<MyPersistenceFactory>("testdb", 9017, SchemaConfigFactory::get(), docType);
+ auto base_dir = vespalib::make_string("testdb%03d", shard_index);
+ return std::make_unique<MyPersistenceFactory>(base_dir, tls_port_base + shard_index, SchemaConfigFactory::get(), docType);
}
int
main(int argc, char* argv[])
{
+ calc_shard_index();
::testing::InitGoogleTest(&argc, argv);
DummyFileHeaderContext::setCreator("persistenceconformance_test");
ConformanceTest::_factoryFactory = &makeMyPersistenceFactory;
diff --git a/searchcore/src/tests/proton/docsummary/docsummary_test.cpp b/searchcore/src/tests/proton/docsummary/docsummary_test.cpp
index e8ed780ed82..173cfbbf052 100644
--- a/searchcore/src/tests/proton/docsummary/docsummary_test.cpp
+++ b/searchcore/src/tests/proton/docsummary/docsummary_test.cpp
@@ -18,6 +18,7 @@
#include <vespa/searchcore/proton/server/summaryadapter.h>
#include <vespa/searchcore/proton/test/bucketfactory.h>
#include <vespa/searchcore/proton/test/mock_shared_threading_service.h>
+#include <vespa/searchcore/proton/test/port_numbers.h>
#include <vespa/searchlib/attribute/interlock.h>
#include <vespa/searchlib/engine/docsumapi.h>
#include <vespa/searchlib/index/dummyfileheadercontext.h>
@@ -63,6 +64,7 @@
#include <vespa/vespalib/data/slime/json_format.h>
#include <vespa/vespalib/data/slime/slime.h>
#include <vespa/vespalib/encoding/base64.h>
+#include <vespa/vespalib/net/socket_spec.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/geo/zcurve.h>
#include <vespa/vespalib/util/destructor_callbacks.h>
@@ -103,6 +105,16 @@ using vespalib::Slime;
using vespalib::geo::ZCurve;
using namespace vespalib::slime;
+namespace {
+
+constexpr int tls_port = proton::test::port_numbers::docsummary_tls_port;
+
+vespalib::string tls_port_spec() {
+ return vespalib::SocketSpec::from_host_port("localhost", tls_port).spec();
+}
+
+}
+
namespace proton {
class MockDocsumFieldWriterFactory : public search::docsummary::IDocsumFieldWriterFactory
@@ -248,7 +260,7 @@ public:
_fileHeaderContext(),
_summaryExecutor(8),
_shared_service(_summaryExecutor),
- _tls(_shared_service.transport(), "tmp", 9013, ".", _fileHeaderContext),
+ _tls(_shared_service.transport(), "tmp", tls_port, ".", _fileHeaderContext),
_made_dir(std::filesystem::create_directory(std::filesystem::path("tmpdb"))),
_queryLimiter(),
_dummy(),
@@ -271,7 +283,7 @@ public:
_configMgr.forwardConfig(b);
_configMgr.nextGeneration(_shared_service.transport(), 0ms);
std::filesystem::create_directory(std::filesystem::path(std::string("tmpdb/") + docTypeName));
- _ddb = DocumentDB::create("tmpdb", _configMgr.getConfig(), "tcp/localhost:9013", _queryLimiter,
+ _ddb = DocumentDB::create("tmpdb", _configMgr.getConfig(), tls_port_spec(), _queryLimiter,
DocTypeName(docTypeName), makeBucketSpace(), *b->getProtonConfigSP(), *this,
_shared_service, _tls, _dummy, _fileHeaderContext,
std::make_shared<search::attribute::Interlock>(),
diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
index dbe5cd409b3..97c0331ce0b 100644
--- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
@@ -20,6 +20,7 @@
#include <vespa/searchcore/proton/server/fileconfigmanager.h>
#include <vespa/searchcore/proton/server/memoryconfigstore.h>
#include <vespa/searchcore/proton/test/mock_shared_threading_service.h>
+#include <vespa/searchcore/proton/test/port_numbers.h>
#include <vespa/searchcorespi/index/indexflushtarget.h>
#include <vespa/config-bucketspaces.h>
#include <vespa/config/subscription/sourcespec.h>
@@ -33,6 +34,7 @@
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/searchlib/transactionlog/translogserver.h>
#include <vespa/vespalib/data/slime/slime.h>
+#include <vespa/vespalib/net/socket_spec.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/size_literals.h>
@@ -61,6 +63,12 @@ using vespalib::Slime;
namespace {
+constexpr int tls_port = proton::test::port_numbers::documentdb_tls_port;
+
+vespalib::string tls_port_spec() {
+ return vespalib::SocketSpec::from_host_port("localhost", tls_port).spec();
+}
+
void
cleanup_dirs(bool file_config)
{
@@ -133,7 +141,7 @@ Fixture::Fixture(bool file_config)
_hwInfo(),
_db(),
_fileHeaderContext(),
- _tls(_shared_service.transport(), "tmp", 9014, ".", _fileHeaderContext),
+ _tls(_shared_service.transport(), "tmp", tls_port, ".", _fileHeaderContext),
_queryLimiter()
{
auto documenttypesConfig = std::make_shared<DocumenttypesConfig>();
@@ -149,7 +157,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, DocTypeName("typea"),
+ _db = DocumentDB::create(".", mgr.getConfig(), tls_port_spec(), _queryLimiter, DocTypeName("typea"),
makeBucketSpace(),
*b->getProtonConfigSP(), _myDBOwner, _shared_service, _tls, _dummy,
_fileHeaderContext,
diff --git a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
index 20a6ac40de4..808c5743538 100644
--- a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
@@ -26,6 +26,7 @@
#include <vespa/searchcore/proton/feedoperation/updateoperation.h>
#include <vespa/searchcore/proton/persistenceengine/i_resource_write_filter.h>
#include <vespa/searchcore/proton/server/configstore.h>
+#include <vespa/searchcore/proton/test/port_numbers.h>
#include <vespa/document/util/feed_reject_helper.h>
#include <vespa/searchcore/proton/server/ddbstate.h>
#include <vespa/searchcore/proton/server/feedhandler.h>
@@ -36,6 +37,7 @@
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/searchlib/test/doc_builder.h>
#include <vespa/searchlib/transactionlog/translogserver.h>
+#include <vespa/vespalib/net/socket_spec.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/lambdatask.h>
#include <vespa/vespalib/util/exceptions.h>
@@ -79,6 +81,12 @@ using CountDownLatchUP = std::unique_ptr<vespalib::CountDownLatch>;
namespace {
+constexpr int tls_port = proton::test::port_numbers::feedhandler_tls_port;
+
+vespalib::string tls_port_spec() {
+ return vespalib::SocketSpec::from_host_port("localhost", tls_port).spec();
+}
+
struct Rendezvous {
vespalib::Gate enter;
vespalib::Gate leave;
@@ -428,8 +436,8 @@ struct FeedHandlerFixture
FeedHandlerFixture()
: _fileHeaderContext(),
_service(1),
- tls(_service.transport(), "mytls", 9016, "mytlsdir", _fileHeaderContext, DomainConfig().setPartSizeLimit(0x10000)),
- tlsSpec("tcp/localhost:9016"),
+ tls(_service.transport(), "mytls", tls_port, "mytlsdir", _fileHeaderContext, DomainConfig().setPartSizeLimit(0x10000)),
+ tlsSpec(tls_port_spec()),
schema(),
owner(),
_state(),
diff --git a/searchcore/src/tests/proton/persistenceconformance/.gitignore b/searchcore/src/tests/proton/persistenceconformance/.gitignore
index 9b6330d1531..d1a3a8b1a37 100644
--- a/searchcore/src/tests/proton/persistenceconformance/.gitignore
+++ b/searchcore/src/tests/proton/persistenceconformance/.gitignore
@@ -1 +1 @@
-/vlog.txt
+/vlog*.txt
diff --git a/searchcore/src/tests/proton/persistenceconformance/CMakeLists.txt b/searchcore/src/tests/proton/persistenceconformance/CMakeLists.txt
index ac94a4e9f8a..b7080ff3593 100644
--- a/searchcore/src/tests/proton/persistenceconformance/CMakeLists.txt
+++ b/searchcore/src/tests/proton/persistenceconformance/CMakeLists.txt
@@ -1,7 +1,12 @@
# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_test(
- NAME searchcore_persistenceconformance_test_app
- COMMAND searchcore_persistenceconformance_test_app
- ENVIRONMENT "VESPA_LOG_TARGET=file:vlog.txt"
- COST 200
-)
+set(TOTAL_SHARDS 5)
+math(EXPR MAX_SHARD_INDEX "${TOTAL_SHARDS} - 1")
+foreach(SHARD_INDEX RANGE ${MAX_SHARD_INDEX})
+ string(REGEX MATCH "...$" FMT_SHARD_INDEX "00" ${SHARD_INDEX})
+ vespa_add_test(
+ NAME searchcore_persistenceconformance_test_app_shard_${FMT_SHARD_INDEX}
+ COMMAND searchcore_persistenceconformance_test_app
+ ENVIRONMENT "VESPA_LOG_TARGET=file:vlog_shard_${FMT_SHARD_INDEX}.txt;GTEST_SHARD_INDEX=${SHARD_INDEX};GTEST_TOTAL_SHARDS=${TOTAL_SHARDS}"
+ COST 100
+ )
+endforeach()
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 09cec0d6d01..06264e3e642 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
@@ -48,6 +48,8 @@ using search::GrowStrategy;
using vespalib::datastore::CompactionStrategy;
using vespalib::HwInfo;
+constexpr int proton_rpc_port = 9010; // Not used for listening in this test
+
struct DoctypeFixture {
using UP = std::unique_ptr<DoctypeFixture>;
AttributesConfigBuilder attributesBuilder;
@@ -242,7 +244,7 @@ TEST_FFF("require that bootstrap config manager updates config", ConfigTestFixtu
ConfigRetriever(f2.createConfigKeySet(), f1.context)) {
f2.update(f3.getBootstrapConfigs());
ASSERT_TRUE(f1.configEqual(*f2.getConfig()));
- f1.protonBuilder.rpcport = 9010;
+ f1.protonBuilder.rpcport = proton_rpc_port;
ASSERT_FALSE(f1.configEqual(*f2.getConfig()));
f1.reload();
f2.update(f3.getBootstrapConfigs());
@@ -316,7 +318,7 @@ TEST_FFF("require that proton config fetcher follows changes to bootstrap",
ASSERT_TRUE(f2._configured);
ASSERT_TRUE(f1.configEqual(*f2.getBootstrapConfig()));
f2._configured = false;
- f1.protonBuilder.rpcport = 9010;
+ f1.protonBuilder.rpcport = proton_rpc_port;
f1.reload();
ASSERT_TRUE(f2.waitUntilConfigured(120s));
ASSERT_TRUE(f1.configEqual(*f2.getBootstrapConfig()));
diff --git a/searchcore/src/tests/proton/proton_disk_layout/proton_disk_layout_test.cpp b/searchcore/src/tests/proton/proton_disk_layout/proton_disk_layout_test.cpp
index 49dbf43da67..411dd88f995 100644
--- a/searchcore/src/tests/proton/proton_disk_layout/proton_disk_layout_test.cpp
+++ b/searchcore/src/tests/proton/proton_disk_layout/proton_disk_layout_test.cpp
@@ -2,6 +2,7 @@
#include <vespa/searchcore/proton/server/proton_disk_layout.h>
#include <vespa/searchcore/proton/common/doctypename.h>
+#include <vespa/searchcore/proton/test/port_numbers.h>
#include <vespa/searchcore/proton/test/transport_helper.h>
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/searchlib/transactionlog/translogserver.h>
@@ -19,7 +20,7 @@ using proton::DocTypeName;
using proton::ProtonDiskLayout;
using proton::Transport;
-static constexpr unsigned int tlsPort = 9018;
+static constexpr unsigned int tlsPort = proton::test::port_numbers::proton_disk_layout_tls_port;
static const vespalib::string baseDir("testdb");
static const vespalib::string documentsDir(baseDir + "/documents");
diff --git a/searchcore/src/vespa/searchcore/proton/test/port_numbers.h b/searchcore/src/vespa/searchcore/proton/test/port_numbers.h
new file mode 100644
index 00000000000..30b7c9b595b
--- /dev/null
+++ b/searchcore/src/vespa/searchcore/proton/test/port_numbers.h
@@ -0,0 +1,22 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+namespace proton::test::port_numbers {
+
+/*
+ * The following port numbers are used by unit tests in the searchcore
+ * module. They should all be in the range 9001..9499.
+ */
+
+constexpr int docsummary_tls_port = 9013;
+constexpr int documentdb_tls_port = 9014;
+constexpr int feedhandler_tls_port = 9016;
+
+// Use ports 9020..9029 for persistenceconformance test
+constexpr int persistenceconformance_tls_port_base = 9020;
+constexpr int persistenceconformance_tls_port_max_bias = 9;
+
+constexpr int proton_disk_layout_tls_port = 9018;
+
+}