aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2024-05-21 14:39:44 +0200
committerTor Egge <Tor.Egge@online.no>2024-05-21 14:39:44 +0200
commit2943e2f2abee06ec91e1e7545ba132b9b1bbbac5 (patch)
treeefad9c77e8f65f6e291bf2739629b301c579f3ba /searchcore/src
parentcac19f61ef200dc06736c5d40d38dc770e87c67f (diff)
Use multiple shards for searchcore persistence conformance test.
Diffstat (limited to 'searchcore/src')
-rw-r--r--searchcore/src/apps/tests/persistenceconformance_test.cpp21
-rw-r--r--searchcore/src/tests/proton/persistenceconformance/.gitignore2
-rw-r--r--searchcore/src/tests/proton/persistenceconformance/CMakeLists.txt17
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/port_numbers.h6
4 files changed, 36 insertions, 10 deletions
diff --git a/searchcore/src/apps/tests/persistenceconformance_test.cpp b/searchcore/src/apps/tests/persistenceconformance_test.cpp
index a7d8a7201af..80d5174946c 100644
--- a/searchcore/src/apps/tests/persistenceconformance_test.cpp
+++ b/searchcore/src/apps/tests/persistenceconformance_test.cpp
@@ -34,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>
@@ -69,7 +71,20 @@ using DocTypeVector = std::vector<DocTypeName>;
namespace {
-constexpr int tls_port = proton::test::port_numbers::persistenceconformance_tls_port;
+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);
+ }
+}
}
@@ -388,12 +403,14 @@ public:
std::unique_ptr<PersistenceFactory>
makeMyPersistenceFactory(const std::string &docType)
{
- return std::make_unique<MyPersistenceFactory>("testdb", tls_port, 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/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/vespa/searchcore/proton/test/port_numbers.h b/searchcore/src/vespa/searchcore/proton/test/port_numbers.h
index 4526aaff948..30b7c9b595b 100644
--- a/searchcore/src/vespa/searchcore/proton/test/port_numbers.h
+++ b/searchcore/src/vespa/searchcore/proton/test/port_numbers.h
@@ -12,7 +12,11 @@ namespace proton::test::port_numbers {
constexpr int docsummary_tls_port = 9013;
constexpr int documentdb_tls_port = 9014;
constexpr int feedhandler_tls_port = 9016;
-constexpr int persistenceconformance_tls_port = 9017;
+
+// 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;
}