aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton
diff options
context:
space:
mode:
Diffstat (limited to 'searchcore/src/tests/proton')
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp2
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp2
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp2
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_usage_filter/attribute_usage_filter_test.cpp2
-rw-r--r--searchcore/src/tests/proton/attribute/document_field_extractor/document_field_extractor_test.cpp2
-rw-r--r--searchcore/src/tests/proton/attribute/document_field_populator/document_field_populator_test.cpp2
-rw-r--r--searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp2
-rw-r--r--searchcore/src/tests/proton/attribute/imported_attributes_repo/imported_attributes_repo_test.cpp2
-rw-r--r--searchcore/src/tests/proton/bucketdb/bucketdb/bucketdb_test.cpp2
-rw-r--r--searchcore/src/tests/proton/common/.gitignore2
-rw-r--r--searchcore/src/tests/proton/common/CMakeLists.txt31
-rw-r--r--searchcore/src/tests/proton/common/attribute_updater/.gitignore4
-rw-r--r--searchcore/src/tests/proton/common/attribute_updater/CMakeLists.txt9
-rw-r--r--searchcore/src/tests/proton/common/attribute_updater_test.cpp (renamed from searchcore/src/tests/proton/common/attribute_updater/attribute_updater_test.cpp)8
-rw-r--r--searchcore/src/tests/proton/common/cachedselect_test.cpp11
-rw-r--r--searchcore/src/tests/proton/common/document_type_inspector/.gitignore1
-rw-r--r--searchcore/src/tests/proton/common/document_type_inspector/CMakeLists.txt8
-rw-r--r--searchcore/src/tests/proton/common/document_type_inspector_test.cpp (renamed from searchcore/src/tests/proton/common/document_type_inspector/document_type_inspector_test.cpp)7
-rw-r--r--searchcore/src/tests/proton/common/documentdb_job_trackers_test.cpp (renamed from searchcore/src/tests/proton/metrics/documentdb_job_trackers/documentdb_job_trackers_test.cpp)7
-rw-r--r--searchcore/src/tests/proton/common/feedoperation_test.cpp (renamed from searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp)4
-rw-r--r--searchcore/src/tests/proton/common/hw_info_sampler/hw_info_sampler_test.cpp2
-rw-r--r--searchcore/src/tests/proton/common/job_load_sampler_test.cpp (renamed from searchcore/src/tests/proton/metrics/job_load_sampler/job_load_sampler_test.cpp)6
-rw-r--r--searchcore/src/tests/proton/common/job_tracked_flush_test.cpp (renamed from searchcore/src/tests/proton/metrics/job_tracked_flush/job_tracked_flush_test.cpp)7
-rw-r--r--searchcore/src/tests/proton/common/pendinglidtracker_test.cpp7
-rw-r--r--searchcore/src/tests/proton/common/selectpruner_test.cpp6
-rw-r--r--searchcore/src/tests/proton/common/state_reporter_utils/.gitignore1
-rw-r--r--searchcore/src/tests/proton/common/state_reporter_utils/CMakeLists.txt8
-rw-r--r--searchcore/src/tests/proton/common/state_reporter_utils_test.cpp (renamed from searchcore/src/tests/proton/common/state_reporter_utils/state_reporter_utils_test.cpp)5
-rw-r--r--searchcore/src/tests/proton/common/statusreport_test.cpp (renamed from searchcore/src/tests/proton/statusreport/statusreport_test.cpp)4
-rw-r--r--searchcore/src/tests/proton/common/vespa_testrunner.cpp8
-rw-r--r--searchcore/src/tests/proton/docsummary/docsummary_test.cpp2
-rw-r--r--searchcore/src/tests/proton/documentdb/CMakeLists.txt19
-rw-r--r--searchcore/src/tests/proton/documentdb/buckethandler/.gitignore1
-rw-r--r--searchcore/src/tests/proton/documentdb/buckethandler/CMakeLists.txt16
-rw-r--r--searchcore/src/tests/proton/documentdb/buckethandler_test.cpp (renamed from searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp)87
-rw-r--r--searchcore/src/tests/proton/documentdb/combiningfeedview/.gitignore1
-rw-r--r--searchcore/src/tests/proton/documentdb/combiningfeedview/CMakeLists.txt17
-rw-r--r--searchcore/src/tests/proton/documentdb/combiningfeedview_test.cpp (renamed from searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp)42
-rw-r--r--searchcore/src/tests/proton/documentdb/configurer/.gitignore1
-rw-r--r--searchcore/src/tests/proton/documentdb/configurer/CMakeLists.txt21
-rw-r--r--searchcore/src/tests/proton/documentdb/configurer_test.cpp (renamed from searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp)117
-rw-r--r--searchcore/src/tests/proton/documentdb/document_scan_iterator/document_scan_iterator_test.cpp2
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp35
-rwxr-xr-xsearchcore/src/tests/proton/documentdb/documentdb_test.sh5
-rw-r--r--searchcore/src/tests/proton/documentdb/documentdbconfig/documentdbconfig_test.cpp2
-rw-r--r--searchcore/src/tests/proton/documentdb/documentdbconfigscout/documentdbconfigscout_test.cpp2
-rw-r--r--searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp2
-rw-r--r--searchcore/src/tests/proton/documentdb/feedview/.gitignore1
-rw-r--r--searchcore/src/tests/proton/documentdb/feedview/CMakeLists.txt18
-rw-r--r--searchcore/src/tests/proton/documentdb/feedview_test.cpp (renamed from searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp)105
-rw-r--r--searchcore/src/tests/proton/documentdb/job_tracked_maintenance_job/job_tracked_maintenance_job_test.cpp2
-rw-r--r--searchcore/src/tests/proton/documentdb/maintenancecontroller/.gitignore2
-rw-r--r--searchcore/src/tests/proton/documentdb/maintenancecontroller/CMakeLists.txt19
-rw-r--r--searchcore/src/tests/proton/documentdb/maintenancecontroller_test.cpp (renamed from searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp)79
-rw-r--r--searchcore/src/tests/proton/documentdb/move_operation_limiter/CMakeLists.txt8
-rw-r--r--searchcore/src/tests/proton/documentdb/storeonlyfeedview/.gitignore4
-rw-r--r--searchcore/src/tests/proton/documentdb/storeonlyfeedview/CMakeLists.txt14
-rw-r--r--searchcore/src/tests/proton/documentdb/storeonlyfeedview_test.cpp (renamed from searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp)10
-rw-r--r--searchcore/src/tests/proton/documentdb/threading_service_config/CMakeLists.txt8
-rw-r--r--searchcore/src/tests/proton/documentdb/vespa_testrunner.cpp8
-rw-r--r--searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp2
-rw-r--r--searchcore/src/tests/proton/feedoperation/.gitignore4
-rw-r--r--searchcore/src/tests/proton/feedoperation/CMakeLists.txt9
-rw-r--r--searchcore/src/tests/proton/flushengine/flushengine_test.cpp2
-rw-r--r--searchcore/src/tests/proton/flushengine/prepare_restart_flush_strategy/prepare_restart_flush_strategy_test.cpp2
-rw-r--r--searchcore/src/tests/proton/flushengine/shrink_lid_space_flush_target/shrink_lid_space_flush_target_test.cpp2
-rw-r--r--searchcore/src/tests/proton/index/index_writer/index_writer_test.cpp2
-rw-r--r--searchcore/src/tests/proton/initializer/task_runner_test.cpp2
-rw-r--r--searchcore/src/tests/proton/matching/CMakeLists.txt2
-rw-r--r--searchcore/src/tests/proton/matching/match_loop_communicator/CMakeLists.txt1
-rw-r--r--searchcore/src/tests/proton/matching/match_loop_communicator/match_loop_communicator_test.cpp317
-rw-r--r--searchcore/src/tests/proton/matching/matching_test.cpp871
-rw-r--r--searchcore/src/tests/proton/matching/query_test.cpp11
-rw-r--r--searchcore/src/tests/proton/matching/querynodes_test.cpp2
-rw-r--r--searchcore/src/tests/proton/matching/resolveviewvisitor_test.cpp2
-rw-r--r--searchcore/src/tests/proton/matching/sessionmanager_test.cpp2
-rw-r--r--searchcore/src/tests/proton/matching/termdataextractor_test.cpp2
-rw-r--r--searchcore/src/tests/proton/metrics/documentdb_job_trackers/.gitignore1
-rw-r--r--searchcore/src/tests/proton/metrics/documentdb_job_trackers/CMakeLists.txt9
-rw-r--r--searchcore/src/tests/proton/metrics/job_load_sampler/.gitignore1
-rw-r--r--searchcore/src/tests/proton/metrics/job_load_sampler/CMakeLists.txt8
-rw-r--r--searchcore/src/tests/proton/metrics/job_tracked_flush/.gitignore1
-rw-r--r--searchcore/src/tests/proton/metrics/job_tracked_flush/CMakeLists.txt9
-rw-r--r--searchcore/src/tests/proton/metrics/metrics_engine/metrics_engine_test.cpp2
-rw-r--r--searchcore/src/tests/proton/persistenceengine/persistence_handler_map/persistence_handler_map_test.cpp2
-rw-r--r--searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp2
-rw-r--r--searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp2
-rw-r--r--searchcore/src/tests/proton/proton_disk_layout/proton_disk_layout_test.cpp2
-rw-r--r--searchcore/src/tests/proton/reference/document_db_reference/document_db_reference_test.cpp2
-rw-r--r--searchcore/src/tests/proton/reference/document_db_reference_registry/document_db_reference_registry_test.cpp2
-rw-r--r--searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp2
-rw-r--r--searchcore/src/tests/proton/reference/gid_to_lid_change_handler/gid_to_lid_change_handler_test.cpp2
-rw-r--r--searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp2
-rw-r--r--searchcore/src/tests/proton/reference/gid_to_lid_change_registrator/gid_to_lid_change_registrator_test.cpp2
-rw-r--r--searchcore/src/tests/proton/reference/gid_to_lid_mapper/gid_to_lid_mapper_test.cpp2
-rw-r--r--searchcore/src/tests/proton/reprocessing/document_reprocessing_handler/document_reprocessing_handler_test.cpp2
-rw-r--r--searchcore/src/tests/proton/reprocessing/reprocessing_runner/reprocessing_runner_test.cpp2
-rw-r--r--searchcore/src/tests/proton/server/CMakeLists.txt10
-rw-r--r--searchcore/src/tests/proton/server/documentretriever_test.cpp2
-rw-r--r--searchcore/src/tests/proton/server/feeddebugger_test.cpp2
-rw-r--r--searchcore/src/tests/proton/server/feedstates_test.cpp2
-rw-r--r--searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp2
-rw-r--r--searchcore/src/tests/proton/server/memoryconfigstore_test.cpp2
-rw-r--r--searchcore/src/tests/proton/server/move_operation_limiter_test.cpp (renamed from searchcore/src/tests/proton/documentdb/move_operation_limiter/move_operation_limiter_test.cpp)10
-rw-r--r--searchcore/src/tests/proton/server/threading_service_config_test.cpp (renamed from searchcore/src/tests/proton/documentdb/threading_service_config/threading_service_config_test.cpp)10
-rw-r--r--searchcore/src/tests/proton/server/vespa_testrunner.cpp8
-rw-r--r--searchcore/src/tests/proton/statusreport/.gitignore1
-rw-r--r--searchcore/src/tests/proton/statusreport/CMakeLists.txt8
-rw-r--r--searchcore/src/tests/proton/summaryengine/summaryengine_test.cpp2
-rw-r--r--searchcore/src/tests/proton/verify_ranksetup/CMakeLists.txt2
110 files changed, 1078 insertions, 1089 deletions
diff --git a/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp b/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp
index e25c675ff64..af37aca4702 100644
--- a/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp
@@ -13,7 +13,7 @@
#include <vespa/searchcommon/attribute/i_multi_value_attribute.h>
#include <vespa/vespalib/util/stash.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/log/log.h>
LOG_SETUP("attribute_initializer_test");
diff --git a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp
index 634bc2c93b5..df27c4d7cc2 100644
--- a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp
@@ -32,7 +32,7 @@
#include <vespa/searchcommon/attribute/i_attribute_functor.h>
#include <vespa/searchcommon/attribute/iattributevector.h>
#include <vespa/searchcommon/attribute/config.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/foreground_thread_executor.h>
#include <vespa/vespalib/util/foregroundtaskexecutor.h>
#include <vespa/vespalib/util/hw_info.h>
diff --git a/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp b/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp
index 2cdfd908bb1..0d011797395 100644
--- a/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp
@@ -13,7 +13,7 @@
#include <vespa/document/fieldvalue/document.h>
#include <vespa/document/fieldvalue/intfieldvalue.h>
#include <vespa/document/repo/configbuilder.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/foreground_thread_executor.h>
#include <vespa/vespalib/util/foregroundtaskexecutor.h>
#include <vespa/vespalib/util/hw_info.h>
diff --git a/searchcore/src/tests/proton/attribute/attribute_usage_filter/attribute_usage_filter_test.cpp b/searchcore/src/tests/proton/attribute/attribute_usage_filter/attribute_usage_filter_test.cpp
index 15c26797f15..a20e08d5be2 100644
--- a/searchcore/src/tests/proton/attribute/attribute_usage_filter/attribute_usage_filter_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attribute_usage_filter/attribute_usage_filter_test.cpp
@@ -3,7 +3,7 @@
#include <vespa/searchcore/proton/attribute/attribute_usage_filter.h>
#include <vespa/searchcore/proton/attribute/i_attribute_usage_listener.h>
#include <vespa/searchlib/attribute/address_space_components.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/size_literals.h>
#include <vespa/log/log.h>
diff --git a/searchcore/src/tests/proton/attribute/document_field_extractor/document_field_extractor_test.cpp b/searchcore/src/tests/proton/attribute/document_field_extractor/document_field_extractor_test.cpp
index 6615a0e583a..6f84b793608 100644
--- a/searchcore/src/tests/proton/attribute/document_field_extractor/document_field_extractor_test.cpp
+++ b/searchcore/src/tests/proton/attribute/document_field_extractor/document_field_extractor_test.cpp
@@ -14,7 +14,7 @@
#include <vespa/document/fieldvalue/weightedsetfieldvalue.h>
#include <vespa/searchcommon/common/undefinedvalues.h>
#include <vespa/searchcore/proton/attribute/document_field_extractor.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
using document::Field;
using document::DataType;
diff --git a/searchcore/src/tests/proton/attribute/document_field_populator/document_field_populator_test.cpp b/searchcore/src/tests/proton/attribute/document_field_populator/document_field_populator_test.cpp
index 08f9bfdb52d..6d522f254b0 100644
--- a/searchcore/src/tests/proton/attribute/document_field_populator/document_field_populator_test.cpp
+++ b/searchcore/src/tests/proton/attribute/document_field_populator/document_field_populator_test.cpp
@@ -2,7 +2,7 @@
#include <vespa/document/datatype/datatype.h>
#include <vespa/document/repo/configbuilder.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/searchcommon/attribute/config.h>
#include <vespa/searchcore/proton/attribute/document_field_populator.h>
#include <vespa/searchlib/attribute/attributefactory.h>
diff --git a/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp b/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp
index d97b2c2a3e7..6d2f375e410 100644
--- a/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp
+++ b/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp
@@ -1,6 +1,6 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/searchcore/proton/attribute/imported_attributes_context.h>
#include <vespa/searchcore/proton/attribute/imported_attributes_repo.h>
diff --git a/searchcore/src/tests/proton/attribute/imported_attributes_repo/imported_attributes_repo_test.cpp b/searchcore/src/tests/proton/attribute/imported_attributes_repo/imported_attributes_repo_test.cpp
index d0b7ac8e688..0447db9c89e 100644
--- a/searchcore/src/tests/proton/attribute/imported_attributes_repo/imported_attributes_repo_test.cpp
+++ b/searchcore/src/tests/proton/attribute/imported_attributes_repo/imported_attributes_repo_test.cpp
@@ -1,7 +1,7 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/log/log.h>
LOG_SETUP("imported_attributes_repo_test");
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/searchcommon/attribute/basictype.h>
#include <vespa/searchcommon/attribute/iattributevector.h>
diff --git a/searchcore/src/tests/proton/bucketdb/bucketdb/bucketdb_test.cpp b/searchcore/src/tests/proton/bucketdb/bucketdb/bucketdb_test.cpp
index 4f6d09e6ffa..213d9c38290 100644
--- a/searchcore/src/tests/proton/bucketdb/bucketdb/bucketdb_test.cpp
+++ b/searchcore/src/tests/proton/bucketdb/bucketdb/bucketdb_test.cpp
@@ -6,7 +6,7 @@
#include <vespa/vespalib/data/slime/slime.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/util/stringfmt.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/log/log.h>
LOG_SETUP("bucketdb_test");
diff --git a/searchcore/src/tests/proton/common/.gitignore b/searchcore/src/tests/proton/common/.gitignore
index 9ce51ef2178..e69de29bb2d 100644
--- a/searchcore/src/tests/proton/common/.gitignore
+++ b/searchcore/src/tests/proton/common/.gitignore
@@ -1,2 +0,0 @@
-searchcore_cachedselect_test_app
-searchcore_selectpruner_test_app
diff --git a/searchcore/src/tests/proton/common/CMakeLists.txt b/searchcore/src/tests/proton/common/CMakeLists.txt
index 658afa38247..7eec733214b 100644
--- a/searchcore/src/tests/proton/common/CMakeLists.txt
+++ b/searchcore/src/tests/proton/common/CMakeLists.txt
@@ -1,24 +1,23 @@
# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchcore_selectpruner_test_app TEST
+vespa_add_executable(searchcore_proton_common_vespa_test_app TEST
SOURCES
+ vespa_testrunner.cpp
selectpruner_test.cpp
- DEPENDS
- searchcore_pcommon
- searchlib_test
-)
-vespa_add_test(NAME searchcore_selectpruner_test_app COMMAND searchcore_selectpruner_test_app)
-vespa_add_executable(searchcore_cachedselect_test_app TEST
- SOURCES
cachedselect_test.cpp
- DEPENDS
- searchcore_pcommon
- searchlib_test
-)
-vespa_add_test(NAME searchcore_cachedselect_test_app COMMAND searchcore_cachedselect_test_app)
-vespa_add_executable(pendinglidtracker_test_app TEST
- SOURCES
pendinglidtracker_test.cpp
+ attribute_updater_test.cpp
+ state_reporter_utils_test.cpp
+ document_type_inspector_test.cpp
+ feedoperation_test.cpp
+ documentdb_job_trackers_test.cpp
+ job_load_sampler_test.cpp
+ job_tracked_flush_test.cpp
+ statusreport_test.cpp
DEPENDS
+ searchcore_proton_metrics
+ searchcore_feedoperation
searchcore_pcommon
+ searchcore_test
+ searchlib_test
)
-vespa_add_test(NAME pendinglidtracker_test_app COMMAND pendinglidtracker_test_app)
+vespa_add_test(NAME searchcore_proton_common_vespa_test_app COMMAND searchcore_proton_common_vespa_test_app)
diff --git a/searchcore/src/tests/proton/common/attribute_updater/.gitignore b/searchcore/src/tests/proton/common/attribute_updater/.gitignore
deleted file mode 100644
index 3c6e15d6808..00000000000
--- a/searchcore/src/tests/proton/common/attribute_updater/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-.depend
-Makefile
-attribute_updater_test
-searchcore_attribute_updater_test_app
diff --git a/searchcore/src/tests/proton/common/attribute_updater/CMakeLists.txt b/searchcore/src/tests/proton/common/attribute_updater/CMakeLists.txt
deleted file mode 100644
index be0da1012d0..00000000000
--- a/searchcore/src/tests/proton/common/attribute_updater/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchcore_attribute_updater_test_app TEST
- SOURCES
- attribute_updater_test.cpp
- DEPENDS
- searchcore_pcommon
- searchlib_test
-)
-vespa_add_test(NAME searchcore_attribute_updater_test_app COMMAND searchcore_attribute_updater_test_app)
diff --git a/searchcore/src/tests/proton/common/attribute_updater/attribute_updater_test.cpp b/searchcore/src/tests/proton/common/attribute_updater_test.cpp
index 0efeaf18c65..432386af0e6 100644
--- a/searchcore/src/tests/proton/common/attribute_updater/attribute_updater_test.cpp
+++ b/searchcore/src/tests/proton/common/attribute_updater_test.cpp
@@ -38,10 +38,7 @@
#include <vespa/eval/eval/value_codec.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
#include <vespa/vespalib/test/insertion_operators.h>
-#include <vespa/vespalib/testkit/testapp.h>
-
-#include <vespa/log/log.h>
-LOG_SETUP("attribute_updater_test");
+#include <vespa/vespalib/testkit/test_kit.h>
using namespace document;
using document::config_builder::Array;
@@ -472,6 +469,3 @@ TEST_F("require that tensor remove update is applied",
}
}
-
-TEST_MAIN() { TEST_RUN_ALL(); }
-
diff --git a/searchcore/src/tests/proton/common/cachedselect_test.cpp b/searchcore/src/tests/proton/common/cachedselect_test.cpp
index a0c8fef3b83..70cec30392b 100644
--- a/searchcore/src/tests/proton/common/cachedselect_test.cpp
+++ b/searchcore/src/tests/proton/common/cachedselect_test.cpp
@@ -21,10 +21,10 @@
#include <vespa/searchlib/attribute/singlenumericenumattribute.hpp>
#include <vespa/searchlib/attribute/singlenumericpostattribute.h>
#include <vespa/searchlib/test/mock_attribute_manager.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/log/log.h>
-LOG_SETUP("cachedselect_test");
+LOG_SETUP(".cachedselect_test");
using document::DataType;
using document::Document;
@@ -145,9 +145,7 @@ checkSelect(const NodeUP &sel,
}
std::ostringstream os;
EXPECT_TRUE(sel->trace(ctx, os) == exp);
- LOG(info,
- "trace output: '%s'",
- os.str().c_str());
+ LOG(info, "trace output: '%s'", os.str().c_str());
return false;
}
@@ -679,7 +677,4 @@ TEST_F("Test performance when using attributes", TestFixture)
}
-
}
-
-TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchcore/src/tests/proton/common/document_type_inspector/.gitignore b/searchcore/src/tests/proton/common/document_type_inspector/.gitignore
deleted file mode 100644
index 49db4ae7746..00000000000
--- a/searchcore/src/tests/proton/common/document_type_inspector/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-searchcore_document_type_inspector_test_app
diff --git a/searchcore/src/tests/proton/common/document_type_inspector/CMakeLists.txt b/searchcore/src/tests/proton/common/document_type_inspector/CMakeLists.txt
deleted file mode 100644
index 339574dc906..00000000000
--- a/searchcore/src/tests/proton/common/document_type_inspector/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchcore_document_type_inspector_test_app TEST
- SOURCES
- document_type_inspector_test.cpp
- DEPENDS
- searchcore_pcommon
-)
-vespa_add_test(NAME searchcore_document_type_inspector_test_app COMMAND searchcore_document_type_inspector_test_app)
diff --git a/searchcore/src/tests/proton/common/document_type_inspector/document_type_inspector_test.cpp b/searchcore/src/tests/proton/common/document_type_inspector_test.cpp
index 83106747623..46022ed9273 100644
--- a/searchcore/src/tests/proton/common/document_type_inspector/document_type_inspector_test.cpp
+++ b/searchcore/src/tests/proton/common/document_type_inspector_test.cpp
@@ -1,6 +1,6 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/searchcore/proton/common/document_type_inspector.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/document/base/field.h>
#include <vespa/document/datatype/datatypes.h>
@@ -127,8 +127,3 @@ TEST_F("require that struct addition is detected", Fixture(false, false))
EXPECT_FALSE(inspector.hasUnchangedField("map.key"));
EXPECT_FALSE(inspector.hasUnchangedField("map.value"));
}
-
-TEST_MAIN()
-{
- TEST_RUN_ALL();
-}
diff --git a/searchcore/src/tests/proton/metrics/documentdb_job_trackers/documentdb_job_trackers_test.cpp b/searchcore/src/tests/proton/common/documentdb_job_trackers_test.cpp
index c32b3439c5d..89c3b164e96 100644
--- a/searchcore/src/tests/proton/metrics/documentdb_job_trackers/documentdb_job_trackers_test.cpp
+++ b/searchcore/src/tests/proton/common/documentdb_job_trackers_test.cpp
@@ -3,12 +3,9 @@
#include <vespa/searchcore/proton/metrics/documentdb_job_trackers.h>
#include <vespa/searchcore/proton/metrics/job_tracked_flush_target.h>
#include <vespa/searchcore/proton/test/dummy_flush_target.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <thread>
-#include <vespa/log/log.h>
-LOG_SETUP("documentdb_job_trackers_test");
-
using namespace proton;
using namespace searchcorespi;
@@ -115,5 +112,3 @@ TEST_F("require that un-known flush targets are not tracked", Fixture)
EXPECT_EQUAL(1u, output.size());
EXPECT_EQUAL(&*output[0].get(), &*input[0]);
}
-
-TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp b/searchcore/src/tests/proton/common/feedoperation_test.cpp
index b4cf29f67e0..48893aa7da3 100644
--- a/searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp
+++ b/searchcore/src/tests/proton/common/feedoperation_test.cpp
@@ -24,7 +24,7 @@
#include <vespa/document/repo/configbuilder.h>
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/document/datatype/documenttype.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
using document::BucketId;
using document::DataType;
@@ -357,5 +357,3 @@ TEST_F("require that we can serialize and deserialize remove by gid operations",
}
} // namespace
-
-TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchcore/src/tests/proton/common/hw_info_sampler/hw_info_sampler_test.cpp b/searchcore/src/tests/proton/common/hw_info_sampler/hw_info_sampler_test.cpp
index d23505dae9c..ad74039a5ee 100644
--- a/searchcore/src/tests/proton/common/hw_info_sampler/hw_info_sampler_test.cpp
+++ b/searchcore/src/tests/proton/common/hw_info_sampler/hw_info_sampler_test.cpp
@@ -5,7 +5,7 @@
#include <vespa/searchcore/proton/common/hw_info_sampler.h>
#include <vespa/searchlib/test/directory_handler.h>
#include <vespa/vespalib/util/size_literals.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
using proton::HwInfoSampler;
using search::test::DirectoryHandler;
diff --git a/searchcore/src/tests/proton/metrics/job_load_sampler/job_load_sampler_test.cpp b/searchcore/src/tests/proton/common/job_load_sampler_test.cpp
index 2b74d1425a1..b6fcd3fe092 100644
--- a/searchcore/src/tests/proton/metrics/job_load_sampler/job_load_sampler_test.cpp
+++ b/searchcore/src/tests/proton/common/job_load_sampler_test.cpp
@@ -1,9 +1,7 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
-LOG_SETUP("job_load_sampler_test");
#include <vespa/searchcore/proton/metrics/job_load_sampler.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <chrono>
using namespace proton;
@@ -101,5 +99,3 @@ TEST_F("require that multiple jobs that starts and ends in several intervals get
f.end(45);
EXPECT_APPROX(0.5, f.sample(50), EPS);
}
-
-TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchcore/src/tests/proton/metrics/job_tracked_flush/job_tracked_flush_test.cpp b/searchcore/src/tests/proton/common/job_tracked_flush_test.cpp
index fa6b158136f..608fbb60a70 100644
--- a/searchcore/src/tests/proton/metrics/job_tracked_flush/job_tracked_flush_test.cpp
+++ b/searchcore/src/tests/proton/common/job_tracked_flush_test.cpp
@@ -5,14 +5,11 @@
#include <vespa/searchcore/proton/test/dummy_flush_target.h>
#include <vespa/searchcore/proton/test/simple_job_tracker.h>
#include <vespa/searchlib/common/flush_token.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/lambdatask.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/vespalib/util/gate.h>
-#include <vespa/log/log.h>
-LOG_SETUP("job_tracked_flush_test");
-
using namespace proton;
using namespace searchcorespi;
using search::SerialNum;
@@ -134,5 +131,3 @@ TEST_F("require that nullptr flush task is not tracked", Fixture)
FlushTask::UP task = f._trackedFlush.initFlush(0, std::make_shared<search::FlushToken>());
EXPECT_TRUE(task.get() == nullptr);
}
-
-TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchcore/src/tests/proton/common/pendinglidtracker_test.cpp b/searchcore/src/tests/proton/common/pendinglidtracker_test.cpp
index 1aac149b7e7..f8d0d218670 100644
--- a/searchcore/src/tests/proton/common/pendinglidtracker_test.cpp
+++ b/searchcore/src/tests/proton/common/pendinglidtracker_test.cpp
@@ -1,11 +1,8 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/searchcore/proton/common/pendinglidtracker.h>
-#include <vespa/log/log.h>
-LOG_SETUP("pendinglidtracker_test");
-
using namespace proton;
constexpr uint32_t LID_1 = 1u;
@@ -76,5 +73,3 @@ TEST("test pendinglidtracker for needcommit") {
EXPECT_EQUAL(ILidCommitState::State::COMPLETED, tracker.getState(LID_1));
EXPECT_EQUAL(ILidCommitState::State::COMPLETED, tracker.getState(LIDV_2_1_3));
}
-
-TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchcore/src/tests/proton/common/selectpruner_test.cpp b/searchcore/src/tests/proton/common/selectpruner_test.cpp
index 1f71da5aeda..09854af99e1 100644
--- a/searchcore/src/tests/proton/common/selectpruner_test.cpp
+++ b/searchcore/src/tests/proton/common/selectpruner_test.cpp
@@ -10,10 +10,10 @@
#include <vespa/document/select/parser.h>
#include <vespa/document/select/cloningvisitor.h>
#include <vespa/document/fieldvalue/document.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/log/log.h>
-LOG_SETUP("selectpruner_test");
+LOG_SETUP(".selectpruner_test");
using document::DataType;
using document::Document;
@@ -824,5 +824,3 @@ TEST_F("Complex imported field references return Invalid", TestFixture)
}
} // namespace
-
-TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchcore/src/tests/proton/common/state_reporter_utils/.gitignore b/searchcore/src/tests/proton/common/state_reporter_utils/.gitignore
deleted file mode 100644
index bb0963e5ec3..00000000000
--- a/searchcore/src/tests/proton/common/state_reporter_utils/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-searchcore_state_reporter_utils_test_app
diff --git a/searchcore/src/tests/proton/common/state_reporter_utils/CMakeLists.txt b/searchcore/src/tests/proton/common/state_reporter_utils/CMakeLists.txt
deleted file mode 100644
index 1bdb0b613cf..00000000000
--- a/searchcore/src/tests/proton/common/state_reporter_utils/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchcore_state_reporter_utils_test_app TEST
- SOURCES
- state_reporter_utils_test.cpp
- DEPENDS
- searchcore_pcommon
-)
-vespa_add_test(NAME searchcore_state_reporter_utils_test_app COMMAND searchcore_state_reporter_utils_test_app)
diff --git a/searchcore/src/tests/proton/common/state_reporter_utils/state_reporter_utils_test.cpp b/searchcore/src/tests/proton/common/state_reporter_utils_test.cpp
index 749f8b147ac..6c9025d276f 100644
--- a/searchcore/src/tests/proton/common/state_reporter_utils/state_reporter_utils_test.cpp
+++ b/searchcore/src/tests/proton/common/state_reporter_utils_test.cpp
@@ -1,10 +1,8 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
-LOG_SETUP("state_reporter_utils_test");
#include <vespa/searchcore/proton/common/state_reporter_utils.h>
#include <vespa/vespalib/data/slime/slime.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
using namespace proton;
using namespace vespalib::slime;
@@ -44,4 +42,3 @@ TEST("require that advanced status report is correctly converted to slime")
message("foo"))));
}
-TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchcore/src/tests/proton/statusreport/statusreport_test.cpp b/searchcore/src/tests/proton/common/statusreport_test.cpp
index d1ef6c3af29..052eb795529 100644
--- a/searchcore/src/tests/proton/statusreport/statusreport_test.cpp
+++ b/searchcore/src/tests/proton/common/statusreport_test.cpp
@@ -1,5 +1,5 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/searchcore/proton/common/statusreport.h>
namespace proton {
@@ -37,5 +37,3 @@ TEST("require that custom status report works")
}
} // namespace proton
-
-TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchcore/src/tests/proton/common/vespa_testrunner.cpp b/searchcore/src/tests/proton/common/vespa_testrunner.cpp
new file mode 100644
index 00000000000..1e4e79047c3
--- /dev/null
+++ b/searchcore/src/tests/proton/common/vespa_testrunner.cpp
@@ -0,0 +1,8 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Unit tests for predicate_index.
+#include <vespa/vespalib/testkit/test_kit.h>
+
+#include <vespa/log/log.h>
+LOG_SETUP("proton_common_test");
+
+TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchcore/src/tests/proton/docsummary/docsummary_test.cpp b/searchcore/src/tests/proton/docsummary/docsummary_test.cpp
index 173cfbbf052..361e37278da 100644
--- a/searchcore/src/tests/proton/docsummary/docsummary_test.cpp
+++ b/searchcore/src/tests/proton/docsummary/docsummary_test.cpp
@@ -65,7 +65,7 @@
#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/testkit/test_kit.h>
#include <vespa/vespalib/geo/zcurve.h>
#include <vespa/vespalib/util/destructor_callbacks.h>
#include <vespa/vespalib/util/size_literals.h>
diff --git a/searchcore/src/tests/proton/documentdb/CMakeLists.txt b/searchcore/src/tests/proton/documentdb/CMakeLists.txt
index b4d53e92ebf..374cdb6ab52 100644
--- a/searchcore/src/tests/proton/documentdb/CMakeLists.txt
+++ b/searchcore/src/tests/proton/documentdb/CMakeLists.txt
@@ -20,5 +20,20 @@ vespa_add_executable(searchcore_documentdb_test_app TEST
searchcore_grouping
searchcore_proton_metrics
)
-vespa_add_test(NAME searchcore_documentdb_test_app COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/documentdb_test.sh
- DEPENDS searchcore_documentdb_test_app)
+vespa_add_test(NAME searchcore_documentdb_test_app COMMAND searchcore_documentdb_test_app)
+
+vespa_add_executable(searchcore_proton_documentdb_vespa_test_app TEST
+ SOURCES
+ vespa_testrunner.cpp
+ buckethandler_test.cpp
+ combiningfeedview_test.cpp
+ configurer_test.cpp
+ feedview_test.cpp
+ maintenancecontroller_test.cpp
+ storeonlyfeedview_test.cpp
+ DEPENDS
+ searchcore_server
+ searchcore_feedoperation
+ searchcore_test
+)
+vespa_add_test(NAME searchcore_proton_documentdb_vespa_test_app COMMAND searchcore_proton_documentdb_vespa_test_app)
diff --git a/searchcore/src/tests/proton/documentdb/buckethandler/.gitignore b/searchcore/src/tests/proton/documentdb/buckethandler/.gitignore
deleted file mode 100644
index c159971ebc7..00000000000
--- a/searchcore/src/tests/proton/documentdb/buckethandler/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-searchcore_buckethandler_test_app
diff --git a/searchcore/src/tests/proton/documentdb/buckethandler/CMakeLists.txt b/searchcore/src/tests/proton/documentdb/buckethandler/CMakeLists.txt
deleted file mode 100644
index e67143c1b5d..00000000000
--- a/searchcore/src/tests/proton/documentdb/buckethandler/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchcore_buckethandler_test_app TEST
- SOURCES
- buckethandler_test.cpp
- DEPENDS
- searchcore_test
- searchcore_server
- searchcore_feedoperation
- searchcore_matching
- searchcore_attribute
- searchcore_documentmetastore
- searchcore_bucketdb
- searchcore_pcommon
- searchcore_grouping
-)
-vespa_add_test(NAME searchcore_buckethandler_test_app COMMAND searchcore_buckethandler_test_app)
diff --git a/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp b/searchcore/src/tests/proton/documentdb/buckethandler_test.cpp
index c428f350d1a..4cf6b49d090 100644
--- a/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/buckethandler_test.cpp
@@ -7,10 +7,7 @@
#include <vespa/searchcore/proton/test/test.h>
#include <vespa/persistence/spi/test.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
-#include <vespa/vespalib/testkit/testapp.h>
-
-#include <vespa/log/log.h>
-LOG_SETUP("buckethandler_test");
+#include <vespa/vespalib/testkit/test_kit.h>
using namespace proton;
using document::BucketId;
@@ -22,6 +19,7 @@ using storage::spi::test::makeSpiBucket;
using vespalib::ThreadStackExecutor;
using proton::test::BucketStateCalculator;
+namespace {
const GlobalId GID_1("111111111111");
const BucketId BUCKET_1(8, GID_1.convertToBucketId().getRawId());
const Timestamp TIME_1(1u);
@@ -95,41 +93,8 @@ struct Fixture
test::BucketIdListResultHandler _bucketList;
test::BucketInfoResultHandler _bucketInfo;
std::shared_ptr<test::GenericResultHandler> _genResult;
- Fixture()
- : _builder(),
- _bucketDB(std::make_shared<bucketdb::BucketDBOwner>()),
- _ready(_bucketDB, SubDbType::READY),
- _removed(_bucketDB, SubDbType::REMOVED),
- _notReady(_bucketDB, SubDbType::NOTREADY),
- _exec(1),
- _handler(_exec),
- _changedHandler(),
- _calc(new BucketStateCalculator()),
- _bucketList(), _bucketInfo(),
- _genResult(std::make_shared<test::GenericResultHandler>())
- {
- // bucket 2 & 3 & 4 & 7 in ready
- _ready.insertDocs(_builder.createDocs(2, 1, 3). // 2 docs
- createDocs(3, 3, 6). // 3 docs
- createDocs(4, 6, 10). // 4 docs
- createDocs(7, 10, 11). // 1 doc
- getDocs());
- // bucket 2 in removed
- _removed.insertDocs(_builder.clearDocs().
- createDocs(2, 16, 20). // 4 docs
- getDocs());
- // bucket 4 in not ready
- _notReady.insertDocs(_builder.clearDocs().
- createDocs(4, 22, 24). // 2 docs
- getDocs());
- _handler.setReadyBucketHandler(_ready._metaStore);
- _handler.addBucketStateChangedHandler(&_changedHandler);
- _handler.notifyClusterStateChanged(_calc);
- }
- ~Fixture()
- {
- _handler.removeBucketStateChangedHandler(&_changedHandler);
- }
+ Fixture() __attribute__((noinline));
+ ~Fixture() __attribute__((noinline));
void sync() { _exec.sync(); }
void handleGetBucketInfo(const BucketId &bucket) {
_handler.handleGetBucketInfo(makeSpiBucket(bucket), _bucketInfo);
@@ -147,6 +112,44 @@ struct Fixture
}
};
+Fixture::Fixture()
+ : _builder(),
+ _bucketDB(std::make_shared<bucketdb::BucketDBOwner>()),
+ _ready(_bucketDB, SubDbType::READY),
+ _removed(_bucketDB, SubDbType::REMOVED),
+ _notReady(_bucketDB, SubDbType::NOTREADY),
+ _exec(1),
+ _handler(_exec),
+ _changedHandler(),
+ _calc(std::make_shared<BucketStateCalculator>()),
+ _bucketList(), _bucketInfo(),
+ _genResult(std::make_shared<test::GenericResultHandler>())
+{
+ // bucket 2 & 3 & 4 & 7 in ready
+ _ready.insertDocs(_builder.createDocs(2, 1, 3). // 2 docs
+ createDocs(3, 3, 6). // 3 docs
+ createDocs(4, 6, 10). // 4 docs
+ createDocs(7, 10, 11). // 1 doc
+ getDocs());
+ // bucket 2 in removed
+ _removed.insertDocs(_builder.clearDocs().
+ createDocs(2, 16, 20). // 4 docs
+ getDocs());
+ // bucket 4 in not ready
+ _notReady.insertDocs(_builder.clearDocs().
+ createDocs(4, 22, 24). // 2 docs
+ getDocs());
+ _handler.setReadyBucketHandler(_ready._metaStore);
+ _handler.addBucketStateChangedHandler(&_changedHandler);
+ _handler.notifyClusterStateChanged(_calc);
+}
+Fixture::~Fixture()
+{
+ _handler.removeBucketStateChangedHandler(&_changedHandler);
+}
+
+}
+
TEST_F("require that handleListBuckets() returns buckets from all sub dbs", Fixture)
{
@@ -291,9 +294,3 @@ TEST_F("node going from maintenance to down state deactivates all buckets", Fixt
f.handleGetBucketInfo(f._ready.bucket(2));
EXPECT_FALSE(f._bucketInfo.getInfo().isActive());
}
-
-TEST_MAIN()
-{
- TEST_RUN_ALL();
-}
-
diff --git a/searchcore/src/tests/proton/documentdb/combiningfeedview/.gitignore b/searchcore/src/tests/proton/documentdb/combiningfeedview/.gitignore
deleted file mode 100644
index 3302e827c3e..00000000000
--- a/searchcore/src/tests/proton/documentdb/combiningfeedview/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-searchcore_combiningfeedview_test_app
diff --git a/searchcore/src/tests/proton/documentdb/combiningfeedview/CMakeLists.txt b/searchcore/src/tests/proton/documentdb/combiningfeedview/CMakeLists.txt
deleted file mode 100644
index 223befab60d..00000000000
--- a/searchcore/src/tests/proton/documentdb/combiningfeedview/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchcore_combiningfeedview_test_app TEST
- SOURCES
- combiningfeedview_test.cpp
- DEPENDS
- searchcore_test
- searchcore_server
- searchcore_feedoperation
- searchcore_matching
- searchcore_attribute
- searchcore_documentmetastore
- searchcore_bucketdb
- searchcore_pcommon
- searchcore_grouping
- searchcore_proton_metrics
-)
-vespa_add_test(NAME searchcore_combiningfeedview_test_app COMMAND searchcore_combiningfeedview_test_app)
diff --git a/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp b/searchcore/src/tests/proton/documentdb/combiningfeedview_test.cpp
index 3904156170d..4ad0f993d1b 100644
--- a/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/combiningfeedview_test.cpp
@@ -8,10 +8,7 @@
#include <vespa/searchcore/proton/test/test.h>
#include <vespa/vespalib/util/idestructorcallback.h>
#include <vespa/document/update/documentupdate.h>
-#include <vespa/vespalib/testkit/testapp.h>
-
-#include <vespa/log/log.h>
-LOG_SETUP("combiningfeedview_test");
+#include <vespa/vespalib/testkit/test_kit.h>
using document::DocumentTypeRepo;
using document::DocumentUpdate;
@@ -23,6 +20,7 @@ using namespace proton;
using FeedViewVector = std::vector<IFeedView::SP>;
+namespace {
struct MyFeedView : public test::DummyFeedView
{
using SP = std::shared_ptr<MyFeedView>;
@@ -128,18 +126,8 @@ struct Fixture
MySubDb _notReady;
test::BucketStateCalculator::SP _calc;
CombiningFeedView _view;
- Fixture() :
- _builder(),
- _bucketDB(std::make_shared<bucketdb::BucketDBOwner>()),
- _ready(_builder.getRepo(), _bucketDB, SubDbType::READY),
- _removed(_builder.getRepo(), _bucketDB, SubDbType::REMOVED),
- _notReady(_builder.getRepo(), _bucketDB, SubDbType::NOTREADY),
- _calc(new test::BucketStateCalculator()),
- _view(getVector(_ready, _removed, _notReady), makeBucketSpace(), _calc)
- {
- _builder.createDoc(1, 1);
- _builder.createDoc(2, 2);
- }
+ Fixture() __attribute__((noinline));
+ ~Fixture() __attribute__((noinline));
const test::UserDocuments &userDocs() const { return _builder.getDocs(); }
const test::BucketDocuments &userDocs(uint32_t userId) const { return userDocs().getUserDocs(userId); }
PutOperation put(uint32_t userId) {
@@ -163,6 +151,22 @@ struct Fixture
}
};
+Fixture::Fixture()
+ : _builder(),
+ _bucketDB(std::make_shared<bucketdb::BucketDBOwner>()),
+ _ready(_builder.getRepo(), _bucketDB, SubDbType::READY),
+ _removed(_builder.getRepo(), _bucketDB, SubDbType::REMOVED),
+ _notReady(_builder.getRepo(), _bucketDB, SubDbType::NOTREADY),
+ _calc(new test::BucketStateCalculator()),
+ _view(getVector(_ready, _removed, _notReady), makeBucketSpace(), _calc)
+{
+ _builder.createDoc(1, 1);
+ _builder.createDoc(2, 2);
+}
+Fixture::~Fixture() = default;
+
+}
+
TEST_F("require that preparePut() sends to ready view", Fixture)
{
@@ -425,9 +429,3 @@ TEST_F("require that compactLidSpace() is sent to correct feed view", Fixture)
EXPECT_EQUAL(99u, f._removed._view->_wantedLidLimit);
EXPECT_EQUAL(0u, f._notReady._view->_wantedLidLimit);
}
-
-TEST_MAIN()
-{
- TEST_RUN_ALL();
-}
-
diff --git a/searchcore/src/tests/proton/documentdb/configurer/.gitignore b/searchcore/src/tests/proton/documentdb/configurer/.gitignore
deleted file mode 100644
index 3714f1b204d..00000000000
--- a/searchcore/src/tests/proton/documentdb/configurer/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-searchcore_configurer_test_app
diff --git a/searchcore/src/tests/proton/documentdb/configurer/CMakeLists.txt b/searchcore/src/tests/proton/documentdb/configurer/CMakeLists.txt
deleted file mode 100644
index 964677784e9..00000000000
--- a/searchcore/src/tests/proton/documentdb/configurer/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchcore_configurer_test_app TEST
- SOURCES
- configurer_test.cpp
- DEPENDS
- searchcore_test
- searchcore_server
- searchcore_reprocessing
- searchcore_index
- searchcore_docsummary
- searchcore_feedoperation
- searchcore_matching
- searchcore_attribute
- searchcore_documentmetastore
- searchcore_bucketdb
- searchcore_flushengine
- searchcore_pcommon
- searchcore_grouping
- searchcore_proton_metrics
-)
-vespa_add_test(NAME searchcore_configurer_test_app COMMAND searchcore_configurer_test_app)
diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer_test.cpp
index 2504bca17e4..9362d26a3b9 100644
--- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/configurer_test.cpp
@@ -1,6 +1,6 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/config-summary.h>
#include <vespa/document/datatype/documenttype.h>
@@ -69,6 +69,7 @@ using Configurer = SearchableDocSubDBConfigurer;
using ConfigurerUP = std::unique_ptr<SearchableDocSubDBConfigurer>;
using DocumenttypesConfigSP = proton::DocumentDBConfig::DocumenttypesConfigSP;
+namespace {
const vespalib::string BASE_DIR("baseDir");
const vespalib::string DOC_TYPE("invalid");
@@ -146,7 +147,7 @@ ViewSet::~ViewSet() = default;
struct EmptyConstantValueFactory : public vespalib::eval::ConstantValueFactory {
vespalib::eval::ConstantValue::UP create(const vespalib::string &, const vespalib::string &) const override {
- return vespalib::eval::ConstantValue::UP(nullptr);
+ return {};
}
};
@@ -178,13 +179,13 @@ struct Fixture
const DocumentDBConfig& old_config_snapshot,
const ReconfigParams& reconfig_params,
IDocumentDBReferenceResolver& resolver,
- SerialNum serial_num);
+ SerialNum serial_num) const;
IReprocessingInitializer::UP reconfigure(const DocumentDBConfig& new_config_snapshot,
const DocumentDBConfig& old_config_snapshot,
const ReconfigParams& reconfig_params,
IDocumentDBReferenceResolver& resolver,
uint32_t docid_limit,
- SerialNum serial_num);
+ SerialNum serial_num) const;
};
Fixture::Fixture()
@@ -204,7 +205,9 @@ Fixture::Fixture()
_configurer = std::make_unique<Configurer>(_views._summaryMgr, _views.searchView, _views.feedView, _queryLimiter,
_constantValueFactory, _clock.nowRef(), "test", 0);
}
-Fixture::~Fixture() = default;
+Fixture::~Fixture() {
+ std::filesystem::remove_all(std::filesystem::path(BASE_DIR));
+}
void
Fixture::initViewSet(ViewSet &views)
@@ -255,7 +258,7 @@ Fixture::reconfigure(const DocumentDBConfig& new_config_snapshot,
const DocumentDBConfig& old_config_snapshot,
const ReconfigParams& reconfig_params,
IDocumentDBReferenceResolver& resolver,
- SerialNum serial_num)
+ SerialNum serial_num) const
{
EXPECT_FALSE(reconfig_params.shouldAttributeManagerChange());
uint32_t docid_limit = 1;
@@ -271,7 +274,7 @@ Fixture::reconfigure(const DocumentDBConfig& new_config_snapshot,
const ReconfigParams& reconfig_params,
IDocumentDBReferenceResolver& resolver,
uint32_t docid_limit,
- SerialNum serial_num)
+ SerialNum serial_num) const
{
AttributeCollectionSpecFactory attr_spec_factory(AllocStrategy(), false);
auto prepared_reconfig = _configurer->prepare_reconfig(new_config_snapshot, attr_spec_factory, reconfig_params, docid_limit, serial_num);
@@ -279,7 +282,7 @@ Fixture::reconfigure(const DocumentDBConfig& new_config_snapshot,
return _configurer->reconfigure(new_config_snapshot, old_config_snapshot, reconfig_params, resolver, *prepared_reconfig, serial_num);
}
-using MySummaryAdapter = test::MockSummaryAdapter;
+using MySummaryAdapter = proton::test::MockSummaryAdapter;
struct MyFastAccessFeedView
{
@@ -293,56 +296,51 @@ struct MyFastAccessFeedView
std::shared_ptr<PendingLidTrackerBase> _pendingLidsForCommit;
VarHolder<FastAccessFeedView::SP> _feedView;
- explicit MyFastAccessFeedView(IThreadingService &writeService)
- : _fileHeaderContext(),
- _docIdLimit(0),
- _writeService(writeService),
- _hwInfo(),
- _dmsc(),
- _gidToLidChangeHandler(make_shared<DummyGidToLidChangeHandler>()),
- _pendingLidsForCommit(std::make_shared<PendingLidTracker>()),
- _feedView()
- {
- init();
- }
-
+ explicit MyFastAccessFeedView(IThreadingService &writeService) __attribute__((noinline));
~MyFastAccessFeedView();
- void init() {
- MySummaryAdapter::SP summaryAdapter = std::make_shared<MySummaryAdapter>();
- Schema::SP schema = std::make_shared<Schema>();
- _dmsc = make_shared<DocumentMetaStoreContext>(std::make_shared<bucketdb::BucketDBOwner>());
- std::shared_ptr<const DocumentTypeRepo> repo = createRepo();
- StoreOnlyFeedView::Context storeOnlyCtx(summaryAdapter, schema, _dmsc, repo,
- _pendingLidsForCommit, *_gidToLidChangeHandler, _writeService);
- StoreOnlyFeedView::PersistentParams params(1, 1, DocTypeName(DOC_TYPE), 0, SubDbType::NOTREADY);
- auto mgr = make_shared<AttributeManager>(BASE_DIR, "test.subdb", TuneFileAttributes(),
- _fileHeaderContext, std::make_shared<search::attribute::Interlock>(),
- _writeService.field_writer(), _writeService.shared(), _hwInfo);
- auto writer = std::make_shared<AttributeWriter>(mgr);
- FastAccessFeedView::Context fastUpdateCtx(writer, _docIdLimit);
- _feedView.set(std::make_shared<FastAccessFeedView>(std::move(storeOnlyCtx), params, fastUpdateCtx));
- }
+ void init() __attribute__((noinline));
};
+MyFastAccessFeedView::MyFastAccessFeedView(IThreadingService &writeService)
+ : _fileHeaderContext(),
+ _docIdLimit(0),
+ _writeService(writeService),
+ _hwInfo(),
+ _dmsc(),
+ _gidToLidChangeHandler(make_shared<DummyGidToLidChangeHandler>()),
+ _pendingLidsForCommit(std::make_shared<PendingLidTracker>()),
+ _feedView()
+{
+ init();
+}
+
MyFastAccessFeedView::~MyFastAccessFeedView() = default;
+void
+MyFastAccessFeedView::init() {
+ MySummaryAdapter::SP summaryAdapter = std::make_shared<MySummaryAdapter>();
+ Schema::SP schema = std::make_shared<Schema>();
+ _dmsc = make_shared<DocumentMetaStoreContext>(std::make_shared<bucketdb::BucketDBOwner>());
+ std::shared_ptr<const DocumentTypeRepo> repo = createRepo();
+ StoreOnlyFeedView::Context storeOnlyCtx(summaryAdapter, schema, _dmsc, repo,
+ _pendingLidsForCommit, *_gidToLidChangeHandler, _writeService);
+ StoreOnlyFeedView::PersistentParams params(1, 1, DocTypeName(DOC_TYPE), 0, SubDbType::NOTREADY);
+ auto mgr = make_shared<AttributeManager>(BASE_DIR, "test.subdb", TuneFileAttributes(),
+ _fileHeaderContext, std::make_shared<search::attribute::Interlock>(),
+ _writeService.field_writer(), _writeService.shared(), _hwInfo);
+ auto writer = std::make_shared<AttributeWriter>(mgr);
+ FastAccessFeedView::Context fastUpdateCtx(writer, _docIdLimit);
+ _feedView.set(std::make_shared<FastAccessFeedView>(std::move(storeOnlyCtx), params, fastUpdateCtx));
+}
+
struct FastAccessFixture
{
TransportAndExecutorService _service;
MyFastAccessFeedView _view;
FastAccessDocSubDBConfigurer _configurer;
- FastAccessFixture()
- : _service(1),
- _view(_service.write()),
- _configurer(_view._feedView, "test")
- {
- std::filesystem::remove_all(std::filesystem::path(BASE_DIR));
- std::filesystem::create_directory(std::filesystem::path(BASE_DIR));
- }
- ~FastAccessFixture() {
- _service.shutdown();
- }
+ FastAccessFixture() __attribute__((noinline));
+ ~FastAccessFixture() __attribute__((noinline));
IReprocessingInitializer::UP
reconfigure(const DocumentDBConfig& new_config_snapshot,
@@ -351,6 +349,19 @@ struct FastAccessFixture
SerialNum serial_num);
};
+FastAccessFixture::FastAccessFixture()
+ : _service(1),
+ _view(_service.write()),
+ _configurer(_view._feedView, "test")
+{
+ std::filesystem::remove_all(std::filesystem::path(BASE_DIR));
+ std::filesystem::create_directory(std::filesystem::path(BASE_DIR));
+}
+FastAccessFixture::~FastAccessFixture() {
+ _service.shutdown();
+}
+
+
IReprocessingInitializer::UP
FastAccessFixture::reconfigure(const DocumentDBConfig& new_config_snapshot,
const DocumentDBConfig& old_config_snapshot,
@@ -367,14 +378,14 @@ FastAccessFixture::reconfigure(const DocumentDBConfig& new_config_snapshot,
DocumentDBConfig::SP
createConfig()
{
- return test::DocumentDBConfigBuilder(0, make_shared<Schema>(), "client", DOC_TYPE).
+ return proton::test::DocumentDBConfigBuilder(0, make_shared<Schema>(), "client", DOC_TYPE).
repo(createRepo()).build();
}
DocumentDBConfig::SP
createConfig(const Schema::SP &schema)
{
- return test::DocumentDBConfigBuilder(0, schema, "client", DOC_TYPE).
+ return proton::test::DocumentDBConfigBuilder(0, schema, "client", DOC_TYPE).
repo(createRepo()).build();
}
@@ -491,6 +502,8 @@ FastAccessFeedViewComparer::FastAccessFeedViewComparer(FastAccessFeedView::SP ol
{}
FastAccessFeedViewComparer::~FastAccessFeedViewComparer() = default;
+}
+
TEST_F("require that we can reconfigure index searchable", Fixture)
{
ViewPtrs o = f._views.getViewPtrs();
@@ -782,9 +795,3 @@ TEST("require that summary manager should change if relevant config changed")
TEST_DO(assertSummaryManagerShouldChange(CCR().setStoreChanged(true)));
TEST_DO(assertSummaryManagerShouldChange(CCR().setSchemaChanged(true)));
}
-
-TEST_MAIN()
-{
- TEST_RUN_ALL();
- std::filesystem::remove_all(std::filesystem::path(BASE_DIR));
-}
diff --git a/searchcore/src/tests/proton/documentdb/document_scan_iterator/document_scan_iterator_test.cpp b/searchcore/src/tests/proton/documentdb/document_scan_iterator/document_scan_iterator_test.cpp
index 56fb1ab3914..e3ab2737fe5 100644
--- a/searchcore/src/tests/proton/documentdb/document_scan_iterator/document_scan_iterator_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/document_scan_iterator/document_scan_iterator_test.cpp
@@ -3,7 +3,7 @@
#include <vespa/searchcore/proton/server/document_scan_iterator.h>
#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h>
#include <vespa/vespalib/test/insertion_operators.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/document/base/documentid.h>
#include <vespa/vespalib/util/stringfmt.h>
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 da8e842b9e4..e824dc647ac 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
@@ -146,7 +146,7 @@ struct MyDocumentDBReferenceResolver : public IDocumentDBReferenceResolver {
struct MyStoreOnlyConfig
{
StoreOnlyConfig _cfg;
- MyStoreOnlyConfig(SubDbType subDbType)
+ explicit MyStoreOnlyConfig(SubDbType subDbType)
: _cfg(DocTypeName(DOCTYPE_NAME),
SUB_NAME,
BASE_DIR,
@@ -179,7 +179,7 @@ MyStoreOnlyContext::MyStoreOnlyContext(IThreadingService &writeService,
IBucketDBHandlerInitializer &bucketDBHandlerInitializer)
: _owner(), _syncProxy(), _getSerialNum(), _fileHeader(),
_metrics(DOCTYPE_NAME, 1), _configMutex(), _hwInfo(),
- _ctx(_owner, _syncProxy, _getSerialNum, _fileHeader, writeService, bucketDB,
+ _ctx(_owner, _syncProxy, _getSerialNum, _fileHeader, writeService, std::move(bucketDB),
bucketDBHandlerInitializer, _metrics, _configMutex, _hwInfo)
{
}
@@ -189,7 +189,7 @@ template <bool FastAccessAttributesOnly>
struct MyFastAccessConfig
{
FastAccessConfig _cfg;
- MyFastAccessConfig(SubDbType subDbType)
+ explicit MyFastAccessConfig(SubDbType subDbType)
: _cfg(MyStoreOnlyConfig(subDbType)._cfg, true, true, FastAccessAttributesOnly)
{
}
@@ -216,7 +216,7 @@ struct MyFastAccessContext
MyFastAccessContext::MyFastAccessContext(IThreadingService &writeService,
std::shared_ptr<bucketdb::BucketDBOwner> bucketDB,
IBucketDBHandlerInitializer & bucketDBHandlerInitializer)
- : _storeOnlyCtx(writeService, bucketDB, bucketDBHandlerInitializer),
+ : _storeOnlyCtx(writeService, std::move(bucketDB), bucketDBHandlerInitializer),
_attributeMetrics(nullptr),
_wireService(),
_ctx(_storeOnlyCtx._ctx, _attributeMetrics, _wireService, std::make_shared<search::attribute::Interlock>())
@@ -226,7 +226,7 @@ MyFastAccessContext::~MyFastAccessContext() = default;
struct MySearchableConfig
{
FastAccessConfig _cfg;
- MySearchableConfig(SubDbType subDbType)
+ explicit MySearchableConfig(SubDbType subDbType)
: _cfg(MyFastAccessConfig<false>(subDbType)._cfg)
{
}
@@ -254,7 +254,7 @@ struct MySearchableContext
MySearchableContext::MySearchableContext(IThreadingService &writeService,
std::shared_ptr<bucketdb::BucketDBOwner> bucketDB,
IBucketDBHandlerInitializer & bucketDBHandlerInitializer)
- : _fastUpdCtx(writeService, bucketDB, bucketDBHandlerInitializer),
+ : _fastUpdCtx(writeService, std::move(bucketDB), bucketDBHandlerInitializer),
_queryLimiter(), _clock(),
_ctx(_fastUpdCtx._ctx, _queryLimiter, _clock.nowRef(), writeService.shared())
{}
@@ -289,8 +289,8 @@ struct MyConfigSnapshot
DocBuilder _builder;
DocumentDBConfig::SP _cfg;
BootstrapConfig::SP _bootstrap;
- MyConfigSnapshot(FNET_Transport & transport, const Schema &schema, const vespalib::string &cfgDir)
- : _schema(schema),
+ MyConfigSnapshot(FNET_Transport & transport, Schema schema, const vespalib::string &cfgDir)
+ : _schema(std::move(schema)),
_builder(get_add_fields(_schema.getNumAttributeFields() > 1)),
_cfg(),
_bootstrap()
@@ -369,11 +369,11 @@ struct FixtureBase
void basicReconfig(SerialNum serialNum) {
runInMasterAndSync([&]() { performReconfig(serialNum, make_all_attr_schema(two_attr_schema), ConfigDir2::dir()); });
}
- void reconfig(SerialNum serialNum, const Schema &reconfigSchema, const vespalib::string &reconfigConfigDir) {
- runInMasterAndSync([&]() { performReconfig(serialNum, reconfigSchema, reconfigConfigDir); });
+ void reconfig(SerialNum serialNum, Schema reconfigSchema, const vespalib::string &reconfigConfigDir) {
+ runInMasterAndSync([&]() { performReconfig(serialNum, std::move(reconfigSchema), reconfigConfigDir); });
}
- void performReconfig(SerialNum serialNum, const Schema &reconfigSchema, const vespalib::string &reconfigConfigDir) {
- auto newCfg = std::make_unique<MyConfigSnapshot>(_service.transport(), reconfigSchema, reconfigConfigDir);
+ void performReconfig(SerialNum serialNum, Schema reconfigSchema, const vespalib::string &reconfigConfigDir) {
+ auto newCfg = std::make_unique<MyConfigSnapshot>(_service.transport(), std::move(reconfigSchema), reconfigConfigDir);
DocumentDBConfig::ComparisonResult cmpResult;
cmpResult.attributesChanged = true;
cmpResult.documenttypesChanged = true;
@@ -506,7 +506,7 @@ assertCacheCapacity(const StoreOnlyDocSubDB & db, size_t expected_cache_capacity
const auto & summaryManager = db.getSummaryManager();
EXPECT_TRUE(dynamic_cast<SummaryManager *>(summaryManager.get()) != nullptr);
search::IDocumentStore & store = summaryManager->getBackingStore();
- search::DocumentStore & docStore = dynamic_cast<search::DocumentStore &>(store);
+ auto & docStore = dynamic_cast<search::DocumentStore &>(store);
EXPECT_EQUAL(expected_cache_capacity, docStore.getCacheCapacity());
}
@@ -812,7 +812,7 @@ struct DocumentHandler
{
FixtureType &_f;
DocBuilder _builder;
- DocumentHandler(FixtureType &f) : _f(f), _builder(get_add_fields(f.has_attr2)) {}
+ explicit DocumentHandler(FixtureType &f) : _f(f), _builder(get_add_fields(f.has_attr2)) {}
static constexpr uint32_t BUCKET_USED_BITS = 8;
static DocumentId createDocId(uint32_t docId)
{
@@ -997,8 +997,9 @@ assertOperation(DocumentOperation &op, uint32_t expPrevSubDbId, uint32_t expPrev
TEST_F("require that lid allocation uses lowest free lid", StoreOnlyFixture)
{
+ using Handler = DocumentHandler<StoreOnlyFixture>;
f._subDb.onReplayDone();
- DocumentHandler<StoreOnlyFixture> handler(f);
+ Handler handler(f);
Document::UP doc;
PutOperation putOp;
RemoveOperationWithDocId rmOp;
@@ -1012,14 +1013,14 @@ TEST_F("require that lid allocation uses lowest free lid", StoreOnlyFixture)
putOp = handler.createPut(std::move(doc), Timestamp(20), 20);
handler.putDoc(putOp);
EXPECT_TRUE(assertOperation(putOp, 0, 0, 0, 2));
- rmOp = handler.createRemove(handler.createDocId(1), Timestamp(30), 30);
+ rmOp = handler.createRemove(Handler::createDocId(1), Timestamp(30), 30);
handler.removeDoc(rmOp);
EXPECT_TRUE(assertOperation(rmOp, 0, 1, 0, 0));
doc = handler.createEmptyDoc(3);
putOp = handler.createPut(std::move(doc), Timestamp(40), 40);
handler.putDoc(putOp);
EXPECT_TRUE(assertOperation(putOp, 0, 0, 0, 1));
- rmOp = handler.createRemove(handler.createDocId(3), Timestamp(50), 50);
+ rmOp = handler.createRemove(Handler::createDocId(3), Timestamp(50), 50);
handler.removeDoc(rmOp);
EXPECT_TRUE(assertOperation(rmOp, 0, 1, 0, 0));
doc = handler.createEmptyDoc(2);
diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.sh b/searchcore/src/tests/proton/documentdb/documentdb_test.sh
deleted file mode 100755
index bcecccc45d7..00000000000
--- a/searchcore/src/tests/proton/documentdb/documentdb_test.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-set -e
-$VALGRIND ./searchcore_documentdb_test_app
-rm -rf typea tmp
diff --git a/searchcore/src/tests/proton/documentdb/documentdbconfig/documentdbconfig_test.cpp b/searchcore/src/tests/proton/documentdb/documentdbconfig/documentdbconfig_test.cpp
index 75ef56299d9..73d27672380 100644
--- a/searchcore/src/tests/proton/documentdb/documentdbconfig/documentdbconfig_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/documentdbconfig/documentdbconfig_test.cpp
@@ -5,7 +5,7 @@
#include <vespa/config-rank-profiles.h>
#include <vespa/searchcore/proton/server/documentdbconfig.h>
#include <vespa/searchcore/proton/test/documentdb_config_builder.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/config-summary.h>
#include <vespa/document/repo/configbuilder.h>
#include <vespa/document/repo/documenttyperepo.h>
diff --git a/searchcore/src/tests/proton/documentdb/documentdbconfigscout/documentdbconfigscout_test.cpp b/searchcore/src/tests/proton/documentdb/documentdbconfigscout/documentdbconfigscout_test.cpp
index 95ad4bd143b..862792bf274 100644
--- a/searchcore/src/tests/proton/documentdb/documentdbconfigscout/documentdbconfigscout_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/documentdbconfigscout/documentdbconfigscout_test.cpp
@@ -4,7 +4,7 @@
#include <vespa/searchcore/proton/server/documentdbconfig.h>
#include <vespa/searchcore/proton/server/documentdbconfigscout.h>
#include <vespa/searchcore/proton/test/documentdb_config_builder.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/config-attributes.h>
#include <ostream>
diff --git a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
index 808c5743538..cdd275e898d 100644
--- a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
@@ -38,7 +38,7 @@
#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/testkit/test_kit.h>
#include <vespa/vespalib/util/lambdatask.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/util/size_literals.h>
diff --git a/searchcore/src/tests/proton/documentdb/feedview/.gitignore b/searchcore/src/tests/proton/documentdb/feedview/.gitignore
deleted file mode 100644
index 596e11ac15a..00000000000
--- a/searchcore/src/tests/proton/documentdb/feedview/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-searchcore_feedview_test_app
diff --git a/searchcore/src/tests/proton/documentdb/feedview/CMakeLists.txt b/searchcore/src/tests/proton/documentdb/feedview/CMakeLists.txt
deleted file mode 100644
index cbb1612b3f0..00000000000
--- a/searchcore/src/tests/proton/documentdb/feedview/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchcore_feedview_test_app TEST
- SOURCES
- feedview_test.cpp
- DEPENDS
- searchcore_test
- searchcore_server
- searchcore_index
- searchcore_feedoperation
- searchcore_matching
- searchcore_attribute
- searchcore_documentmetastore
- searchcore_bucketdb
- searchcore_pcommon
- searchcore_grouping
- searchcore_proton_metrics
-)
-vespa_add_test(NAME searchcore_feedview_test_app COMMAND searchcore_feedview_test_app)
diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview_test.cpp
index 77ae6be3d65..e2a8b227f57 100644
--- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/feedview_test.cpp
@@ -33,7 +33,7 @@
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/log/log.h>
-LOG_SETUP("feedview_test");
+LOG_SETUP(".feedview_test");
using document::BucketId;
using document::DataType;
@@ -65,6 +65,7 @@ using namespace search::index;
using SerialNum = SearchableFeedView::SerialNum;
using DocumentIdT = search::DocumentIdT;
+namespace {
struct MyLidVector : public std::vector<DocumentIdT>
{
MyLidVector &add(DocumentIdT lid) { push_back(lid); return *this; }
@@ -518,9 +519,9 @@ struct FixtureBase
test::ThreadingServiceObserver _writeService;
SerialNum serial;
std::shared_ptr<MyGidToLidChangeHandler> _gidToLidChangeHandler;
- FixtureBase();
+ FixtureBase() __attribute__((noinline));
- virtual ~FixtureBase();
+ virtual ~FixtureBase() __attribute__((noinline));
const test::DocumentMetaStoreObserver &metaStoreObserver() {
return _dmsc->getObserver();
@@ -650,18 +651,7 @@ struct FixtureBase
return EXPECT_EQUAL(exp, _tracer._os.str());
}
- DocumentContext::List
- makeDummyDocs(uint32_t first, uint32_t count, uint64_t tsfirst) {
- DocumentContext::List docs;
- for (uint32_t i = 0; i < count; ++i) {
- uint32_t id = first + i;
- uint64_t ts = tsfirst + i;
- vespalib::asciistream os;
- os << "id:ns:searchdocument::" << id;
- docs.push_back(doc(os.str(), ts));
- }
- return docs;
- }
+ DocumentContext::List makeDummyDocs(uint32_t first, uint32_t count, uint64_t tsfirst) __attribute__((noinline));
void performCompactLidSpace(uint32_t wantedLidLimit, IDestructorCallback::SP onDone) {
auto &fv = getFeedView();
@@ -718,6 +708,19 @@ FixtureBase::~FixtureBase() {
_service.shutdown();
}
+DocumentContext::List
+FixtureBase::makeDummyDocs(uint32_t first, uint32_t count, uint64_t tsfirst) {
+ DocumentContext::List docs;
+ for (uint32_t i = 0; i < count; ++i) {
+ uint32_t id = first + i;
+ uint64_t ts = tsfirst + i;
+ vespalib::asciistream os;
+ os << "id:ns:searchdocument::" << id;
+ docs.push_back(doc(os.str(), ts));
+ }
+ return docs;
+}
+
void
FixtureBase::populateBeforeCompactLidSpace()
{
@@ -729,44 +732,46 @@ FixtureBase::populateBeforeCompactLidSpace()
struct SearchableFeedViewFixture : public FixtureBase
{
SearchableFeedView fv;
- SearchableFeedViewFixture() :
- FixtureBase(),
- fv(StoreOnlyFeedView::Context(sa, sc._schema, _dmsc,
- sc.getRepo(), _pendingLidsForCommit,
- *_gidToLidChangeHandler, _writeService),
- pc.getParams(),
- FastAccessFeedView::Context(aw, _docIdLimit),
- SearchableFeedView::Context(iw))
- {
- }
- ~SearchableFeedViewFixture() override {
- forceCommitAndWait();
- }
+ SearchableFeedViewFixture() __attribute__((noinline));
+ ~SearchableFeedViewFixture() override __attribute__((noinline));
IFeedView &getFeedView() override { return fv; }
};
+SearchableFeedViewFixture::SearchableFeedViewFixture()
+ : FixtureBase(),
+ fv(StoreOnlyFeedView::Context(sa, sc._schema, _dmsc,
+ sc.getRepo(), _pendingLidsForCommit,
+ *_gidToLidChangeHandler, _writeService),
+ pc.getParams(),
+ FastAccessFeedView::Context(aw, _docIdLimit),
+ SearchableFeedView::Context(iw))
+{ }
+SearchableFeedViewFixture::~SearchableFeedViewFixture() {
+ forceCommitAndWait();
+}
+
struct FastAccessFeedViewFixture : public FixtureBase
{
FastAccessFeedView fv;
- FastAccessFeedViewFixture() :
- FixtureBase(),
- fv(StoreOnlyFeedView::Context(sa, sc._schema, _dmsc, sc.getRepo(), _pendingLidsForCommit,
- *_gidToLidChangeHandler, _writeService),
- pc.getParams(),
- FastAccessFeedView::Context(aw, _docIdLimit))
- {
- }
- ~FastAccessFeedViewFixture() override {
- forceCommitAndWait();
- }
+ FastAccessFeedViewFixture() __attribute__((noinline));
+ ~FastAccessFeedViewFixture() override __attribute__((noinline));
IFeedView &getFeedView() override { return fv; }
};
-void
-assertBucketInfo(const BucketId &ebid,
- const Timestamp &ets,
- uint32_t lid,
- const IDocumentMetaStore &metaStore)
+FastAccessFeedViewFixture::FastAccessFeedViewFixture()
+ : FixtureBase(),
+ fv(StoreOnlyFeedView::Context(sa, sc._schema, _dmsc, sc.getRepo(), _pendingLidsForCommit,
+ *_gidToLidChangeHandler, _writeService),
+ pc.getParams(),
+ FastAccessFeedView::Context(aw, _docIdLimit))
+{ }
+
+FastAccessFeedViewFixture::~FastAccessFeedViewFixture() {
+ forceCommitAndWait();
+}
+
+void assertBucketInfo(const BucketId &ebid, const Timestamp &ets, uint32_t lid, const IDocumentMetaStore &metaStore) __attribute__((noinline));
+void assertBucketInfo(const BucketId &ebid, const Timestamp &ets, uint32_t lid, const IDocumentMetaStore &metaStore)
{
document::GlobalId gid;
EXPECT_TRUE(metaStore.getGid(lid, gid));
@@ -777,8 +782,8 @@ assertBucketInfo(const BucketId &ebid,
EXPECT_EQUAL(ets, meta.timestamp);
}
-void
-assertLidVector(const MyLidVector &exp, const MyLidVector &act)
+void assertLidVector(const MyLidVector &exp, const MyLidVector &act) __attribute__((noinline));
+void assertLidVector(const MyLidVector &exp, const MyLidVector &act)
{
EXPECT_EQUAL(exp.size(), act.size());
for (size_t i = 0; i < exp.size(); ++i) {
@@ -795,6 +800,8 @@ assertAttributeUpdate(SerialNum serialNum, const document::DocumentId &docId,
EXPECT_EQUAL(lid, adapter._updateLid);
}
+}
+
TEST_F("require that put() updates document meta store with bucket info",
SearchableFeedViewFixture)
@@ -1287,9 +1294,3 @@ TEST_F("require that move() notifies gid to lid change handler", SearchableFeedV
f.forceCommitAndWait();
TEST_DO(f.assertChangeHandler(dc2.gid(), 1u, 4u));
}
-
-TEST_MAIN()
-{
- TEST_RUN_ALL();
-}
-
diff --git a/searchcore/src/tests/proton/documentdb/job_tracked_maintenance_job/job_tracked_maintenance_job_test.cpp b/searchcore/src/tests/proton/documentdb/job_tracked_maintenance_job/job_tracked_maintenance_job_test.cpp
index b92560c57e9..e1ec3d2bb29 100644
--- a/searchcore/src/tests/proton/documentdb/job_tracked_maintenance_job/job_tracked_maintenance_job_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/job_tracked_maintenance_job/job_tracked_maintenance_job_test.cpp
@@ -4,7 +4,7 @@
#include <vespa/searchcore/proton/server/i_blockable_maintenance_job.h>
#include <vespa/searchcore/proton/server/job_tracked_maintenance_job.h>
#include <vespa/searchcore/proton/test/simple_job_tracker.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/lambdatask.h>
#include <vespa/vespalib/util/gate.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
diff --git a/searchcore/src/tests/proton/documentdb/maintenancecontroller/.gitignore b/searchcore/src/tests/proton/documentdb/maintenancecontroller/.gitignore
deleted file mode 100644
index 7ce70f9cbcd..00000000000
--- a/searchcore/src/tests/proton/documentdb/maintenancecontroller/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-searchcore_frozenbucketsmap_test_app
-searchcore_maintenancecontroller_test_app
diff --git a/searchcore/src/tests/proton/documentdb/maintenancecontroller/CMakeLists.txt b/searchcore/src/tests/proton/documentdb/maintenancecontroller/CMakeLists.txt
deleted file mode 100644
index 0b4220902dc..00000000000
--- a/searchcore/src/tests/proton/documentdb/maintenancecontroller/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchcore_maintenancecontroller_test_app TEST
- SOURCES
- maintenancecontroller_test.cpp
- DEPENDS
- searchcore_test
- searchcore_server
- searchcore_feedoperation
- searchcore_matching
- searchcore_attribute
- searchcore_documentmetastore
- searchcore_bucketdb
- searchcore_pcommon
- searchcore_persistenceengine
- searchcore_grouping
- searchcore_proton_metrics
- searchlib_test
-)
-vespa_add_test(NAME searchcore_maintenancecontroller_test_app COMMAND searchcore_maintenancecontroller_test_app)
diff --git a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp b/searchcore/src/tests/proton/documentdb/maintenancecontroller_test.cpp
index 509210679da..891af3eda39 100644
--- a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/maintenancecontroller_test.cpp
@@ -35,18 +35,14 @@
#include <vespa/searchcore/proton/test/transport_helper.h>
#include <vespa/searchlib/common/idocumentmetastore.h>
#include <vespa/vespalib/data/slime/slime.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/destructor_callbacks.h>
#include <vespa/vespalib/util/gate.h>
#include <vespa/vespalib/util/lambdatask.h>
#include <vespa/vespalib/util/monitored_refcount.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
-#include <unistd.h>
#include <thread>
-#include <vespa/log/log.h>
-LOG_SETUP("maintenancecontroller_test");
-
using namespace proton;
using namespace vespalib::slime;
using document::BucketId;
@@ -74,6 +70,7 @@ using BlockedReason = IBlockableMaintenanceJob::BlockedReason;
using BucketIdVector = BucketId::List;
constexpr vespalib::duration TIMEOUT = 60s;
+constexpr vespalib::duration DELAY = 10ms;
namespace {
@@ -151,40 +148,13 @@ struct MyDocumentRetriever : public DocumentRetrieverBaseForTest
{
MyDocumentSubDB &_subDB;
- explicit MyDocumentRetriever(MyDocumentSubDB &subDB) noexcept
- : _subDB(subDB)
- {
- }
-
- const document::DocumentTypeRepo &
- getDocumentTypeRepo() const override
- {
- LOG_ABORT("should not be reached");
- }
-
- void
- getBucketMetaData(const storage::spi::Bucket &,
- DocumentMetaData::Vector &) const override
- {
- LOG_ABORT("should not be reached");
- }
- DocumentMetaData
- getDocumentMetaData(const DocumentId &) const override
- {
- return DocumentMetaData();
- }
-
- Document::UP
- getFullDocument(DocumentIdT lid) const override
- {
- return _subDB.getDocument(lid);
- }
+ explicit MyDocumentRetriever(MyDocumentSubDB &subDB) noexcept : _subDB(subDB) { }
- CachedSelect::SP
- parseSelect(const vespalib::string &) const override
- {
- return CachedSelect::SP();
- }
+ const document::DocumentTypeRepo & getDocumentTypeRepo() const override { abort(); }
+ void getBucketMetaData(const storage::spi::Bucket &, DocumentMetaData::Vector &) const override { abort(); }
+ DocumentMetaData getDocumentMetaData(const DocumentId &) const override { return {}; }
+ Document::UP getFullDocument(DocumentIdT lid) const override { return _subDB.getDocument(lid); }
+ CachedSelect::SP parseSelect(const vespalib::string &) const override { return {}; }
};
@@ -268,7 +238,6 @@ struct MySimpleJob : public BlockableMaintenanceJob
{ }
void block() { setBlocked(BlockedReason::FROZEN_BUCKET); }
bool run() override {
- LOG(info, "MySimpleJob::run()");
_latch.countDown();
++_runCnt;
return true;
@@ -284,7 +253,6 @@ struct MySplitJob : public MySimpleJob
{
}
bool run() override {
- LOG(info, "MySplitJob::run()");
_latch.countDown();
++_runCnt;
return _latch.getCount() == 0;
@@ -304,7 +272,7 @@ struct MyLongRunningJob : public BlockableMaintenanceJob
void block() { setBlocked(BlockedReason::FROZEN_BUCKET); }
bool run() override {
_firstRun.countDown();
- usleep(10000);
+ std::this_thread::sleep_for(1ms);
return false;
}
};
@@ -885,9 +853,9 @@ TEST_F("require that document pruner is active", MaintenanceControllerFixture)
ASSERT_TRUE(f._executor.waitIdle(TIMEOUT));
EXPECT_EQUAL(10u, f._removed.getNumUsedLids());
EXPECT_EQUAL(10u, f._removed.getDocumentCount());
- f.setPruneConfig(DocumentDBPruneConfig(200ms, 900s));
- for (uint32_t i = 0; i < 600; ++i) {
- std::this_thread::sleep_for(100ms);
+ f.setPruneConfig(DocumentDBPruneConfig(DELAY, 900s));
+ for (uint32_t i = 0; i < 60000; ++i) {
+ std::this_thread::sleep_for(1ms);
ASSERT_TRUE(f._executor.waitIdle(TIMEOUT));
if (f._removed.getNumUsedLids() != 10u)
break;
@@ -902,9 +870,9 @@ TEST_F("require that heartbeats are scheduled", MaintenanceControllerFixture)
{
f.notifyClusterStateChanged();
f.startMaintenance();
- f.setHeartBeatConfig(DocumentDBHeartBeatConfig(200ms));
- for (uint32_t i = 0; i < 600; ++i) {
- std::this_thread::sleep_for(100ms);
+ f.setHeartBeatConfig(DocumentDBHeartBeatConfig(DELAY));
+ for (uint32_t i = 0; i < 60000; ++i) {
+ std::this_thread::sleep_for(1ms);
if (f._fh.getHeartBeats() != 0u)
break;
}
@@ -913,7 +881,7 @@ TEST_F("require that heartbeats are scheduled", MaintenanceControllerFixture)
TEST_F("require that a simple maintenance job is executed", MaintenanceControllerFixture)
{
- auto job = std::make_unique<MySimpleJob>(200ms, 200ms, 3);
+ auto job = std::make_unique<MySimpleJob>(DELAY, DELAY, 3);
MySimpleJob &myJob = *job;
f._mc.registerJob(std::move(job));
f._injectDefaultJobs = false;
@@ -925,7 +893,7 @@ TEST_F("require that a simple maintenance job is executed", MaintenanceControlle
TEST_F("require that a split maintenance job is executed", MaintenanceControllerFixture)
{
- auto job = std::make_unique<MySplitJob>(200ms, TIMEOUT * 2, 3);
+ auto job = std::make_unique<MySplitJob>(DELAY, TIMEOUT * 2, 3);
MySplitJob &myJob = *job;
f._mc.registerJob(std::move(job));
f._injectDefaultJobs = false;
@@ -937,13 +905,15 @@ TEST_F("require that a split maintenance job is executed", MaintenanceController
TEST_F("require that blocked jobs are not executed", MaintenanceControllerFixture)
{
- auto job = std::make_unique<MySimpleJob>(200ms, 200ms, 0);
+ auto job = std::make_unique<MySimpleJob>(DELAY, DELAY, 0);
MySimpleJob &myJob = *job;
myJob.block();
f._mc.registerJob(std::move(job));
f._injectDefaultJobs = false;
f.startMaintenance();
- std::this_thread::sleep_for(2s);
+ for (uint32_t napCount = 0; (myJob._runCnt != 0) && (napCount < 200); napCount++) {
+ std::this_thread::sleep_for(10ms);
+ }
EXPECT_EQUAL(0u, myJob._runCnt);
}
@@ -951,7 +921,7 @@ TEST_F("require that maintenance controller state list jobs", MaintenanceControl
{
{
auto job1 = std::make_unique<MySimpleJob>(TIMEOUT * 2, TIMEOUT * 2, 0);
- auto job2 = std::make_unique<MyLongRunningJob>(200ms, 200ms);
+ auto job2 = std::make_unique<MyLongRunningJob>(DELAY, DELAY);
auto &longRunningJob = dynamic_cast<MyLongRunningJob &>(*job2);
f._mc.registerJob(std::move(job1));
f._mc.registerJob(std::move(job2));
@@ -1022,8 +992,3 @@ TEST_F("require that delay for prune removed documents is set based on interval
assertPruneRemovedDocumentsConfig(300s, 301s, 301s, f);
assertPruneRemovedDocumentsConfig(299s, 299s, 299s, f);
}
-
-TEST_MAIN()
-{
- TEST_RUN_ALL();
-}
diff --git a/searchcore/src/tests/proton/documentdb/move_operation_limiter/CMakeLists.txt b/searchcore/src/tests/proton/documentdb/move_operation_limiter/CMakeLists.txt
deleted file mode 100644
index 2f10bd9f025..00000000000
--- a/searchcore/src/tests/proton/documentdb/move_operation_limiter/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchcore_move_operation_limiter_test_app TEST
- SOURCES
- move_operation_limiter_test.cpp
- DEPENDS
- searchcore_server
-)
-vespa_add_test(NAME searchcore_move_operation_limiter_test_app COMMAND searchcore_move_operation_limiter_test_app)
diff --git a/searchcore/src/tests/proton/documentdb/storeonlyfeedview/.gitignore b/searchcore/src/tests/proton/documentdb/storeonlyfeedview/.gitignore
deleted file mode 100644
index eaabc7b9279..00000000000
--- a/searchcore/src/tests/proton/documentdb/storeonlyfeedview/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-Makefile
-.depend
-*_test
-searchcore_storeonlyfeedview_test_app
diff --git a/searchcore/src/tests/proton/documentdb/storeonlyfeedview/CMakeLists.txt b/searchcore/src/tests/proton/documentdb/storeonlyfeedview/CMakeLists.txt
deleted file mode 100644
index 58a4afc4a72..00000000000
--- a/searchcore/src/tests/proton/documentdb/storeonlyfeedview/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchcore_storeonlyfeedview_test_app TEST
- SOURCES
- storeonlyfeedview_test.cpp
- DEPENDS
- searchcore_test
- searchcore_server
- searchcore_feedoperation
- searchcore_documentmetastore
- searchcore_bucketdb
- searchcore_proton_metrics
- searchcore_pcommon
-)
-vespa_add_test(NAME searchcore_storeonlyfeedview_test_app COMMAND searchcore_storeonlyfeedview_test_app)
diff --git a/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp b/searchcore/src/tests/proton/documentdb/storeonlyfeedview_test.cpp
index e6923674584..8938f1a0745 100644
--- a/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/storeonlyfeedview_test.cpp
@@ -17,10 +17,7 @@
#include <vespa/searchlib/test/doc_builder.h>
#include <vespa/vespalib/util/destructor_callbacks.h>
#include <vespa/vespalib/util/size_literals.h>
-#include <vespa/vespalib/testkit/testapp.h>
-
-#include <vespa/log/log.h>
-LOG_SETUP("storeonlyfeedview_test");
+#include <vespa/vespalib/testkit/test_kit.h>
using document::BucketId;
using document::DataType;
@@ -314,8 +311,7 @@ struct MoveFixture : public FixtureBase<MoveOperationFeedView> {
});
// First we wait for everything propagated to MinimalFeedView
while (ctx.use_count() > (expected + 1)) {
- LOG(info, "use_count = %ld", ctx.use_count());
- std::this_thread::sleep_for(1s);
+ std::this_thread::sleep_for(10ms);
}
// And then we must wait for everyone else to finish up too.
feedview->waitFor(expected*2);
@@ -447,5 +443,3 @@ TEST_F("require that heartbeat propagates and commits meta store", Fixture)
}
} // namespace
-
-TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchcore/src/tests/proton/documentdb/threading_service_config/CMakeLists.txt b/searchcore/src/tests/proton/documentdb/threading_service_config/CMakeLists.txt
deleted file mode 100644
index f03d0597367..00000000000
--- a/searchcore/src/tests/proton/documentdb/threading_service_config/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchcore_threading_service_config_test_app TEST
- SOURCES
- threading_service_config_test.cpp
- DEPENDS
- searchcore_server
-)
-vespa_add_test(NAME searchcore_threading_service_config_test_app COMMAND searchcore_threading_service_config_test_app)
diff --git a/searchcore/src/tests/proton/documentdb/vespa_testrunner.cpp b/searchcore/src/tests/proton/documentdb/vespa_testrunner.cpp
new file mode 100644
index 00000000000..1e4e79047c3
--- /dev/null
+++ b/searchcore/src/tests/proton/documentdb/vespa_testrunner.cpp
@@ -0,0 +1,8 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Unit tests for predicate_index.
+#include <vespa/vespalib/testkit/test_kit.h>
+
+#include <vespa/log/log.h>
+LOG_SETUP("proton_common_test");
+
+TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp b/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp
index 4bcfb2eedd9..335119927f7 100644
--- a/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp
+++ b/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp
@@ -1,6 +1,6 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/searchcore/proton/documentmetastore/i_store.h>
#include <vespa/searchcore/proton/documentmetastore/lidreusedelayer.h>
#include <vespa/searchcore/proton/test/thread_utils.h>
diff --git a/searchcore/src/tests/proton/feedoperation/.gitignore b/searchcore/src/tests/proton/feedoperation/.gitignore
deleted file mode 100644
index cfdeb9049b2..00000000000
--- a/searchcore/src/tests/proton/feedoperation/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-*_test
-.depend
-Makefile
-searchcore_feedoperation_test_app
diff --git a/searchcore/src/tests/proton/feedoperation/CMakeLists.txt b/searchcore/src/tests/proton/feedoperation/CMakeLists.txt
deleted file mode 100644
index fe9d3bad302..00000000000
--- a/searchcore/src/tests/proton/feedoperation/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchcore_feedoperation_test_app TEST
- SOURCES
- feedoperation_test.cpp
- DEPENDS
- searchcore_feedoperation
- searchcore_pcommon
-)
-vespa_add_test(NAME searchcore_feedoperation_test_app COMMAND searchcore_feedoperation_test_app)
diff --git a/searchcore/src/tests/proton/flushengine/flushengine_test.cpp b/searchcore/src/tests/proton/flushengine/flushengine_test.cpp
index 9a0dc47771f..dc9dcd3e0b0 100644
--- a/searchcore/src/tests/proton/flushengine/flushengine_test.cpp
+++ b/searchcore/src/tests/proton/flushengine/flushengine_test.cpp
@@ -13,7 +13,7 @@
#include <vespa/searchlib/common/flush_token.h>
#include <vespa/vespalib/data/slime/slime.h>
#include <vespa/vespalib/test/insertion_operators.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <mutex>
#include <thread>
diff --git a/searchcore/src/tests/proton/flushengine/prepare_restart_flush_strategy/prepare_restart_flush_strategy_test.cpp b/searchcore/src/tests/proton/flushengine/prepare_restart_flush_strategy/prepare_restart_flush_strategy_test.cpp
index 06a2ebec958..7abac088011 100644
--- a/searchcore/src/tests/proton/flushengine/prepare_restart_flush_strategy/prepare_restart_flush_strategy_test.cpp
+++ b/searchcore/src/tests/proton/flushengine/prepare_restart_flush_strategy/prepare_restart_flush_strategy_test.cpp
@@ -1,5 +1,5 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/searchcore/proton/flushengine/active_flush_stats.h>
#include <vespa/searchcore/proton/flushengine/flush_target_candidate.h>
diff --git a/searchcore/src/tests/proton/flushengine/shrink_lid_space_flush_target/shrink_lid_space_flush_target_test.cpp b/searchcore/src/tests/proton/flushengine/shrink_lid_space_flush_target/shrink_lid_space_flush_target_test.cpp
index 39175e8c27c..70a8887b9bb 100644
--- a/searchcore/src/tests/proton/flushengine/shrink_lid_space_flush_target/shrink_lid_space_flush_target_test.cpp
+++ b/searchcore/src/tests/proton/flushengine/shrink_lid_space_flush_target/shrink_lid_space_flush_target_test.cpp
@@ -1,5 +1,5 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h>
#include <vespa/searchlib/common/i_compactable_lid_space.h>
diff --git a/searchcore/src/tests/proton/index/index_writer/index_writer_test.cpp b/searchcore/src/tests/proton/index/index_writer/index_writer_test.cpp
index 51465c59ac7..c52eb940817 100644
--- a/searchcore/src/tests/proton/index/index_writer/index_writer_test.cpp
+++ b/searchcore/src/tests/proton/index/index_writer/index_writer_test.cpp
@@ -4,7 +4,7 @@
#include <vespa/document/fieldvalue/document.h>
#include <vespa/searchcore/proton/test/mock_index_manager.h>
#include <vespa/searchlib/test/doc_builder.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/log/log.h>
diff --git a/searchcore/src/tests/proton/initializer/task_runner_test.cpp b/searchcore/src/tests/proton/initializer/task_runner_test.cpp
index 82cce924832..a8b9969299f 100644
--- a/searchcore/src/tests/proton/initializer/task_runner_test.cpp
+++ b/searchcore/src/tests/proton/initializer/task_runner_test.cpp
@@ -1,7 +1,7 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/log/log.h>
LOG_SETUP("task_runner_test");
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/searchcore/proton/initializer/initializer_task.h>
#include <vespa/searchcore/proton/initializer/task_runner.h>
#include <vespa/vespalib/stllike/string.h>
diff --git a/searchcore/src/tests/proton/matching/CMakeLists.txt b/searchcore/src/tests/proton/matching/CMakeLists.txt
index c35e9498986..be9e10c45a0 100644
--- a/searchcore/src/tests/proton/matching/CMakeLists.txt
+++ b/searchcore/src/tests/proton/matching/CMakeLists.txt
@@ -13,7 +13,7 @@ vespa_add_executable(searchcore_matching_test_app TEST
searchcore_grouping
searchlib_test
)
-vespa_add_test(NAME searchcore_matching_test_app COMMAND searchcore_matching_test_app)
+vespa_add_test(NAME searchcore_matching_test_app COMMAND searchcore_matching_test_app COST 100)
vespa_add_executable(searchcore_sessionmanager_test_app TEST
SOURCES
sessionmanager_test.cpp
diff --git a/searchcore/src/tests/proton/matching/match_loop_communicator/CMakeLists.txt b/searchcore/src/tests/proton/matching/match_loop_communicator/CMakeLists.txt
index b545023ce97..b5b71836581 100644
--- a/searchcore/src/tests/proton/matching/match_loop_communicator/CMakeLists.txt
+++ b/searchcore/src/tests/proton/matching/match_loop_communicator/CMakeLists.txt
@@ -4,5 +4,6 @@ vespa_add_executable(searchcore_match_loop_communicator_test_app TEST
match_loop_communicator_test.cpp
DEPENDS
searchcore_matching
+ GTest::gtest
)
vespa_add_test(NAME searchcore_match_loop_communicator_test_app COMMAND searchcore_match_loop_communicator_test_app)
diff --git a/searchcore/src/tests/proton/matching/match_loop_communicator/match_loop_communicator_test.cpp b/searchcore/src/tests/proton/matching/match_loop_communicator/match_loop_communicator_test.cpp
index d5ee88e1617..dc05471a1eb 100644
--- a/searchcore/src/tests/proton/matching/match_loop_communicator/match_loop_communicator_test.cpp
+++ b/searchcore/src/tests/proton/matching/match_loop_communicator/match_loop_communicator_test.cpp
@@ -1,7 +1,10 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/searchcore/proton/matching/match_loop_communicator.h>
+#include <vespa/searchlib/features/first_phase_rank_lookup.h>
+#include <vespa/vespalib/gtest/gtest.h>
+#include <vespa/vespalib/test/nexus.h>
#include <algorithm>
+#include <atomic>
using namespace proton::matching;
@@ -12,10 +15,22 @@ using Hit = MatchLoopCommunicator::Hit;
using Hits = MatchLoopCommunicator::Hits;
using TaggedHit = MatchLoopCommunicator::TaggedHit;
using TaggedHits = MatchLoopCommunicator::TaggedHits;
+using search::features::FirstPhaseRankLookup;
using search::queryeval::SortedHitSequence;
+using vespalib::test::Nexus;
+
+namespace search::queryeval {
+
+void PrintTo(const Scores& scores, std::ostream* os) {
+ *os << "{" << scores.low << "," << scores.high << "}";
+}
+
+}
std::vector<Hit> hit_vec(std::vector<Hit> list) { return list; }
+auto do_nothing = []() noexcept {};
+
Hits makeScores(size_t id) {
switch (id) {
case 0: return {{1, 5.4}, {2, 4.4}, {3, 3.4}, {4, 2.4}, {5, 1.4}};
@@ -27,6 +42,13 @@ Hits makeScores(size_t id) {
return {};
}
+Hits make_first_scores(size_t id, size_t size) {
+ auto result = makeScores(id);
+ EXPECT_LE(size, result.size());
+ result.resize(size);
+ return result;
+}
+
std::tuple<size_t,Hits,RangePair> second_phase(MatchLoopCommunicator &com, const Hits &hits, size_t thread_id, double delta = 0.0) {
std::vector<uint32_t> refs;
for (size_t i = 0; i < hits.size(); ++i) {
@@ -60,25 +82,6 @@ size_t my_work_size(MatchLoopCommunicator &com, const Hits &hits, size_t thread_
return work_size;
}
-void equal(size_t count, const Hits & a, const Hits & b) {
- EXPECT_EQUAL(count, b.size());
- for (size_t i(0); i < count; i++) {
- EXPECT_EQUAL(a[i].first, b[i].first);
- EXPECT_EQUAL(a[i].second , b[i].second);
- }
-}
-
-void equal_range(const Range &a, const Range &b) {
- EXPECT_EQUAL(a.isValid(), b.isValid());
- EXPECT_EQUAL(a.low, b.low);
- EXPECT_EQUAL(a.high, b.high);
-}
-
-void equal_ranges(const RangePair &a, const RangePair &b) {
- TEST_DO(equal_range(a.first, b.first));
- TEST_DO(equal_range(a.second, b.second));
-}
-
struct EveryOdd : public search::queryeval::IDiversifier {
bool accepted(uint32_t docId) override {
return docId & 0x01;
@@ -89,122 +92,242 @@ struct None : public search::queryeval::IDiversifier {
bool accepted(uint32_t) override { return false; }
};
-TEST_F("require that selectBest gives appropriate results for single thread", MatchLoopCommunicator(num_threads, 3)) {
- TEST_DO(equal(2u, hit_vec({{1, 5}, {2, 4}}), selectBest(f1, hit_vec({{1, 5}, {2, 4}}), thread_id)));
- TEST_DO(equal(3u, hit_vec({{1, 5}, {2, 4}, {3, 3}}), selectBest(f1, hit_vec({{1, 5}, {2, 4}, {3, 3}}), thread_id)));
- TEST_DO(equal(3u, hit_vec({{1, 5}, {2, 4}, {3, 3}}), selectBest(f1, hit_vec({{1, 5}, {2, 4}, {3, 3}, {4, 2}}), thread_id)));
+TEST(MatchLoopCommunicatorTest, require_that_selectBest_gives_appropriate_results_for_single_thread)
+{
+ constexpr size_t num_threads = 1;
+ constexpr size_t thread_id = 0;
+ MatchLoopCommunicator f1(num_threads, 3);
+ EXPECT_EQ(hit_vec({{1, 5}, {2, 4}}), selectBest(f1, hit_vec({{1, 5}, {2, 4}}), thread_id));
+ EXPECT_EQ(hit_vec({{1, 5}, {2, 4}, {3, 3}}), selectBest(f1, hit_vec({{1, 5}, {2, 4}, {3, 3}}), thread_id));
+ EXPECT_EQ(hit_vec({{1, 5}, {2, 4}, {3, 3}}), selectBest(f1, hit_vec({{1, 5}, {2, 4}, {3, 3}, {4, 2}}), thread_id));
}
-TEST_F("require that selectBest gives appropriate results for single thread with filter",
- MatchLoopCommunicator(num_threads, 3, std::make_unique<EveryOdd>()))
+TEST(MatchLoopCommunicatorTest, require_that_selectBest_gives_appropriate_results_for_single_thread_with_filter)
{
- TEST_DO(equal(1u, hit_vec({{1, 5}}), selectBest(f1, hit_vec({{1, 5}, {2, 4}}), thread_id)));
- TEST_DO(equal(2u, hit_vec({{1, 5}, {3, 3}}), selectBest(f1, hit_vec({{1, 5}, {2, 4}, {3, 3}}), thread_id)));
- TEST_DO(equal(3u, hit_vec({{1, 5}, {3, 3}, {5, 1}}), selectBest(f1, hit_vec({{1, 5}, {2, 4}, {3, 3}, {4, 2}, {5, 1}, {6, 0}}), thread_id)));
+ constexpr size_t num_threads = 1;
+ constexpr size_t thread_id = 0;
+ MatchLoopCommunicator f1(num_threads, 3, std::make_unique<EveryOdd>(), nullptr, do_nothing);
+ EXPECT_EQ(hit_vec({{1, 5}}), selectBest(f1, hit_vec({{1, 5}, {2, 4}}), thread_id));
+ EXPECT_EQ(hit_vec({{1, 5}, {3, 3}}), selectBest(f1, hit_vec({{1, 5}, {2, 4}, {3, 3}}), thread_id));
+ EXPECT_EQ(hit_vec({{1, 5}, {3, 3}, {5, 1}}), selectBest(f1, hit_vec({{1, 5}, {2, 4}, {3, 3}, {4, 2}, {5, 1}, {6, 0}}), thread_id));
}
-TEST_MT_F("require that selectBest works with no hits", 10, MatchLoopCommunicator(num_threads, 10)) {
- EXPECT_TRUE(selectBest(f1, hit_vec({}), thread_id).empty());
+TEST(MatchLoopCommunicatorTest, require_that_selectBest_works_with_no_hits)
+{
+ constexpr size_t num_threads = 10;
+ MatchLoopCommunicator f1(num_threads, 10);
+ auto task = [&f1](Nexus& ctx) {
+ EXPECT_TRUE(selectBest(f1, hit_vec({}), ctx.thread_id()).empty());
+ };
+ Nexus::run(num_threads, task);
}
-TEST_MT_F("require that selectBest works with too many hits from all threads", 5, MatchLoopCommunicator(num_threads, 13)) {
- if (thread_id < 3) {
- TEST_DO(equal(3u, makeScores(thread_id), selectBest(f1, makeScores(thread_id), thread_id)));
- } else {
- TEST_DO(equal(2u, makeScores(thread_id), selectBest(f1, makeScores(thread_id), thread_id)));
- }
+TEST(MatchLoopCommunicatorTest, require_that_selectBest_works_with_too_many_hits_from_all_threads)
+{
+ constexpr size_t num_threads = 5;
+ MatchLoopCommunicator f1(num_threads, 13);
+ auto task = [&f1](Nexus& ctx) {
+ auto thread_id = ctx.thread_id();
+ if (thread_id < 3) {
+ EXPECT_EQ(make_first_scores(thread_id, 3), selectBest(f1, makeScores(thread_id), thread_id));
+ } else {
+ EXPECT_EQ(make_first_scores(thread_id, 2), selectBest(f1, makeScores(thread_id), thread_id));
+ }
+ };
+ Nexus::run(num_threads, task);
}
-TEST_MT_F("require that selectBest works with some exhausted threads", 5, MatchLoopCommunicator(num_threads, 22)) {
- if (thread_id < 2) {
- TEST_DO(equal(5u, makeScores(thread_id), selectBest(f1, makeScores(thread_id), thread_id)));
- } else {
- TEST_DO(equal(4u, makeScores(thread_id), selectBest(f1, makeScores(thread_id), thread_id)));
- }
+TEST(MatchLoopCommunicatorTest, require_that_selectBest_works_with_some_exhausted_threads)
+{
+ constexpr size_t num_threads = 5;
+ MatchLoopCommunicator f1(num_threads, 22);
+ auto task = [&f1](Nexus& ctx) {
+ auto thread_id = ctx.thread_id();
+ if (thread_id < 2) {
+ EXPECT_EQ(makeScores(thread_id), selectBest(f1, makeScores(thread_id), thread_id));
+ } else {
+ EXPECT_EQ(make_first_scores(thread_id, 4), selectBest(f1, makeScores(thread_id), thread_id));
+ }
+ };
+ Nexus::run(num_threads, task);
}
-TEST_MT_F("require that selectBest can select all hits from all threads", 5, MatchLoopCommunicator(num_threads, 100)) {
- EXPECT_EQUAL(5u, selectBest(f1, makeScores(thread_id), thread_id).size());
+TEST(MatchLoopCommunicatorTest, require_that_selectBest_can_select_all_hits_from_all_threads)
+{
+ constexpr size_t num_threads = 5;
+ MatchLoopCommunicator f1(num_threads, 100);
+ auto task = [&f1](Nexus& ctx) {
+ auto thread_id = ctx.thread_id();
+ EXPECT_EQ(5u, selectBest(f1, makeScores(thread_id), thread_id).size());
+ };
+ Nexus::run(num_threads, task);
}
-TEST_MT_F("require that selectBest works with some empty threads", 10, MatchLoopCommunicator(num_threads, 7)) {
- if (thread_id < 2) {
- TEST_DO(equal(2u, makeScores(thread_id), selectBest(f1, makeScores(thread_id), thread_id)));
- } else if (thread_id < 5) {
- TEST_DO(equal(1u, makeScores(thread_id), selectBest(f1, makeScores(thread_id), thread_id)));
- } else {
- EXPECT_TRUE(selectBest(f1, makeScores(thread_id), thread_id).empty());
- }
+TEST(MatchLoopCommunicatorTest, require_that_selectBest_works_with_some_empty_threads)
+{
+ constexpr size_t num_threads = 5;
+ MatchLoopCommunicator f1(num_threads, 7);
+ auto task = [&f1](Nexus& ctx) {
+ auto thread_id = ctx.thread_id();
+ if (thread_id < 2) {
+ EXPECT_EQ(make_first_scores(thread_id, 2), selectBest(f1, makeScores(thread_id), thread_id));
+ } else if (thread_id < 5) {
+ EXPECT_EQ(make_first_scores(thread_id, 1), selectBest(f1, makeScores(thread_id), thread_id));
+ } else {
+ EXPECT_TRUE(selectBest(f1, makeScores(thread_id), thread_id).empty());
+ }
+ };
+ Nexus::run(num_threads, task);
}
-TEST_F("require that rangeCover works with a single thread", MatchLoopCommunicator(num_threads, 5)) {
+TEST(MatchLoopCommunicatorTest, require_that_rangeCover_works_with_a_single_thread)
+{
+ constexpr size_t num_threads = 1;
+ constexpr size_t thread_id = 0;
+ MatchLoopCommunicator f1(num_threads, 5);
RangePair res = rangeCover(f1, hit_vec({{1, 7.5}, {2, 1.5}}), thread_id, 10);
- TEST_DO(equal_ranges(RangePair({1.5, 7.5}, {11.5, 17.5}), res));
+ EXPECT_EQ(RangePair({1.5, 7.5}, {11.5, 17.5}), res);
}
-TEST_MT_F("require that rangeCover works with multiple threads", 5, MatchLoopCommunicator(num_threads, 10)) {
- RangePair res = rangeCover(f1, hit_vec({{thread_id * 100 + 1, 100.0 + thread_id}, {thread_id * 100 + 2, 100.0 - thread_id}}), thread_id, 10);
- TEST_DO(equal_ranges(RangePair({96.0, 104.0}, {106.0, 114.0}), res));
+TEST(MatchLoopCommunicatorTest, require_that_rangeCover_works_with_multiple_threads)
+{
+ constexpr size_t num_threads = 5;
+ MatchLoopCommunicator f1(num_threads, 10);
+ auto task = [&f1](Nexus& ctx) {
+ auto thread_id = ctx.thread_id();
+ RangePair res = rangeCover(f1, hit_vec({{thread_id * 100 + 1, 100.0 + thread_id}, {thread_id * 100 + 2, 100.0 - thread_id}}), thread_id, 10);
+ EXPECT_EQ(RangePair({96.0, 104.0}, {106.0, 114.0}), res);
+ };
+ Nexus::run(num_threads, task);
}
-TEST_MT_F("require that rangeCover works with no hits", 10, MatchLoopCommunicator(num_threads, 5)) {
- RangePair res = rangeCover(f1, hit_vec({}), thread_id, 10);
- TEST_DO(equal_ranges(RangePair({}, {}), res));
+TEST(MatchLoopCommunicatorTest, require_that_rangeCover_works_with_no_hits)
+{
+ constexpr size_t num_threads = 10;
+ MatchLoopCommunicator f1(num_threads, 5);
+ auto task = [&f1](Nexus& ctx) {
+ auto thread_id = ctx.thread_id();
+ RangePair res = rangeCover(f1, hit_vec({}), thread_id, 10);
+ EXPECT_EQ(RangePair({}, {}), res);
+ };
+ Nexus::run(num_threads, task);
}
-TEST_FFF("require that hits dropped due to lack of diversity affects range cover result",
- MatchLoopCommunicator(num_threads, 3),
- MatchLoopCommunicator(num_threads, 3, std::make_unique<EveryOdd>()),
- MatchLoopCommunicator(num_threads, 3, std::make_unique<None>()))
+TEST(MatchLoopCommunicatorTest, require_that_hits_dropped_due_to_lack_of_diversity_affects_range_cover_result)
{
+ constexpr size_t num_threads = 1;
+ constexpr size_t thread_id = 0;
+ MatchLoopCommunicator f1(num_threads, 3);
+ MatchLoopCommunicator f2(num_threads, 3, std::make_unique<EveryOdd>(), nullptr, do_nothing);
+ MatchLoopCommunicator f3(num_threads, 3, std::make_unique<None>(), nullptr, do_nothing);
auto hits_in = hit_vec({{1, 5}, {2, 4}, {3, 3}, {4, 2}, {5, 1}});
auto [my_work1, hits1, ranges1] = second_phase(f1, hits_in, thread_id, 10);
auto [my_work2, hits2, ranges2] = second_phase(f2, hits_in, thread_id, 10);
auto [my_work3, hits3, ranges3] = second_phase(f3, hits_in, thread_id, 10);
- EXPECT_EQUAL(my_work1, 3u);
- EXPECT_EQUAL(my_work2, 3u);
- EXPECT_EQUAL(my_work3, 0u);
+ EXPECT_EQ(my_work1, 3u);
+ EXPECT_EQ(my_work2, 3u);
+ EXPECT_EQ(my_work3, 0u);
- TEST_DO(equal(3u, hit_vec({{1, 15}, {2, 14}, {3, 13}}), hits1));
- TEST_DO(equal(3u, hit_vec({{1, 15}, {3, 13}, {5, 11}}), hits2));
- TEST_DO(equal(0u, hit_vec({}), hits3));
+ EXPECT_EQ(hit_vec({{1, 15}, {2, 14}, {3, 13}}), hits1);
+ EXPECT_EQ(hit_vec({{1, 15}, {3, 13}, {5, 11}}), hits2);
+ EXPECT_EQ(hit_vec({}), hits3);
- TEST_DO(equal_ranges(RangePair({3,5},{13,15}), ranges1));
- TEST_DO(equal_ranges(RangePair({4,5},{11,15}), ranges2)); // best dropped: 4
+ EXPECT_EQ(RangePair({3,5},{13,15}), ranges1);
+ EXPECT_EQ(RangePair({4,5},{11,15}), ranges2); // best dropped: 4
// note that the 'drops all hits due to diversity' case will
// trigger much of the same code path as dropping second phase
// ranking due to hard doom.
- TEST_DO(equal_ranges(RangePair({},{}), ranges3));
+ EXPECT_EQ(RangePair({},{}), ranges3);
}
-TEST_MT_F("require that estimate_match_frequency will count hits and docs across threads", 4, MatchLoopCommunicator(num_threads, 5)) {
- double freq = (0.0/10.0 + 1.0/11.0 + 2.0/12.0 + 3.0/13.0) / 4.0;
- EXPECT_APPROX(freq, f1.estimate_match_frequency(Matches(thread_id, thread_id + 10)), 0.00001);
+TEST(MatchLoopCommunicatorTest, require_that_estimate_match_frequency_will_count_hits_and_docs_across_threads)
+{
+ constexpr size_t num_threads = 4;
+ MatchLoopCommunicator f1(num_threads, 5);
+ auto task = [&f1](Nexus& ctx) {
+ auto thread_id = ctx.thread_id();
+ double freq = (0.0/10.0 + 1.0/11.0 + 2.0/12.0 + 3.0/13.0) / 4.0;
+ EXPECT_NEAR(freq, f1.estimate_match_frequency(Matches(thread_id, thread_id + 10)), 0.00001);
+ };
+ Nexus::run(num_threads, task);
}
-TEST_MT_F("require that second phase work is evenly distributed among search threads", 5, MatchLoopCommunicator(num_threads, 20)) {
- size_t num_hits = thread_id * 5;
- size_t docid = thread_id * 100;
- double score = thread_id * 100.0;
- Hits my_hits;
- for(size_t i = 0; i < num_hits; ++i) {
- my_hits.emplace_back(++docid, score);
- score -= 1.0;
- }
- auto [my_work, best_hits, ranges] = second_phase(f1, my_hits, thread_id, 1000.0);
- EXPECT_EQUAL(my_work, 4u);
- TEST_DO(equal_ranges(RangePair({381,400},{1381,1400}), ranges));
- if (thread_id == 4) {
- for (auto &hit: my_hits) {
- hit.second += 1000.0;
- }
- TEST_DO(equal(num_hits, my_hits, best_hits));
- } else {
- EXPECT_TRUE(best_hits.empty());
+TEST(MatchLoopCommunicatorTest, require_that_second_phase_work_is_evenly_distributed_among_search_threads)
+{
+ constexpr size_t num_threads = 5;
+ MatchLoopCommunicator f1(num_threads, 20);
+ auto task = [&f1](Nexus& ctx) {
+ auto thread_id = ctx.thread_id();
+ size_t num_hits = thread_id * 5;
+ size_t docid = thread_id * 100;
+ double score = thread_id * 100.0;
+ Hits my_hits;
+ for(size_t i = 0; i < num_hits; ++i) {
+ my_hits.emplace_back(++docid, score);
+ score -= 1.0;
+ }
+ auto [my_work, best_hits, ranges] = second_phase(f1, my_hits, thread_id, 1000.0);
+ EXPECT_EQ(my_work, 4u);
+ EXPECT_EQ(RangePair({381,400},{1381,1400}), ranges);
+ if (thread_id == 4) {
+ for (auto &hit: my_hits) {
+ hit.second += 1000.0;
+ }
+ EXPECT_EQ(my_hits, best_hits);
+ } else {
+ EXPECT_TRUE(best_hits.empty());
+ }
+ };
+ Nexus::run(num_threads, task);
+}
+
+namespace {
+
+std::vector<double> extract_ranks(const FirstPhaseRankLookup& l) {
+ std::vector<double> result;
+ for (uint32_t docid = 21; docid < 26; ++docid) {
+ result.emplace_back(l.lookup(docid));
}
+ return result;
+}
+
+search::feature_t unranked = std::numeric_limits<search::feature_t>::max();
+
+using FeatureVec = std::vector<search::feature_t>;
+
+}
+
+TEST(MatchLoopCommunicatorTest, require_that_first_phase_rank_lookup_is_populated)
+{
+ constexpr size_t num_threads = 1;
+ constexpr size_t thread_id = 0;
+ FirstPhaseRankLookup l1;
+ FirstPhaseRankLookup l2;
+ MatchLoopCommunicator f1(num_threads, 3, {}, &l1, do_nothing);
+ MatchLoopCommunicator f2(num_threads, 3, std::make_unique<EveryOdd>(), &l2, do_nothing);
+ auto hits_in = hit_vec({{21, 5}, {22, 4}, {23, 3}, {24, 2}, {25, 1}});
+ auto res1 = second_phase(f1, hits_in, thread_id, 10);
+ auto res2 = second_phase(f2, hits_in, thread_id, 10);
+ EXPECT_EQ(FeatureVec({1, 2, 3, unranked, unranked}), extract_ranks(l1));
+ EXPECT_EQ(FeatureVec({1, unranked, 3, unranked, 5}), extract_ranks(l2));
+}
+
+TEST(MatchLoopCommunicatorTest, require_that_before_second_phase_is_called_once)
+{
+ constexpr size_t num_threads = 5;
+ std::atomic<int> cnt(0);
+ auto before_second_phase = [&cnt]() noexcept { ++cnt; };
+ MatchLoopCommunicator f1(num_threads, 3, {}, nullptr, before_second_phase);
+ auto task = [&f1](Nexus& ctx) {
+ auto thread_id = ctx.thread_id();
+ auto hits_in = hit_vec({});
+ (void) second_phase(f1, hits_in, thread_id, 1000.0);
+ };
+ Nexus::run(num_threads, task);
+ EXPECT_EQ(1, cnt.load(std::memory_order_acquire));
}
-TEST_MAIN() { TEST_RUN_ALL(); }
+GTEST_MAIN_RUN_ALL_TESTS()
diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp
index 6dd8a93bcbd..fc0e5acdaa0 100644
--- a/searchcore/src/tests/proton/matching/matching_test.cpp
+++ b/searchcore/src/tests/proton/matching/matching_test.cpp
@@ -31,9 +31,10 @@
#include <vespa/eval/eval/simple_value.h>
#include <vespa/eval/eval/tensor_spec.h>
#include <vespa/eval/eval/value_codec.h>
+#include <vespa/vespalib/gtest/gtest.h>
#include <vespa/vespalib/objects/nbostream.h>
-#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/featureset.h>
+#include <vespa/vespalib/util/limited_thread_bundle_wrapper.h>
#include <vespa/vespalib/util/simple_thread_bundle.h>
#include <vespa/vespalib/util/testclock.h>
#include <vespa/vespalib/stllike/asciistream.h>
@@ -65,6 +66,97 @@ using vespalib::eval::TensorSpec;
using vespalib::FeatureSet;
using vespalib::nbostream;
+constexpr uint32_t NUM_DOCS = 1000;
+
+class MatchingTestSharedState {
+ std::unique_ptr<vespalib::SimpleThreadBundle> _thread_bundle;
+ std::unique_ptr<MockAttributeContext> _attribute_context;
+ std::unique_ptr<DocumentMetaStore> _meta_store;
+public:
+ static constexpr size_t max_threads = 75;
+ MatchingTestSharedState();
+ ~MatchingTestSharedState();
+ vespalib::ThreadBundle& thread_bundle();
+ IAttributeContext& attribute_context();
+ const proton::IDocumentMetaStore& meta_store();
+};
+
+MatchingTestSharedState::MatchingTestSharedState()
+ : _thread_bundle(),
+ _attribute_context(),
+ _meta_store()
+{
+}
+
+MatchingTestSharedState::~MatchingTestSharedState() = default;
+
+vespalib::ThreadBundle&
+MatchingTestSharedState::thread_bundle()
+{
+ if (!_thread_bundle) {
+ _thread_bundle = std::make_unique<vespalib::SimpleThreadBundle>(max_threads);
+ }
+ return *_thread_bundle;
+}
+
+IAttributeContext&
+MatchingTestSharedState::attribute_context()
+{
+ if (!_attribute_context) {
+ _attribute_context = std::make_unique<MockAttributeContext>();
+ // attribute context
+ {
+ auto attr = std::make_shared<SingleInt32ExtAttribute>("a1");
+ AttributeVector::DocId docid(0);
+ for (uint32_t i = 0; i < NUM_DOCS; ++i) {
+ attr->addDoc(docid);
+ attr->add(i, docid); // value = docid
+ }
+ assert(docid + 1 == NUM_DOCS);
+ _attribute_context->add(attr);
+ }
+ {
+ auto attr = std::make_shared<SingleInt32ExtAttribute>("a2");
+ AttributeVector::DocId docid(0);
+ for (uint32_t i = 0; i < NUM_DOCS; ++i) {
+ attr->addDoc(docid);
+ attr->add(i * 2, docid); // value = docid * 2
+ }
+ assert(docid + 1 == NUM_DOCS);
+ _attribute_context->add(attr);
+ }
+ {
+ auto attr = std::make_shared<SingleInt32ExtAttribute>("a3");
+ AttributeVector::DocId docid(0);
+ for (uint32_t i = 0; i < NUM_DOCS; ++i) {
+ attr->addDoc(docid);
+ attr->add(i%10, docid);
+ }
+ assert(docid + 1 == NUM_DOCS);
+ _attribute_context->add(attr);
+ }
+ }
+ return *_attribute_context;
+}
+
+const proton::IDocumentMetaStore&
+MatchingTestSharedState::meta_store()
+{
+ if (!_meta_store) {
+ _meta_store = std::make_unique<DocumentMetaStore>(std::make_shared<bucketdb::BucketDBOwner>());
+ // metaStore
+ for (uint32_t i = 0; i < NUM_DOCS; ++i) {
+ document::DocumentId docId(vespalib::make_string("id:ns:searchdocument::%u", i));
+ const document::GlobalId &gid = docId.getGlobalId();
+ document::BucketId bucketId(BucketFactory::getBucketId(docId));
+ uint32_t docSize = 1;
+ _meta_store->put(gid, bucketId, Timestamp(0u), docSize, i, 0u);
+ _meta_store->setBucketState(bucketId, true);
+ }
+ }
+ return *_meta_store;
+}
+
vespalib::ThreadBundle &ttb() { return vespalib::ThreadBundle::trivial(); }
void inject_match_phase_limiting(Properties &setup, const vespalib::string &attribute, size_t max_hits, bool descending)
@@ -106,8 +198,6 @@ vespalib::string make_same_element_stack_dump(const vespalib::string &a1_term, c
//-----------------------------------------------------------------------------
-const uint32_t NUM_DOCS = 1000;
-
struct EmptyRankingAssetsRepo : public search::fef::IRankingAssetsRepo {
vespalib::eval::ConstantValue::UP getConstant(const vespalib::string &) const override {
return {};
@@ -125,18 +215,19 @@ struct EmptyRankingAssetsRepo : public search::fef::IRankingAssetsRepo {
//-----------------------------------------------------------------------------
struct MyWorld {
+ MatchingTestSharedState& shared_state;
Schema schema;
Properties config;
FakeSearchContext searchContext;
- MockAttributeContext attributeContext;
+ IAttributeContext& attributeContext;
std::shared_ptr<SessionManager> sessionManager;
- DocumentMetaStore metaStore;
+ const proton::IDocumentMetaStore& metaStore;
MatchingStats matchingStats;
vespalib::TestClock clock;
QueryLimiter queryLimiter;
EmptyRankingAssetsRepo constantValueRepo;
- MyWorld();
+ MyWorld(MatchingTestSharedState& shared_state);
~MyWorld();
void basicSetup(size_t heapSize=10, size_t arraySize=100) {
@@ -172,50 +263,9 @@ struct MyWorld {
// odd -> 1
}
- // attribute context
- {
- auto attr = std::make_shared<SingleInt32ExtAttribute>("a1");
- AttributeVector::DocId docid(0);
- for (uint32_t i = 0; i < NUM_DOCS; ++i) {
- attr->addDoc(docid);
- attr->add(i, docid); // value = docid
- }
- assert(docid + 1 == NUM_DOCS);
- attributeContext.add(attr);
- }
- {
- auto attr = std::make_shared<SingleInt32ExtAttribute>("a2");
- AttributeVector::DocId docid(0);
- for (uint32_t i = 0; i < NUM_DOCS; ++i) {
- attr->addDoc(docid);
- attr->add(i * 2, docid); // value = docid * 2
- }
- assert(docid + 1 == NUM_DOCS);
- attributeContext.add(attr);
- }
- {
- auto attr = std::make_shared<SingleInt32ExtAttribute>("a3");
- AttributeVector::DocId docid(0);
- for (uint32_t i = 0; i < NUM_DOCS; ++i) {
- attr->addDoc(docid);
- attr->add(i%10, docid);
- }
- assert(docid + 1 == NUM_DOCS);
- attributeContext.add(attr);
- }
-
// grouping
sessionManager = std::make_shared<SessionManager>(100);
- // metaStore
- for (uint32_t i = 0; i < NUM_DOCS; ++i) {
- document::DocumentId docId(vespalib::make_string("id:ns:searchdocument::%u", i));
- const document::GlobalId &gid = docId.getGlobalId();
- document::BucketId bucketId(BucketFactory::getBucketId(docId));
- uint32_t docSize = 1;
- metaStore.put(gid, bucketId, Timestamp(0u), docSize, i, 0u);
- metaStore.setBucketState(bucketId, true);
- }
}
void set_property(const vespalib::string &name, const vespalib::string &value) {
@@ -241,30 +291,30 @@ struct MyWorld {
static void verify_match_features(SearchReply &reply, const vespalib::string &matched_field) {
if (reply.hits.empty()) {
- EXPECT_EQUAL(reply.match_features.names.size(), 0u);
- EXPECT_EQUAL(reply.match_features.values.size(), 0u);
+ EXPECT_EQ(reply.match_features.names.size(), 0u);
+ EXPECT_EQ(reply.match_features.values.size(), 0u);
} else {
- ASSERT_EQUAL(reply.match_features.names.size(), 5u);
- EXPECT_EQUAL(reply.match_features.names[0], "attribute(a1)");
- EXPECT_EQUAL(reply.match_features.names[1], "attribute(a2)");
- EXPECT_EQUAL(reply.match_features.names[2], "matches(a1)");
- EXPECT_EQUAL(reply.match_features.names[3], "matches(f1)");
- EXPECT_EQUAL(reply.match_features.names[4], "rankingExpression(\"tensor(x[3])(x)\")");
- ASSERT_EQUAL(reply.match_features.values.size(), 5 * reply.hits.size());
+ ASSERT_EQ(reply.match_features.names.size(), 5u);
+ EXPECT_EQ(reply.match_features.names[0], "attribute(a1)");
+ EXPECT_EQ(reply.match_features.names[1], "attribute(a2)");
+ EXPECT_EQ(reply.match_features.names[2], "matches(a1)");
+ EXPECT_EQ(reply.match_features.names[3], "matches(f1)");
+ EXPECT_EQ(reply.match_features.names[4], "rankingExpression(\"tensor(x[3])(x)\")");
+ ASSERT_EQ(reply.match_features.values.size(), 5 * reply.hits.size());
for (size_t i = 0; i < reply.hits.size(); ++i) {
const auto *f = &reply.match_features.values[i * 5];
- EXPECT_GREATER(f[0].as_double(), 0.0);
- EXPECT_GREATER(f[1].as_double(), 0.0);
- EXPECT_EQUAL(f[0].as_double(), reply.hits[i].metric);
- EXPECT_EQUAL(f[0].as_double() * 2, f[1].as_double());
- EXPECT_EQUAL(f[2].as_double(), double(matched_field == "a1"));
- EXPECT_EQUAL(f[3].as_double(), double(matched_field == "f1"));
+ EXPECT_GT(f[0].as_double(), 0.0);
+ EXPECT_GT(f[1].as_double(), 0.0);
+ EXPECT_EQ(f[0].as_double(), reply.hits[i].metric);
+ EXPECT_EQ(f[0].as_double() * 2, f[1].as_double());
+ EXPECT_EQ(f[2].as_double(), double(matched_field == "a1"));
+ EXPECT_EQ(f[3].as_double(), double(matched_field == "f1"));
EXPECT_TRUE(f[4].is_data());
{
nbostream buf(f[4].as_data().data, f[4].as_data().size);
auto actual = spec_from_value(*SimpleValue::from_stream(buf));
auto expect = TensorSpec("tensor(x[3])").add({{"x", 0}}, 0).add({{"x", 1}}, 1).add({{"x", 2}}, 2);
- EXPECT_EQUAL(actual, expect);
+ EXPECT_EQ(actual, expect);
}
}
}
@@ -272,16 +322,16 @@ struct MyWorld {
static void verify_match_feature_renames(SearchReply &reply, const vespalib::string &matched_field) {
if (reply.hits.empty()) {
- EXPECT_EQUAL(reply.match_features.names.size(), 0u);
- EXPECT_EQUAL(reply.match_features.values.size(), 0u);
+ EXPECT_EQ(reply.match_features.names.size(), 0u);
+ EXPECT_EQ(reply.match_features.values.size(), 0u);
} else {
- ASSERT_EQUAL(reply.match_features.names.size(), 5u);
- EXPECT_EQUAL(reply.match_features.names[3], "foobar");
- EXPECT_EQUAL(reply.match_features.names[4], "tensor(x[3])(x)");
- ASSERT_EQUAL(reply.match_features.values.size(), 5 * reply.hits.size());
+ ASSERT_EQ(reply.match_features.names.size(), 5u);
+ EXPECT_EQ(reply.match_features.names[3], "foobar");
+ EXPECT_EQ(reply.match_features.names[4], "tensor(x[3])(x)");
+ ASSERT_EQ(reply.match_features.values.size(), 5 * reply.hits.size());
for (size_t i = 0; i < reply.hits.size(); ++i) {
const auto *f = &reply.match_features.values[i * 5];
- EXPECT_EQUAL(f[3].as_double(), double(matched_field == "f1"));
+ EXPECT_EQ(f[3].as_double(), double(matched_field == "f1"));
EXPECT_TRUE(f[4].is_data());
}
}
@@ -378,7 +428,7 @@ struct MyWorld {
auto mtf = matcher->create_match_tools_factory(req, searchContext, attributeContext, metaStore, overrides,
ttb(), nullptr, searchContext.getDocIdLimit(), true);
auto diversity = mtf->createDiversifier(HeapSize::lookup(config));
- EXPECT_EQUAL(expectDiverse, static_cast<bool>(diversity));
+ EXPECT_EQ(expectDiverse, static_cast<bool>(diversity));
}
double get_first_phase_termwise_limit() {
@@ -397,7 +447,8 @@ struct MyWorld {
SearchSession::OwnershipBundle owned_objects({std::make_unique<MockAttributeContext>(),
std::make_unique<FakeSearchContext>()},
std::make_shared<MySearchHandler>(matcher));
- vespalib::SimpleThreadBundle threadBundle(threads);
+ assert(threads <= MatchingTestSharedState::max_threads);
+ vespalib::LimitedThreadBundleWrapper threadBundle(shared_state.thread_bundle(), threads);
SearchReply::UP reply = matcher->match(req, threadBundle, searchContext, attributeContext,
*sessionManager, metaStore, metaStore.getBucketDB(),
std::move(owned_objects));
@@ -449,13 +500,14 @@ struct MyWorld {
}
};
-MyWorld::MyWorld()
- : schema(),
+MyWorld::MyWorld(MatchingTestSharedState& shared_state_in)
+ : shared_state(shared_state_in),
+ schema(),
config(),
searchContext(),
- attributeContext(),
+ attributeContext(shared_state.attribute_context()),
sessionManager(),
- metaStore(std::make_shared<bucketdb::BucketDBOwner>()),
+ metaStore(shared_state.meta_store()),
matchingStats(),
clock(),
queryLimiter()
@@ -469,30 +521,66 @@ void verifyViewResolver(const ViewResolver &resolver) {
std::vector<vespalib::string> fields;
EXPECT_TRUE(resolver.resolve("foo", fields));
ASSERT_TRUE(fields.size() == 2u);
- EXPECT_EQUAL("x", fields[0]);
- EXPECT_EQUAL("y", fields[1]);
+ EXPECT_EQ("x", fields[0]);
+ EXPECT_EQ("y", fields[1]);
}
{
std::vector<vespalib::string> fields;
EXPECT_TRUE(resolver.resolve("bar", fields));
ASSERT_TRUE(fields.size() == 1u);
- EXPECT_EQUAL("z", fields[0]);
+ EXPECT_EQ("z", fields[0]);
}
{
std::vector<vespalib::string> fields;
EXPECT_TRUE(!resolver.resolve("baz", fields));
ASSERT_TRUE(fields.size() == 1u);
- EXPECT_EQUAL("baz", fields[0]);
+ EXPECT_EQ("baz", fields[0]);
}
}
-TEST("require that view resolver can be set up directly") {
+class MatchingTest : public ::testing::Test {
+ static std::unique_ptr<MatchingTestSharedState> _shared_state;
+protected:
+ MatchingTest();
+ ~MatchingTest() override;
+ static void SetUpTestSuite();
+ static void TearDownTestSuite();
+ static MatchingTestSharedState& shared_state();
+};
+
+MatchingTest::MatchingTest() = default;
+
+MatchingTest::~MatchingTest() = default;
+
+void
+MatchingTest::SetUpTestSuite()
+{
+ _shared_state = std::make_unique<MatchingTestSharedState>();
+}
+
+void
+MatchingTest::TearDownTestSuite()
+{
+ _shared_state.reset();
+}
+
+MatchingTestSharedState&
+MatchingTest::shared_state()
+{
+ return *_shared_state;
+}
+
+std::unique_ptr<MatchingTestSharedState> MatchingTest::_shared_state;
+
+TEST_F(MatchingTest, require_that_view_resolver_can_be_set_up_directly)
+{
ViewResolver resolver;
resolver.add("foo", "x").add("foo", "y").add("bar", "z");
- TEST_DO(verifyViewResolver(resolver));
+ verifyViewResolver(resolver);
}
-TEST("require that view resolver can be set up from schema") {
+TEST_F(MatchingTest, require_that_view_resolver_can_be_set_up_from_schema)
+{
Schema schema;
Schema::FieldSet foo("foo");
foo.addField("x").addField("y");
@@ -501,124 +589,132 @@ TEST("require that view resolver can be set up from schema") {
schema.addFieldSet(foo);
schema.addFieldSet(bar);
ViewResolver resolver = ViewResolver::createFromSchema(schema);
- TEST_DO(verifyViewResolver(resolver));
+ verifyViewResolver(resolver);
}
//-----------------------------------------------------------------------------
-TEST("require that matching is performed (multi-threaded)") {
+TEST_F(MatchingTest, require_that_matching_is_performed_with_multi_threaded_matcher)
+{
for (size_t threads = 1; threads <= 16; ++threads) {
- MyWorld world;
+ MyWorld world(shared_state());
world.basicSetup();
world.basicResults();
SearchRequest::SP request = MyWorld::createSimpleRequest("f1", "spread");
SearchReply::UP reply = world.performSearch(*request, threads);
- EXPECT_EQUAL(9u, world.matchingStats.docsMatched());
- EXPECT_EQUAL(9u, reply->hits.size());
- EXPECT_GREATER(world.matchingStats.matchTimeAvg(), 0.0000001);
+ EXPECT_EQ(9u, world.matchingStats.docsMatched());
+ EXPECT_EQ(9u, reply->hits.size());
+ EXPECT_GT(world.matchingStats.matchTimeAvg(), 0.0000001);
}
}
-TEST("require that match features are calculated (multi-threaded)") {
+TEST_F(MatchingTest, require_that_match_features_are_calculated_with_multi_threaded_matcher)
+{
for (size_t threads = 1; threads <= 16; ++threads) {
- MyWorld world;
+ MyWorld world(shared_state());
world.basicSetup();
world.basicResults();
world.setup_match_features();
SearchRequest::SP request = MyWorld::createSimpleRequest("f1", "spread");
SearchReply::UP reply = world.performSearch(*request, threads);
- EXPECT_GREATER(reply->hits.size(), 0u);
+ EXPECT_GT(reply->hits.size(), 0u);
MyWorld::verify_match_features(*reply, "f1");
}
}
-TEST("require that match features can be renamed") {
- MyWorld world;
+TEST_F(MatchingTest, require_that_match_features_can_be_renamed)
+{
+ MyWorld world(shared_state());
world.basicSetup();
world.basicResults();
world.setup_match_features();
world.setup_feature_renames();
SearchRequest::SP request = MyWorld::createSimpleRequest("f1", "spread");
SearchReply::UP reply = world.performSearch(*request, 1);
- EXPECT_GREATER(reply->hits.size(), 0u);
+ EXPECT_GT(reply->hits.size(), 0u);
MyWorld::verify_match_feature_renames(*reply, "f1");
}
-TEST("require that no hits gives no match feature names") {
- MyWorld world;
+TEST_F(MatchingTest, require_that_no_hits_gives_no_match_feature_names)
+ {
+ MyWorld world(shared_state());
world.basicSetup();
world.basicResults();
world.setup_match_features();
SearchRequest::SP request = MyWorld::createSimpleRequest("f1", "not_found");
SearchReply::UP reply = world.performSearch(*request, 1);
- EXPECT_EQUAL(reply->hits.size(), 0u);
+ EXPECT_EQ(reply->hits.size(), 0u);
MyWorld::verify_match_features(*reply, "f1");
}
-TEST("require that matching also returns hits when only bitvector is used (multi-threaded)") {
+TEST_F(MatchingTest, require_that_matching_also_returns_hits_when_only_bitvector_is_used_with_multi_threaded_matcher)
+ {
for (size_t threads = 1; threads <= 16; ++threads) {
- MyWorld world;
+ MyWorld world(shared_state());
world.basicSetup(0, 0);
world.verbose_a1_result("all");
SearchRequest::SP request = MyWorld::createSimpleRequest("a1", "all");
SearchReply::UP reply = world.performSearch(*request, threads);
- EXPECT_EQUAL(985u, world.matchingStats.docsMatched());
- EXPECT_EQUAL(10u, reply->hits.size());
- EXPECT_GREATER(world.matchingStats.matchTimeAvg(), 0.0000001);
+ EXPECT_EQ(985u, world.matchingStats.docsMatched());
+ EXPECT_EQ(10u, reply->hits.size());
+ EXPECT_GT(world.matchingStats.matchTimeAvg(), 0.0000001);
}
}
-TEST("require that ranking is performed (multi-threaded)") {
+TEST_F(MatchingTest, require_that_ranking_is_performed_with_multi_threaded_matcher)
+ {
for (size_t threads = 1; threads <= 16; ++threads) {
- MyWorld world;
+ MyWorld world(shared_state());
world.basicSetup();
world.basicResults();
SearchRequest::SP request = MyWorld::createSimpleRequest("f1", "spread");
SearchReply::UP reply = world.performSearch(*request, threads);
- EXPECT_EQUAL(9u, world.matchingStats.docsMatched());
- EXPECT_EQUAL(9u, world.matchingStats.docsRanked());
- EXPECT_EQUAL(0u, world.matchingStats.docsReRanked());
+ EXPECT_EQ(9u, world.matchingStats.docsMatched());
+ EXPECT_EQ(9u, world.matchingStats.docsRanked());
+ EXPECT_EQ(0u, world.matchingStats.docsReRanked());
ASSERT_TRUE(reply->hits.size() == 9u);
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::900").getGlobalId(), reply->hits[0].gid);
- EXPECT_EQUAL(900.0, reply->hits[0].metric);
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::800").getGlobalId(), reply->hits[1].gid);
- EXPECT_EQUAL(800.0, reply->hits[1].metric);
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::700").getGlobalId(), reply->hits[2].gid);
- EXPECT_EQUAL(700.0, reply->hits[2].metric);
- EXPECT_GREATER(world.matchingStats.matchTimeAvg(), 0.0000001);
- EXPECT_EQUAL(0.0, world.matchingStats.rerankTimeAvg());
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::900").getGlobalId(), reply->hits[0].gid);
+ EXPECT_EQ(900.0, reply->hits[0].metric);
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::800").getGlobalId(), reply->hits[1].gid);
+ EXPECT_EQ(800.0, reply->hits[1].metric);
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::700").getGlobalId(), reply->hits[2].gid);
+ EXPECT_EQ(700.0, reply->hits[2].metric);
+ EXPECT_GT(world.matchingStats.matchTimeAvg(), 0.0000001);
+ EXPECT_EQ(0.0, world.matchingStats.rerankTimeAvg());
}
}
-TEST("require that re-ranking is performed (multi-threaded)") {
+TEST_F(MatchingTest, require_that_reranking_is_performed_with_multi_threaded_matcher)
+ {
for (size_t threads = 1; threads <= 16; ++threads) {
- MyWorld world;
+ MyWorld world(shared_state());
world.basicSetup();
world.setupSecondPhaseRanking();
world.basicResults();
SearchRequest::SP request = MyWorld::createSimpleRequest("f1", "spread");
SearchReply::UP reply = world.performSearch(*request, threads);
- EXPECT_EQUAL(9u, world.matchingStats.docsMatched());
- EXPECT_EQUAL(9u, world.matchingStats.docsRanked());
- EXPECT_EQUAL(3u, world.matchingStats.docsReRanked());
+ EXPECT_EQ(9u, world.matchingStats.docsMatched());
+ EXPECT_EQ(9u, world.matchingStats.docsRanked());
+ EXPECT_EQ(3u, world.matchingStats.docsReRanked());
ASSERT_TRUE(reply->hits.size() == 9u);
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::900").getGlobalId(), reply->hits[0].gid);
- EXPECT_EQUAL(1800.0, reply->hits[0].metric);
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::800").getGlobalId(), reply->hits[1].gid);
- EXPECT_EQUAL(1600.0, reply->hits[1].metric);
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::700").getGlobalId(), reply->hits[2].gid);
- EXPECT_EQUAL(1400.0, reply->hits[2].metric);
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::600").getGlobalId(), reply->hits[3].gid);
- EXPECT_EQUAL(600.0, reply->hits[3].metric);
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::500").getGlobalId(), reply->hits[4].gid);
- EXPECT_EQUAL(500.0, reply->hits[4].metric);
- EXPECT_GREATER(world.matchingStats.matchTimeAvg(), 0.0000001);
- EXPECT_GREATER(world.matchingStats.rerankTimeAvg(), 0.0000001);
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::900").getGlobalId(), reply->hits[0].gid);
+ EXPECT_EQ(1800.0, reply->hits[0].metric);
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::800").getGlobalId(), reply->hits[1].gid);
+ EXPECT_EQ(1600.0, reply->hits[1].metric);
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::700").getGlobalId(), reply->hits[2].gid);
+ EXPECT_EQ(1400.0, reply->hits[2].metric);
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::600").getGlobalId(), reply->hits[3].gid);
+ EXPECT_EQ(600.0, reply->hits[3].metric);
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::500").getGlobalId(), reply->hits[4].gid);
+ EXPECT_EQ(500.0, reply->hits[4].metric);
+ EXPECT_GT(world.matchingStats.matchTimeAvg(), 0.0000001);
+ EXPECT_GT(world.matchingStats.rerankTimeAvg(), 0.0000001);
}
}
-TEST("require that re-ranking is not diverse when not requested to be.") {
- MyWorld world;
+TEST_F(MatchingTest, require_that_reranking_is_not_diverse_when_not_requested_to_be)
+{
+ MyWorld world(shared_state());
world.basicSetup();
world.setupSecondPhaseRanking();
world.basicResults();
@@ -628,8 +724,9 @@ TEST("require that re-ranking is not diverse when not requested to be.") {
using namespace search::fef::indexproperties::matchphase;
-TEST("require that re-ranking is diverse when requested to be") {
- MyWorld world;
+TEST_F(MatchingTest, require_that_reranking_is_diverse_when_requested_to_be)
+{
+ MyWorld world(shared_state());
world.basicSetup();
world.setupSecondPhaseRanking();
world.basicResults();
@@ -641,8 +738,9 @@ TEST("require that re-ranking is diverse when requested to be") {
world.verify_diversity_filter(*request, true);
}
-TEST("require that re-ranking is diverse with diversity = 1/1") {
- MyWorld world;
+TEST_F(MatchingTest, require_that_reranking_is_diverse_with_diversity_1_of_1)
+{
+ MyWorld world(shared_state());
world.basicSetup();
world.setupSecondPhaseRanking();
world.basicResults();
@@ -652,24 +750,25 @@ TEST("require that re-ranking is diverse with diversity = 1/1") {
.add(DiversityMinGroups::NAME, "3")
.add(DiversityCutoffStrategy::NAME, "strict");
SearchReply::UP reply = world.performSearch(*request, 1);
- EXPECT_EQUAL(9u, world.matchingStats.docsMatched());
- EXPECT_EQUAL(9u, world.matchingStats.docsRanked());
- EXPECT_EQUAL(3u, world.matchingStats.docsReRanked());
+ EXPECT_EQ(9u, world.matchingStats.docsMatched());
+ EXPECT_EQ(9u, world.matchingStats.docsRanked());
+ EXPECT_EQ(3u, world.matchingStats.docsReRanked());
ASSERT_TRUE(reply->hits.size() == 9u);
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::900").getGlobalId(), reply->hits[0].gid);
- EXPECT_EQUAL(1800.0, reply->hits[0].metric);
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::800").getGlobalId(), reply->hits[1].gid);
- EXPECT_EQUAL(1600.0, reply->hits[1].metric);
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::700").getGlobalId(), reply->hits[2].gid);
- EXPECT_EQUAL(1400.0, reply->hits[2].metric);
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::600").getGlobalId(), reply->hits[3].gid);
- EXPECT_EQUAL(600.0, reply->hits[3].metric);
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::500").getGlobalId(), reply->hits[4].gid);
- EXPECT_EQUAL(500.0, reply->hits[4].metric);
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::900").getGlobalId(), reply->hits[0].gid);
+ EXPECT_EQ(1800.0, reply->hits[0].metric);
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::800").getGlobalId(), reply->hits[1].gid);
+ EXPECT_EQ(1600.0, reply->hits[1].metric);
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::700").getGlobalId(), reply->hits[2].gid);
+ EXPECT_EQ(1400.0, reply->hits[2].metric);
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::600").getGlobalId(), reply->hits[3].gid);
+ EXPECT_EQ(600.0, reply->hits[3].metric);
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::500").getGlobalId(), reply->hits[4].gid);
+ EXPECT_EQ(500.0, reply->hits[4].metric);
}
-TEST("require that re-ranking is diverse with diversity = 1/10") {
- MyWorld world;
+TEST_F(MatchingTest, require_that_reranking_is_diverse_with_diversity_1_of_10)
+ {
+ MyWorld world(shared_state());
world.basicSetup();
world.setupSecondPhaseRanking();
world.basicResults();
@@ -679,47 +778,50 @@ TEST("require that re-ranking is diverse with diversity = 1/10") {
.add(DiversityMinGroups::NAME, "3")
.add(DiversityCutoffStrategy::NAME, "strict");
SearchReply::UP reply = world.performSearch(*request, 1);
- EXPECT_EQUAL(9u, world.matchingStats.docsMatched());
- EXPECT_EQUAL(9u, world.matchingStats.docsRanked());
- EXPECT_EQUAL(1u, world.matchingStats.docsReRanked());
+ EXPECT_EQ(9u, world.matchingStats.docsMatched());
+ EXPECT_EQ(9u, world.matchingStats.docsRanked());
+ EXPECT_EQ(1u, world.matchingStats.docsReRanked());
ASSERT_TRUE(reply->hits.size() == 9u);
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::900").getGlobalId(), reply->hits[0].gid);
- EXPECT_EQUAL(1800.0, reply->hits[0].metric);
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::900").getGlobalId(), reply->hits[0].gid);
+ EXPECT_EQ(1800.0, reply->hits[0].metric);
//TODO This is of course incorrect until the selectBest method sees everything.
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::800").getGlobalId(), reply->hits[1].gid);
- EXPECT_EQUAL(800.0, reply->hits[1].metric);
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::700").getGlobalId(), reply->hits[2].gid);
- EXPECT_EQUAL(700.0, reply->hits[2].metric);
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::600").getGlobalId(), reply->hits[3].gid);
- EXPECT_EQUAL(600.0, reply->hits[3].metric);
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::500").getGlobalId(), reply->hits[4].gid);
- EXPECT_EQUAL(500.0, reply->hits[4].metric);
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::800").getGlobalId(), reply->hits[1].gid);
+ EXPECT_EQ(800.0, reply->hits[1].metric);
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::700").getGlobalId(), reply->hits[2].gid);
+ EXPECT_EQ(700.0, reply->hits[2].metric);
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::600").getGlobalId(), reply->hits[3].gid);
+ EXPECT_EQ(600.0, reply->hits[3].metric);
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::500").getGlobalId(), reply->hits[4].gid);
+ EXPECT_EQ(500.0, reply->hits[4].metric);
}
-TEST("require that sortspec can be used (multi-threaded)") {
+TEST_F(MatchingTest, require_that_sortspec_can_be_used_with_multi_threaded_matcher)
+{
for (size_t threads = 1; threads <= 16; ++threads) {
- MyWorld world;
+ MyWorld world(shared_state());
world.basicSetup();
world.basicResults();
SearchRequest::SP request = MyWorld::createSimpleRequest("f1", "spread");
request->sortSpec = "+a1";
SearchReply::UP reply = world.performSearch(*request, threads);
- ASSERT_EQUAL(9u, reply->hits.size());
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::100").getGlobalId(), reply->hits[0].gid);
- EXPECT_EQUAL(zero_rank_value, reply->hits[0].metric);
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::200").getGlobalId(), reply->hits[1].gid);
- EXPECT_EQUAL(zero_rank_value, reply->hits[1].metric);
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::300").getGlobalId(), reply->hits[2].gid);
- EXPECT_EQUAL(zero_rank_value, reply->hits[2].metric);
+ ASSERT_EQ(9u, reply->hits.size());
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::100").getGlobalId(), reply->hits[0].gid);
+ EXPECT_EQ(zero_rank_value, reply->hits[0].metric);
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::200").getGlobalId(), reply->hits[1].gid);
+ EXPECT_EQ(zero_rank_value, reply->hits[1].metric);
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::300").getGlobalId(), reply->hits[2].gid);
+ EXPECT_EQ(zero_rank_value, reply->hits[2].metric);
EXPECT_FALSE(reply->sortIndex.empty());
EXPECT_FALSE(reply->sortData.empty());
}
}
ExpressionNode::UP createAttr() { return std::make_unique<AttributeNode>("a1"); }
-TEST("require that grouping is performed (multi-threaded)") {
+
+TEST_F(MatchingTest, require_that_grouping_is_performed_with_multi_threaded_matcher)
+ {
for (size_t threads = 1; threads <= 16; ++threads) {
- MyWorld world;
+ MyWorld world(shared_state());
world.basicSetup();
world.basicResults();
SearchRequest::SP request = MyWorld::createSimpleRequest("f1", "spread");
@@ -739,120 +841,125 @@ TEST("require that grouping is performed (multi-threaded)") {
vespalib::NBOSerializer is(buf);
uint32_t n;
is >> n;
- EXPECT_EQUAL(1u, n);
+ EXPECT_EQ(1u, n);
Grouping gresult;
gresult.deserialize(is);
Grouping gexpect;
gexpect.setRoot(Group().addResult(SumAggregationResult()
.setExpression(createAttr())
.setResult(Int64ResultNode(4500))));
- EXPECT_EQUAL(gexpect.root().asString(), gresult.root().asString());
+ EXPECT_EQ(gexpect.root().asString(), gresult.root().asString());
}
- EXPECT_GREATER(world.matchingStats.groupingTimeAvg(), 0.0000001);
+ EXPECT_GT(world.matchingStats.groupingTimeAvg(), 0.0000001);
}
}
-TEST("require that summary features are filled") {
- MyWorld world;
+TEST_F(MatchingTest, require_that_summary_features_are_filled)
+{
+ MyWorld world(shared_state());
world.basicSetup();
world.basicResults();
DocsumRequest::SP req = MyWorld::createSimpleDocsumRequest("f1", "foo");
FeatureSet::SP fs = world.getSummaryFeatures(*req);
const FeatureSet::Value * f = nullptr;
- EXPECT_EQUAL(5u, fs->numFeatures());
- EXPECT_EQUAL("attribute(a1)", fs->getNames()[0]);
- EXPECT_EQUAL("matches(f1)", fs->getNames()[1]);
- EXPECT_EQUAL("rankingExpression(\"reduce(tensor(x[3])(x),sum)\")", fs->getNames()[2]);
- EXPECT_EQUAL("rankingExpression(\"tensor(x[3])(x)\")", fs->getNames()[3]);
- EXPECT_EQUAL("value(100)", fs->getNames()[4]);
- EXPECT_EQUAL(3u, fs->numDocs());
+ EXPECT_EQ(5u, fs->numFeatures());
+ EXPECT_EQ("attribute(a1)", fs->getNames()[0]);
+ EXPECT_EQ("matches(f1)", fs->getNames()[1]);
+ EXPECT_EQ("rankingExpression(\"reduce(tensor(x[3])(x),sum)\")", fs->getNames()[2]);
+ EXPECT_EQ("rankingExpression(\"tensor(x[3])(x)\")", fs->getNames()[3]);
+ EXPECT_EQ("value(100)", fs->getNames()[4]);
+ EXPECT_EQ(3u, fs->numDocs());
f = fs->getFeaturesByDocId(10);
EXPECT_TRUE(f != nullptr);
- EXPECT_EQUAL(10, f[0].as_double());
- EXPECT_EQUAL(1, f[1].as_double());
- EXPECT_EQUAL(100, f[4].as_double());
+ EXPECT_EQ(10, f[0].as_double());
+ EXPECT_EQ(1, f[1].as_double());
+ EXPECT_EQ(100, f[4].as_double());
f = fs->getFeaturesByDocId(15);
EXPECT_TRUE(f != nullptr);
- EXPECT_EQUAL(15, f[0].as_double());
- EXPECT_EQUAL(0, f[1].as_double());
- EXPECT_EQUAL(100, f[4].as_double());
+ EXPECT_EQ(15, f[0].as_double());
+ EXPECT_EQ(0, f[1].as_double());
+ EXPECT_EQ(100, f[4].as_double());
f = fs->getFeaturesByDocId(30);
EXPECT_TRUE(f != nullptr);
- EXPECT_EQUAL(30, f[0].as_double());
- EXPECT_EQUAL(1, f[1].as_double());
+ EXPECT_EQ(30, f[0].as_double());
+ EXPECT_EQ(1, f[1].as_double());
EXPECT_TRUE(f[2].is_double());
EXPECT_TRUE(!f[2].is_data());
- EXPECT_EQUAL(f[2].as_double(), 3.0); // 0 + 1 + 2
+ EXPECT_EQ(f[2].as_double(), 3.0); // 0 + 1 + 2
EXPECT_TRUE(!f[3].is_double());
EXPECT_TRUE(f[3].is_data());
- EXPECT_EQUAL(100, f[4].as_double());
+ EXPECT_EQ(100, f[4].as_double());
{
nbostream buf(f[3].as_data().data, f[3].as_data().size);
auto actual = spec_from_value(*SimpleValue::from_stream(buf));
auto expect = TensorSpec("tensor(x[3])").add({{"x", 0}}, 0).add({{"x", 1}}, 1).add({{"x", 2}}, 2);
- EXPECT_EQUAL(actual, expect);
+ EXPECT_EQ(actual, expect);
}
}
-TEST("require that rank features are filled") {
- MyWorld world;
+TEST_F(MatchingTest, require_that_rank_features_are_filled)
+{
+ MyWorld world(shared_state());
world.basicSetup();
world.basicResults();
DocsumRequest::SP req = MyWorld::createSimpleDocsumRequest("f1", "foo");
FeatureSet::SP fs = world.getRankFeatures(*req);
const FeatureSet::Value * f = nullptr;
- EXPECT_EQUAL(1u, fs->numFeatures());
- EXPECT_EQUAL("attribute(a2)", fs->getNames()[0]);
- EXPECT_EQUAL(3u, fs->numDocs());
+ EXPECT_EQ(1u, fs->numFeatures());
+ EXPECT_EQ("attribute(a2)", fs->getNames()[0]);
+ EXPECT_EQ(3u, fs->numDocs());
f = fs->getFeaturesByDocId(10);
EXPECT_TRUE(f != nullptr);
- EXPECT_EQUAL(20, f[0].as_double());
+ EXPECT_EQ(20, f[0].as_double());
f = fs->getFeaturesByDocId(15);
EXPECT_TRUE(f != nullptr);
- EXPECT_EQUAL(30, f[0].as_double());
+ EXPECT_EQ(30, f[0].as_double());
f = fs->getFeaturesByDocId(30);
EXPECT_TRUE(f != nullptr);
- EXPECT_EQUAL(60, f[0].as_double());
+ EXPECT_EQ(60, f[0].as_double());
}
-TEST("require that search session can be cached") {
- MyWorld world;
+TEST_F(MatchingTest, require_that_search_session_can_be_cached)
+{
+ MyWorld world(shared_state());
world.basicSetup();
world.basicResults();
SearchRequest::SP request = MyWorld::createSimpleRequest("f1", "foo");
request->propertiesMap.lookupCreate(search::MapNames::CACHES).add("query", "true");
request->sessionId.push_back('a');
- EXPECT_EQUAL(0u, world.sessionManager->getSearchStats().numInsert);
+ EXPECT_EQ(0u, world.sessionManager->getSearchStats().numInsert);
SearchReply::UP reply = world.performSearch(*request, 1);
- EXPECT_EQUAL(1u, world.sessionManager->getSearchStats().numInsert);
+ EXPECT_EQ(1u, world.sessionManager->getSearchStats().numInsert);
SearchSession::SP session = world.sessionManager->pickSearch("a");
ASSERT_TRUE(session.get());
- EXPECT_EQUAL(request->getTimeOfDoom(), session->getTimeOfDoom());
- EXPECT_EQUAL("a", session->getSessionId());
+ EXPECT_EQ(request->getTimeOfDoom(), session->getTimeOfDoom());
+ EXPECT_EQ("a", session->getSessionId());
}
-TEST("require that summary features can be renamed") {
- MyWorld world;
+TEST_F(MatchingTest, require_that_summary_features_can_be_renamed)
+{
+ MyWorld world(shared_state());
world.basicSetup();
world.setup_feature_renames();
world.basicResults();
DocsumRequest::SP req = MyWorld::createSimpleDocsumRequest("f1", "foo");
FeatureSet::SP fs = world.getSummaryFeatures(*req);
const FeatureSet::Value * f = nullptr;
- EXPECT_EQUAL(5u, fs->numFeatures());
- EXPECT_EQUAL("attribute(a1)", fs->getNames()[0]);
- EXPECT_EQUAL("foobar", fs->getNames()[1]);
- EXPECT_EQUAL("rankingExpression(\"reduce(tensor(x[3])(x),sum)\")", fs->getNames()[2]);
- EXPECT_EQUAL("tensor(x[3])(x)", fs->getNames()[3]);
- EXPECT_EQUAL(3u, fs->numDocs());
+ EXPECT_EQ(5u, fs->numFeatures());
+ EXPECT_EQ("attribute(a1)", fs->getNames()[0]);
+ EXPECT_EQ("foobar", fs->getNames()[1]);
+ EXPECT_EQ("rankingExpression(\"reduce(tensor(x[3])(x),sum)\")", fs->getNames()[2]);
+ EXPECT_EQ("tensor(x[3])(x)", fs->getNames()[3]);
+ EXPECT_EQ(3u, fs->numDocs());
f = fs->getFeaturesByDocId(30);
EXPECT_TRUE(f != nullptr);
EXPECT_TRUE(f[2].is_double());
EXPECT_TRUE(f[3].is_data());
}
-TEST("require that getSummaryFeatures can use cached query setup") {
- MyWorld world;
+TEST_F(MatchingTest, require_that_getSummaryFeatures_can_use_cached_query_setup)
+{
+ MyWorld world(shared_state());
world.basicSetup();
world.basicResults();
SearchRequest::SP request = MyWorld::createSimpleRequest("f1", "foo");
@@ -867,46 +974,46 @@ TEST("require that getSummaryFeatures can use cached query setup") {
docsum_request->hits.back().docid = 30;
FeatureSet::SP fs = world.getSummaryFeatures(*docsum_request);
- ASSERT_EQUAL(5u, fs->numFeatures());
- EXPECT_EQUAL("attribute(a1)", fs->getNames()[0]);
- EXPECT_EQUAL("matches(f1)", fs->getNames()[1]);
- EXPECT_EQUAL("rankingExpression(\"reduce(tensor(x[3])(x),sum)\")", fs->getNames()[2]);
- EXPECT_EQUAL("rankingExpression(\"tensor(x[3])(x)\")", fs->getNames()[3]);
- EXPECT_EQUAL("value(100)", fs->getNames()[4]);
- ASSERT_EQUAL(1u, fs->numDocs());
+ ASSERT_EQ(5u, fs->numFeatures());
+ EXPECT_EQ("attribute(a1)", fs->getNames()[0]);
+ EXPECT_EQ("matches(f1)", fs->getNames()[1]);
+ EXPECT_EQ("rankingExpression(\"reduce(tensor(x[3])(x),sum)\")", fs->getNames()[2]);
+ EXPECT_EQ("rankingExpression(\"tensor(x[3])(x)\")", fs->getNames()[3]);
+ EXPECT_EQ("value(100)", fs->getNames()[4]);
+ ASSERT_EQ(1u, fs->numDocs());
const auto *f = fs->getFeaturesByDocId(30);
ASSERT_TRUE(f);
- EXPECT_EQUAL(30, f[0].as_double());
- EXPECT_EQUAL(100, f[4].as_double());
+ EXPECT_EQ(30, f[0].as_double());
+ EXPECT_EQ(100, f[4].as_double());
// getSummaryFeatures can be called multiple times.
fs = world.getSummaryFeatures(*docsum_request);
- ASSERT_EQUAL(5u, fs->numFeatures());
- EXPECT_EQUAL("attribute(a1)", fs->getNames()[0]);
- EXPECT_EQUAL("matches(f1)", fs->getNames()[1]);
- EXPECT_EQUAL("rankingExpression(\"reduce(tensor(x[3])(x),sum)\")", fs->getNames()[2]);
- EXPECT_EQUAL("rankingExpression(\"tensor(x[3])(x)\")", fs->getNames()[3]);
- EXPECT_EQUAL("value(100)", fs->getNames()[4]);
- ASSERT_EQUAL(1u, fs->numDocs());
+ ASSERT_EQ(5u, fs->numFeatures());
+ EXPECT_EQ("attribute(a1)", fs->getNames()[0]);
+ EXPECT_EQ("matches(f1)", fs->getNames()[1]);
+ EXPECT_EQ("rankingExpression(\"reduce(tensor(x[3])(x),sum)\")", fs->getNames()[2]);
+ EXPECT_EQ("rankingExpression(\"tensor(x[3])(x)\")", fs->getNames()[3]);
+ EXPECT_EQ("value(100)", fs->getNames()[4]);
+ ASSERT_EQ(1u, fs->numDocs());
f = fs->getFeaturesByDocId(30);
ASSERT_TRUE(f);
- EXPECT_EQUAL(30, f[0].as_double());
- EXPECT_EQUAL(100, f[4].as_double());
+ EXPECT_EQ(30, f[0].as_double());
+ EXPECT_EQ(100, f[4].as_double());
}
-double count_f1_matches(FeatureSet &fs) {
+void count_f1_matches(FeatureSet &fs, double& sum) {
ASSERT_TRUE(fs.getNames().size() > 1);
- ASSERT_EQUAL(fs.getNames()[1], "matches(f1)");
- double sum = 0.0;
+ ASSERT_EQ(fs.getNames()[1], "matches(f1)");
+ sum = 0.0;
for (size_t i = 0; i < fs.numDocs(); ++i) {
auto *f = fs.getFeaturesByIndex(i);
sum += f[1].as_double();
}
- return sum;
}
-TEST("require that getSummaryFeatures prefers cached query setup") {
- MyWorld world;
+TEST_F(MatchingTest, require_that_getSummaryFeatures_prefers_cached_query_setup)
+{
+ MyWorld world(shared_state());
world.basicSetup();
world.basicResults();
SearchRequest::SP request = MyWorld::createSimpleRequest("f1", "spread");
@@ -918,94 +1025,106 @@ TEST("require that getSummaryFeatures prefers cached query setup") {
req->sessionId = request->sessionId;
req->propertiesMap.lookupCreate(search::MapNames::CACHES).add("query", "true");
FeatureSet::SP fs = world.getSummaryFeatures(*req);
- EXPECT_EQUAL(5u, fs->numFeatures());
- EXPECT_EQUAL(3u, fs->numDocs());
- EXPECT_EQUAL(0.0, count_f1_matches(*fs)); // "spread" has no hits
+ EXPECT_EQ(5u, fs->numFeatures());
+ EXPECT_EQ(3u, fs->numDocs());
+ double sum = 0.0;
+ ASSERT_NO_FATAL_FAILURE(count_f1_matches(*fs, sum));
+ EXPECT_EQ(0.0, sum); // "spread" has no hits
// Empty cache
auto pruneTime = vespalib::steady_clock::now() + 600s;
world.sessionManager->pruneTimedOutSessions(pruneTime);
fs = world.getSummaryFeatures(*req);
- EXPECT_EQUAL(5u, fs->numFeatures());
- EXPECT_EQUAL(3u, fs->numDocs());
- EXPECT_EQUAL(2.0, count_f1_matches(*fs)); // "foo" has two hits
+ EXPECT_EQ(5u, fs->numFeatures());
+ EXPECT_EQ(3u, fs->numDocs());
+ ASSERT_NO_FATAL_FAILURE(count_f1_matches(*fs, sum));
+ EXPECT_EQ(2.0, sum); // "foo" has two hits
}
-TEST("require that match params are set up straight with ranking on") {
- MatchParams p(10, 2, 4, 0.7, 0, 1, true, true);
- ASSERT_EQUAL(10u, p.numDocs);
- ASSERT_EQUAL(2u, p.heapSize);
- ASSERT_EQUAL(4u, p.arraySize);
- ASSERT_EQUAL(0.7, p.rankDropLimit);
- ASSERT_EQUAL(0u, p.offset);
- ASSERT_EQUAL(1u, p.hits);
- ASSERT_TRUE(p.has_rank_drop_limit());
+TEST_F(MatchingTest, require_that_match_params_are_set_up_straight_with_ranking_on)
+{
+ MatchParams p(10, 2, 4, 0.7, 0.75, 0, 1, true, true);
+ ASSERT_EQ(10u, p.numDocs);
+ ASSERT_EQ(2u, p.heapSize);
+ ASSERT_EQ(4u, p.arraySize);
+ ASSERT_EQ(0.7, p.first_phase_rank_score_drop_limit.value());
+ ASSERT_EQ(0.75, p.second_phase_rank_score_drop_limit.value());
+ ASSERT_EQ(0u, p.offset);
+ ASSERT_EQ(1u, p.hits);
}
-TEST("require that match params can turn off rank-drop-limit") {
- MatchParams p(10, 2, 4, -std::numeric_limits<feature_t>::quiet_NaN(), 0, 1, true, true);
- ASSERT_EQUAL(10u, p.numDocs);
- ASSERT_EQUAL(2u, p.heapSize);
- ASSERT_EQUAL(4u, p.arraySize);
- ASSERT_TRUE(std::isnan(p.rankDropLimit));
- ASSERT_EQUAL(0u, p.offset);
- ASSERT_EQUAL(1u, p.hits);
- ASSERT_FALSE(p.has_rank_drop_limit());
+TEST_F(MatchingTest, require_that_match_params_can_turn_off_rank_score_drop_limits)
+{
+ MatchParams p(10, 2, 4, std::nullopt, std::nullopt, 0, 1, true, true);
+ ASSERT_EQ(10u, p.numDocs);
+ ASSERT_EQ(2u, p.heapSize);
+ ASSERT_EQ(4u, p.arraySize);
+ ASSERT_FALSE(p.first_phase_rank_score_drop_limit.has_value());
+ ASSERT_FALSE(p.second_phase_rank_score_drop_limit.has_value());
+ ASSERT_EQ(0u, p.offset);
+ ASSERT_EQ(1u, p.hits);
}
-TEST("require that match params are set up straight with ranking on arraySize is atleast the size of heapSize") {
- MatchParams p(10, 6, 4, 0.7, 1, 1, true, true);
- ASSERT_EQUAL(10u, p.numDocs);
- ASSERT_EQUAL(6u, p.heapSize);
- ASSERT_EQUAL(6u, p.arraySize);
- ASSERT_EQUAL(0.7, p.rankDropLimit);
- ASSERT_EQUAL(1u, p.offset);
- ASSERT_EQUAL(1u, p.hits);
+TEST_F(MatchingTest, require_that_match_params_are_set_up_straight_with_ranking_on_arraySize_is_atleast_the_size_of_heapSize)
+{
+ MatchParams p(10, 6, 4, 0.7, std::nullopt, 1, 1, true, true);
+ ASSERT_EQ(10u, p.numDocs);
+ ASSERT_EQ(6u, p.heapSize);
+ ASSERT_EQ(6u, p.arraySize);
+ ASSERT_EQ(0.7, p.first_phase_rank_score_drop_limit.value());
+ ASSERT_FALSE(p.second_phase_rank_score_drop_limit.has_value());
+ ASSERT_EQ(1u, p.offset);
+ ASSERT_EQ(1u, p.hits);
}
-TEST("require that match params are set up straight with ranking on arraySize is atleast the size of hits+offset") {
- MatchParams p(10, 6, 4, 0.7, 4, 4, true, true);
- ASSERT_EQUAL(10u, p.numDocs);
- ASSERT_EQUAL(6u, p.heapSize);
- ASSERT_EQUAL(8u, p.arraySize);
- ASSERT_EQUAL(0.7, p.rankDropLimit);
- ASSERT_EQUAL(4u, p.offset);
- ASSERT_EQUAL(4u, p.hits);
+TEST_F(MatchingTest, require_that_match_params_are_set_up_straight_with_ranking_on_arraySize_is_atleast_the_size_of_hits_plus_offset)
+{
+ MatchParams p(10, 6, 4, 0.7, std::nullopt, 4, 4, true, true);
+ ASSERT_EQ(10u, p.numDocs);
+ ASSERT_EQ(6u, p.heapSize);
+ ASSERT_EQ(8u, p.arraySize);
+ ASSERT_EQ(0.7, p.first_phase_rank_score_drop_limit.value());
+ ASSERT_EQ(4u, p.offset);
+ ASSERT_EQ(4u, p.hits);
}
-TEST("require that match params are capped by numDocs") {
- MatchParams p(1, 6, 4, 0.7, 4, 4, true, true);
- ASSERT_EQUAL(1u, p.numDocs);
- ASSERT_EQUAL(1u, p.heapSize);
- ASSERT_EQUAL(1u, p.arraySize);
- ASSERT_EQUAL(0.7, p.rankDropLimit);
- ASSERT_EQUAL(1u, p.offset);
- ASSERT_EQUAL(0u, p.hits);
+TEST_F(MatchingTest, require_that_match_params_are_capped_by_numDocs)
+{
+ MatchParams p(1, 6, 4, 0.7, std::nullopt, 4, 4, true, true);
+ ASSERT_EQ(1u, p.numDocs);
+ ASSERT_EQ(1u, p.heapSize);
+ ASSERT_EQ(1u, p.arraySize);
+ ASSERT_EQ(0.7, p.first_phase_rank_score_drop_limit.value());
+ ASSERT_EQ(1u, p.offset);
+ ASSERT_EQ(0u, p.hits);
}
-TEST("require that match params are capped by numDocs and hits adjusted down") {
- MatchParams p(5, 6, 4, 0.7, 4, 4, true, true);
- ASSERT_EQUAL(5u, p.numDocs);
- ASSERT_EQUAL(5u, p.heapSize);
- ASSERT_EQUAL(5u, p.arraySize);
- ASSERT_EQUAL(0.7, p.rankDropLimit);
- ASSERT_EQUAL(4u, p.offset);
- ASSERT_EQUAL(1u, p.hits);
+TEST_F(MatchingTest, require_that_match_params_are_capped_by_numDocs_and_hits_adjusted_down)
+{
+ MatchParams p(5, 6, 4, 0.7, std::nullopt, 4, 4, true, true);
+ ASSERT_EQ(5u, p.numDocs);
+ ASSERT_EQ(5u, p.heapSize);
+ ASSERT_EQ(5u, p.arraySize);
+ ASSERT_EQ(0.7, p.first_phase_rank_score_drop_limit.value());
+ ASSERT_EQ(4u, p.offset);
+ ASSERT_EQ(1u, p.hits);
}
-TEST("require that match params are set up straight with ranking off array and heap size is 0") {
- MatchParams p(10, 6, 4, 0.7, 4, 4, true, false);
- ASSERT_EQUAL(10u, p.numDocs);
- ASSERT_EQUAL(0u, p.heapSize);
- ASSERT_EQUAL(0u, p.arraySize);
- ASSERT_EQUAL(0.7, p.rankDropLimit);
- ASSERT_EQUAL(4u, p.offset);
- ASSERT_EQUAL(4u, p.hits);
+TEST_F(MatchingTest, require_that_match_params_are_set_up_straight_with_ranking_off_array_and_heap_size_is_0)
+{
+ MatchParams p(10, 6, 4, 0.7, std::nullopt, 4, 4, true, false);
+ ASSERT_EQ(10u, p.numDocs);
+ ASSERT_EQ(0u, p.heapSize);
+ ASSERT_EQ(0u, p.arraySize);
+ ASSERT_EQ(0.7, p.first_phase_rank_score_drop_limit.value());
+ ASSERT_EQ(4u, p.offset);
+ ASSERT_EQ(4u, p.hits);
}
-TEST("require that match phase limiting works") {
+TEST_F(MatchingTest, require_that_match_phase_limiting_works)
+{
for (int s = 0; s <= 1; ++s) {
for (int i = 0; i <= 6; ++i) {
bool enable = (i != 0);
@@ -1014,7 +1133,7 @@ TEST("require that match phase limiting works") {
bool descending = (i == 2) || (i == 4) || (i == 6);
bool use_sorting = (s == 1);
size_t want_threads = 75;
- MyWorld world;
+ MyWorld world(shared_state());
world.basicSetup();
world.verbose_a1_result("all");
if (enable) {
@@ -1036,51 +1155,54 @@ TEST("require that match phase limiting works") {
request->sortSpec = "-a1";
}
SearchReply::UP reply = world.performSearch(*request, want_threads);
- ASSERT_EQUAL(10u, reply->hits.size());
+ ASSERT_EQ(10u, reply->hits.size());
if (enable) {
- EXPECT_EQUAL(79u, reply->totalHitCount);
+ EXPECT_EQ(79u, reply->totalHitCount);
if (!use_sorting) {
- EXPECT_EQUAL(997.0, reply->hits[0].metric);
- EXPECT_EQUAL(994.0, reply->hits[1].metric);
- EXPECT_EQUAL(991.0, reply->hits[2].metric);
- EXPECT_EQUAL(987.0, reply->hits[3].metric);
- EXPECT_EQUAL(974.0, reply->hits[4].metric);
- EXPECT_EQUAL(963.0, reply->hits[5].metric);
- EXPECT_EQUAL(961.0, reply->hits[6].metric);
- EXPECT_EQUAL(951.0, reply->hits[7].metric);
- EXPECT_EQUAL(948.0, reply->hits[8].metric);
- EXPECT_EQUAL(935.0, reply->hits[9].metric);
+ EXPECT_EQ(997.0, reply->hits[0].metric);
+ EXPECT_EQ(994.0, reply->hits[1].metric);
+ EXPECT_EQ(991.0, reply->hits[2].metric);
+ EXPECT_EQ(987.0, reply->hits[3].metric);
+ EXPECT_EQ(974.0, reply->hits[4].metric);
+ EXPECT_EQ(963.0, reply->hits[5].metric);
+ EXPECT_EQ(961.0, reply->hits[6].metric);
+ EXPECT_EQ(951.0, reply->hits[7].metric);
+ EXPECT_EQ(948.0, reply->hits[8].metric);
+ EXPECT_EQ(935.0, reply->hits[9].metric);
}
} else {
- EXPECT_EQUAL(985u, reply->totalHitCount);
+ EXPECT_EQ(985u, reply->totalHitCount);
if (!use_sorting) {
- EXPECT_EQUAL(999.0, reply->hits[0].metric);
- EXPECT_EQUAL(998.0, reply->hits[1].metric);
- EXPECT_EQUAL(997.0, reply->hits[2].metric);
- EXPECT_EQUAL(996.0, reply->hits[3].metric);
+ EXPECT_EQ(999.0, reply->hits[0].metric);
+ EXPECT_EQ(998.0, reply->hits[1].metric);
+ EXPECT_EQ(997.0, reply->hits[2].metric);
+ EXPECT_EQ(996.0, reply->hits[3].metric);
}
}
}
}
}
-TEST("require that arithmetic used for rank drop limit works") {
+TEST_F(MatchingTest, require_that_arithmetic_used_for_rank_drop_limit_works)
+{
double small = -HUGE_VAL;
double limit = -std::numeric_limits<feature_t>::quiet_NaN();
EXPECT_TRUE(!(small <= limit));
}
-TEST("require that termwise limit is set correctly for first phase ranking program") {
- MyWorld world;
+TEST_F(MatchingTest, require_that_termwise_limit_is_set_correctly_for_first_phase_ranking_program)
+{
+ MyWorld world(shared_state());
world.basicSetup();
world.basicResults();
- EXPECT_EQUAL(1.0, world.get_first_phase_termwise_limit());
+ EXPECT_EQ(1.0, world.get_first_phase_termwise_limit());
world.set_property(indexproperties::matching::TermwiseLimit::NAME, "0.02");
- EXPECT_EQUAL(0.02, world.get_first_phase_termwise_limit());
+ EXPECT_EQ(0.02, world.get_first_phase_termwise_limit());
}
-TEST("require that fields are tagged with data type") {
- MyWorld world;
+TEST_F(MatchingTest, require_that_fields_are_tagged_with_data_type)
+{
+ MyWorld world(shared_state());
world.basicSetup();
auto int32_field = world.get_field_info("a1");
auto string_field = world.get_field_info("f1");
@@ -1090,24 +1212,26 @@ TEST("require that fields are tagged with data type") {
ASSERT_TRUE(bool(string_field));
ASSERT_TRUE(bool(tensor_field));
ASSERT_TRUE(bool(predicate_field));
- EXPECT_EQUAL(int32_field->get_data_type(), FieldInfo::DataType::INT32);
- EXPECT_EQUAL(string_field->get_data_type(), FieldInfo::DataType::STRING);
- EXPECT_EQUAL(tensor_field->get_data_type(), FieldInfo::DataType::TENSOR);
- EXPECT_EQUAL(predicate_field->get_data_type(), FieldInfo::DataType::BOOLEANTREE);
+ EXPECT_EQ(int32_field->get_data_type(), FieldInfo::DataType::INT32);
+ EXPECT_EQ(string_field->get_data_type(), FieldInfo::DataType::STRING);
+ EXPECT_EQ(tensor_field->get_data_type(), FieldInfo::DataType::TENSOR);
+ EXPECT_EQ(predicate_field->get_data_type(), FieldInfo::DataType::BOOLEANTREE);
}
-TEST("require that same element search works") {
- MyWorld world;
+TEST_F(MatchingTest, require_that_same_element_search_works)
+{
+ MyWorld world(shared_state());
world.basicSetup();
world.add_same_element_results("foo", "bar");
SearchRequest::SP request = MyWorld::createSameElementRequest("foo", "bar");
SearchReply::UP reply = world.performSearch(*request, 1);
- ASSERT_EQUAL(1u, reply->hits.size());
- EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::20").getGlobalId(), reply->hits[0].gid);
+ ASSERT_EQ(1u, reply->hits.size());
+ EXPECT_EQ(document::DocumentId("id:ns:searchdocument::20").getGlobalId(), reply->hits[0].gid);
}
-TEST("require that docsum matcher can extract matching elements from same element blueprint") {
- MyWorld world;
+TEST_F(MatchingTest, require_that_docsum_matcher_can_extract_matching_elements_from_same_element_blueprint)
+{
+ MyWorld world(shared_state());
world.basicSetup();
world.add_same_element_results("foo", "bar");
auto request = MyWorld::create_docsum_request(make_same_element_stack_dump("foo", "bar"), {20});
@@ -1116,12 +1240,13 @@ TEST("require that docsum matcher can extract matching elements from same elemen
fields.add_mapping("my", "my.f1");
auto result = world.get_matching_elements(*request, fields);
const auto &list = result->get_matching_elements(20, "my");
- ASSERT_EQUAL(list.size(), 1u);
- EXPECT_EQUAL(list[0], 2u);
+ ASSERT_EQ(list.size(), 1u);
+ EXPECT_EQ(list[0], 2u);
}
-TEST("require that docsum matcher can extract matching elements from single attribute term") {
- MyWorld world;
+TEST_F(MatchingTest, require_that_docsum_matcher_can_extract_matching_elements_from_single_attribute_term)
+{
+ MyWorld world(shared_state());
world.basicSetup();
world.add_same_element_results("foo", "bar");
auto request = MyWorld::create_docsum_request(make_simple_stack_dump("my.a1", "foo"), {20});
@@ -1130,9 +1255,9 @@ TEST("require that docsum matcher can extract matching elements from single attr
fields.add_mapping("my", "my.f1");
auto result = world.get_matching_elements(*request, fields);
const auto &list = result->get_matching_elements(20, "my");
- ASSERT_EQUAL(list.size(), 2u);
- EXPECT_EQUAL(list[0], 2u);
- EXPECT_EQUAL(list[1], 3u);
+ ASSERT_EQ(list.size(), 2u);
+ EXPECT_EQ(list[0], 2u);
+ EXPECT_EQ(list[1], 3u);
}
using FMA = vespalib::FuzzyMatchingAlgorithm;
@@ -1162,35 +1287,41 @@ struct AttributeBlueprintParamsFixture {
rank_properties.add(TargetHitsMaxAdjustmentFactor::NAME, target_hits_max_adjustment_factor);
rank_properties.add(FuzzyAlgorithm::NAME, fuzzy_matching_algorithm);
}
+ ~AttributeBlueprintParamsFixture();
AttributeBlueprintParams extract(uint32_t active_docids = 9, uint32_t docid_limit = 10) const {
return MatchToolsFactory::extract_attribute_blueprint_params(rank_setup, rank_properties, active_docids, docid_limit);
}
};
-TEST_F("attribute blueprint params are extracted from rank profile", AttributeBlueprintParamsFixture(0.2, 0.8, 5.0, FMA::DfaTable))
+AttributeBlueprintParamsFixture::~AttributeBlueprintParamsFixture() = default;
+
+TEST_F(MatchingTest, attribute_blueprint_params_are_extracted_from_rank_profile)
{
+ AttributeBlueprintParamsFixture f(0.2, 0.8, 5.0, FMA::DfaTable);
auto params = f.extract();
- EXPECT_EQUAL(0.2, params.global_filter_lower_limit);
- EXPECT_EQUAL(0.8, params.global_filter_upper_limit);
- EXPECT_EQUAL(5.0, params.target_hits_max_adjustment_factor);
- EXPECT_EQUAL(FMA::DfaTable, params.fuzzy_matching_algorithm);
+ EXPECT_EQ(0.2, params.global_filter_lower_limit);
+ EXPECT_EQ(0.8, params.global_filter_upper_limit);
+ EXPECT_EQ(5.0, params.target_hits_max_adjustment_factor);
+ EXPECT_EQ(FMA::DfaTable, params.fuzzy_matching_algorithm);
}
-TEST_F("attribute blueprint params are extracted from query", AttributeBlueprintParamsFixture(0.2, 0.8, 5.0, FMA::DfaTable))
+TEST_F(MatchingTest, attribute_blueprint_params_are_extracted_from_query)
{
+ AttributeBlueprintParamsFixture f(0.2, 0.8, 5.0, FMA::DfaTable);
f.set_query_properties("0.15", "0.75", "3.0", "dfa_explicit");
auto params = f.extract();
- EXPECT_EQUAL(0.15, params.global_filter_lower_limit);
- EXPECT_EQUAL(0.75, params.global_filter_upper_limit);
- EXPECT_EQUAL(3.0, params.target_hits_max_adjustment_factor);
- EXPECT_EQUAL(FMA::DfaExplicit, params.fuzzy_matching_algorithm);
+ EXPECT_EQ(0.15, params.global_filter_lower_limit);
+ EXPECT_EQ(0.75, params.global_filter_upper_limit);
+ EXPECT_EQ(3.0, params.target_hits_max_adjustment_factor);
+ EXPECT_EQ(FMA::DfaExplicit, params.fuzzy_matching_algorithm);
}
-TEST_F("global filter params are scaled with active hit ratio", AttributeBlueprintParamsFixture(0.2, 0.8, 5.0, FMA::DfaTable))
+TEST_F(MatchingTest, global_filter_params_are_scaled_with_active_hit_ratio)
{
+ AttributeBlueprintParamsFixture f(0.2, 0.8, 5.0, FMA::DfaTable);
auto params = f.extract(5, 10);
- EXPECT_EQUAL(0.12, params.global_filter_lower_limit);
- EXPECT_EQUAL(0.48, params.global_filter_upper_limit);
+ EXPECT_EQ(0.12, params.global_filter_lower_limit);
+ EXPECT_EQ(0.48, params.global_filter_upper_limit);
}
-TEST_MAIN() { TEST_RUN_ALL(); }
+GTEST_MAIN_RUN_ALL_TESTS()
diff --git a/searchcore/src/tests/proton/matching/query_test.cpp b/searchcore/src/tests/proton/matching/query_test.cpp
index 83b7e10c7a8..763f5dafb55 100644
--- a/searchcore/src/tests/proton/matching/query_test.cpp
+++ b/searchcore/src/tests/proton/matching/query_test.cpp
@@ -30,7 +30,7 @@
#include <vespa/document/datatype/positiondatatype.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/util/thread_bundle.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/searchlib/query/tree/querytreecreator.h>
#include <vespa/log/log.h>
@@ -237,7 +237,8 @@ public:
template <class TermType>
void checkNode(const TermType &n, int estimatedHitCount, bool empty) {
EXPECT_EQUAL(empty, (estimatedHitCount == 0));
- EXPECT_EQUAL((double)estimatedHitCount / doc_count, n.field(0).getDocFreq());
+ EXPECT_EQUAL(static_cast<uint64_t>(estimatedHitCount), n.field(0).get_doc_freq().frequency);
+ EXPECT_EQUAL(static_cast<uint64_t>(doc_count), n.field(0).get_doc_freq().count);
}
void visit(ProtonNumberTerm &n) override { checkNode(n, 1, false); }
@@ -383,7 +384,8 @@ public:
EXPECT_EQUAL(term_data.numFields(), n.numFields());
for (size_t i = 0; i < term_data.numFields(); ++i) {
const ITermFieldData &term_field_data = term_data.field(i);
- EXPECT_APPROX(2.0 / doc_count, term_field_data.getDocFreq(), 1.0e-6);
+ EXPECT_EQUAL(2u, term_field_data.get_doc_freq().frequency);
+ EXPECT_EQUAL(static_cast<uint64_t>(doc_count), term_field_data.get_doc_freq().count);
EXPECT_TRUE(!n.field(i).attribute_field);
EXPECT_EQUAL(field_id + i, term_field_data.getFieldId());
}
@@ -823,7 +825,8 @@ TEST("requireThatNoDocsGiveZeroDocFrequency") {
Blueprint::UP blueprint = BlueprintBuilder::build(requestContext, node, context);
EXPECT_EQUAL(1u, node.numFields());
- EXPECT_EQUAL(0.0, node.field(0).getDocFreq());
+ EXPECT_EQUAL(0u, node.field(0).get_doc_freq().frequency);
+ EXPECT_EQUAL(1u, node.field( 0).get_doc_freq().count);
}
TEST("requireThatWeakAndBlueprintsAreCreatedCorrectly") {
diff --git a/searchcore/src/tests/proton/matching/querynodes_test.cpp b/searchcore/src/tests/proton/matching/querynodes_test.cpp
index 64c6870499c..a1c73d0fa76 100644
--- a/searchcore/src/tests/proton/matching/querynodes_test.cpp
+++ b/searchcore/src/tests/proton/matching/querynodes_test.cpp
@@ -29,7 +29,7 @@
#include <vespa/searchlib/queryeval/sourceblendersearch.h>
#include <vespa/searchlib/queryeval/fake_search.h>
#include <vespa/searchlib/queryeval/fake_requestcontext.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/log/log.h>
LOG_SETUP("querynodes_test");
diff --git a/searchcore/src/tests/proton/matching/resolveviewvisitor_test.cpp b/searchcore/src/tests/proton/matching/resolveviewvisitor_test.cpp
index e85bef44f3e..d73038ddcb5 100644
--- a/searchcore/src/tests/proton/matching/resolveviewvisitor_test.cpp
+++ b/searchcore/src/tests/proton/matching/resolveviewvisitor_test.cpp
@@ -10,7 +10,7 @@ LOG_SETUP("resolveviewvisitor_test");
#include <vespa/searchcore/proton/matching/viewresolver.h>
#include <vespa/searchlib/query/tree/node.h>
#include <vespa/searchlib/query/tree/querybuilder.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <string>
namespace fef_test = search::fef::test;
diff --git a/searchcore/src/tests/proton/matching/sessionmanager_test.cpp b/searchcore/src/tests/proton/matching/sessionmanager_test.cpp
index 8bfbcacbf23..3153bcccb42 100644
--- a/searchcore/src/tests/proton/matching/sessionmanager_test.cpp
+++ b/searchcore/src/tests/proton/matching/sessionmanager_test.cpp
@@ -8,7 +8,7 @@
#include <vespa/searchcore/proton/matching/match_tools.h>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/test/insertion_operators.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/data/slime/slime.h>
#include <vespa/log/log.h>
diff --git a/searchcore/src/tests/proton/matching/termdataextractor_test.cpp b/searchcore/src/tests/proton/matching/termdataextractor_test.cpp
index 43d2c54fd03..f440d573859 100644
--- a/searchcore/src/tests/proton/matching/termdataextractor_test.cpp
+++ b/searchcore/src/tests/proton/matching/termdataextractor_test.cpp
@@ -15,7 +15,7 @@ LOG_SETUP("termdataextractor_test");
#include <vespa/searchlib/query/tree/point.h>
#include <vespa/searchlib/query/tree/querybuilder.h>
#include <vespa/searchlib/query/weight.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <string>
#include <vector>
diff --git a/searchcore/src/tests/proton/metrics/documentdb_job_trackers/.gitignore b/searchcore/src/tests/proton/metrics/documentdb_job_trackers/.gitignore
deleted file mode 100644
index 84c97c63aca..00000000000
--- a/searchcore/src/tests/proton/metrics/documentdb_job_trackers/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-searchcore_documentdb_job_trackers_test_app
diff --git a/searchcore/src/tests/proton/metrics/documentdb_job_trackers/CMakeLists.txt b/searchcore/src/tests/proton/metrics/documentdb_job_trackers/CMakeLists.txt
deleted file mode 100644
index 81d054e2242..00000000000
--- a/searchcore/src/tests/proton/metrics/documentdb_job_trackers/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchcore_documentdb_job_trackers_test_app TEST
- SOURCES
- documentdb_job_trackers_test.cpp
- DEPENDS
- searchcore_proton_metrics
- searchcore_test
-)
-vespa_add_test(NAME searchcore_documentdb_job_trackers_test_app COMMAND searchcore_documentdb_job_trackers_test_app)
diff --git a/searchcore/src/tests/proton/metrics/job_load_sampler/.gitignore b/searchcore/src/tests/proton/metrics/job_load_sampler/.gitignore
deleted file mode 100644
index 2e02ec8191b..00000000000
--- a/searchcore/src/tests/proton/metrics/job_load_sampler/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-searchcore_job_load_sampler_test_app
diff --git a/searchcore/src/tests/proton/metrics/job_load_sampler/CMakeLists.txt b/searchcore/src/tests/proton/metrics/job_load_sampler/CMakeLists.txt
deleted file mode 100644
index 955b1e14028..00000000000
--- a/searchcore/src/tests/proton/metrics/job_load_sampler/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchcore_job_load_sampler_test_app TEST
- SOURCES
- job_load_sampler_test.cpp
- DEPENDS
- searchcore_proton_metrics
-)
-vespa_add_test(NAME searchcore_job_load_sampler_test_app COMMAND searchcore_job_load_sampler_test_app)
diff --git a/searchcore/src/tests/proton/metrics/job_tracked_flush/.gitignore b/searchcore/src/tests/proton/metrics/job_tracked_flush/.gitignore
deleted file mode 100644
index 85e6097878b..00000000000
--- a/searchcore/src/tests/proton/metrics/job_tracked_flush/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-searchcore_job_tracked_flush_test_app
diff --git a/searchcore/src/tests/proton/metrics/job_tracked_flush/CMakeLists.txt b/searchcore/src/tests/proton/metrics/job_tracked_flush/CMakeLists.txt
deleted file mode 100644
index a4f0ff0bcec..00000000000
--- a/searchcore/src/tests/proton/metrics/job_tracked_flush/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchcore_job_tracked_flush_test_app TEST
- SOURCES
- job_tracked_flush_test.cpp
- DEPENDS
- searchcore_proton_metrics
- searchcore_test
-)
-vespa_add_test(NAME searchcore_job_tracked_flush_test_app COMMAND searchcore_job_tracked_flush_test_app)
diff --git a/searchcore/src/tests/proton/metrics/metrics_engine/metrics_engine_test.cpp b/searchcore/src/tests/proton/metrics/metrics_engine/metrics_engine_test.cpp
index 523ffccd2f0..dd622a4cac1 100644
--- a/searchcore/src/tests/proton/metrics/metrics_engine/metrics_engine_test.cpp
+++ b/searchcore/src/tests/proton/metrics/metrics_engine/metrics_engine_test.cpp
@@ -3,7 +3,7 @@
#include <vespa/metrics/metricset.h>
#include <vespa/searchcore/proton/metrics/attribute_metrics.h>
#include <vespa/searchcore/proton/metrics/metrics_engine.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/log/log.h>
LOG_SETUP("metrics_engine_test");
diff --git a/searchcore/src/tests/proton/persistenceengine/persistence_handler_map/persistence_handler_map_test.cpp b/searchcore/src/tests/proton/persistenceengine/persistence_handler_map/persistence_handler_map_test.cpp
index 528067aeeb1..f13b9e9a9db 100644
--- a/searchcore/src/tests/proton/persistenceengine/persistence_handler_map/persistence_handler_map_test.cpp
+++ b/searchcore/src/tests/proton/persistenceengine/persistence_handler_map/persistence_handler_map_test.cpp
@@ -5,7 +5,7 @@
#include <vespa/document/fieldvalue/document.h>
#include <vespa/document/update/documentupdate.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
using namespace document;
using namespace proton;
diff --git a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp
index 21ac6893356..0f1e2e9487a 100644
--- a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp
+++ b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp
@@ -17,7 +17,7 @@
#include <vespa/searchcore/proton/test/disk_mem_usage_notifier.h>
#include <vespa/vdslib/distribution/distribution.h>
#include <vespa/vdslib/state/clusterstate.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <set>
using document::BucketId;
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 06264e3e642..1dfc6c481b6 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
@@ -24,7 +24,7 @@
#include <vespa/fileacquirer/config-filedistributorrpc.h>
#include <vespa/vespalib/util/hw_info.h>
#include <vespa/vespalib/util/varholder.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/config.h>
#include <map>
#include <thread>
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 411dd88f995..881c547df1e 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
@@ -8,7 +8,7 @@
#include <vespa/searchlib/transactionlog/translogserver.h>
#include <vespa/searchlib/transactionlog/translogclient.h>
#include <vespa/vespalib/io/fileutil.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/test/insertion_operators.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <filesystem>
diff --git a/searchcore/src/tests/proton/reference/document_db_reference/document_db_reference_test.cpp b/searchcore/src/tests/proton/reference/document_db_reference/document_db_reference_test.cpp
index a2f85ce991b..dee0b6a2448 100644
--- a/searchcore/src/tests/proton/reference/document_db_reference/document_db_reference_test.cpp
+++ b/searchcore/src/tests/proton/reference/document_db_reference/document_db_reference_test.cpp
@@ -6,7 +6,7 @@
#include <vespa/searchlib/attribute/attributefactory.h>
#include <vespa/searchlib/attribute/imported_attribute_vector.h>
#include <vespa/searchcommon/attribute/config.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <cassert>
#include <vespa/log/log.h>
LOG_SETUP("document_db_reference_test");
diff --git a/searchcore/src/tests/proton/reference/document_db_reference_registry/document_db_reference_registry_test.cpp b/searchcore/src/tests/proton/reference/document_db_reference_registry/document_db_reference_registry_test.cpp
index 0aa0e31442e..5ec785496e2 100644
--- a/searchcore/src/tests/proton/reference/document_db_reference_registry/document_db_reference_registry_test.cpp
+++ b/searchcore/src/tests/proton/reference/document_db_reference_registry/document_db_reference_registry_test.cpp
@@ -1,5 +1,5 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/searchcore/proton/reference/document_db_reference_registry.h>
#include <vespa/searchcore/proton/test/mock_document_db_reference.h>
diff --git a/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp b/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp
index 80f4f826c4a..57bae7cfc7c 100644
--- a/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp
+++ b/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp
@@ -20,7 +20,7 @@
#include <vespa/vespalib/util/monitored_refcount.h>
#include <vespa/vespalib/util/sequencedtaskexecutor.h>
#include <vespa/vespalib/test/insertion_operators.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/config-imported-fields.h>
#include <vespa/log/log.h>
diff --git a/searchcore/src/tests/proton/reference/gid_to_lid_change_handler/gid_to_lid_change_handler_test.cpp b/searchcore/src/tests/proton/reference/gid_to_lid_change_handler/gid_to_lid_change_handler_test.cpp
index 48df346317a..22c6c936465 100644
--- a/searchcore/src/tests/proton/reference/gid_to_lid_change_handler/gid_to_lid_change_handler_test.cpp
+++ b/searchcore/src/tests/proton/reference/gid_to_lid_change_handler/gid_to_lid_change_handler_test.cpp
@@ -1,5 +1,5 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/document/base/documentid.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
diff --git a/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp b/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp
index da3449b91aa..4c70c1830db 100644
--- a/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp
+++ b/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp
@@ -1,5 +1,5 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/document/base/documentid.h>
#include <vespa/searchcore/proton/reference/gid_to_lid_change_listener.h>
diff --git a/searchcore/src/tests/proton/reference/gid_to_lid_change_registrator/gid_to_lid_change_registrator_test.cpp b/searchcore/src/tests/proton/reference/gid_to_lid_change_registrator/gid_to_lid_change_registrator_test.cpp
index 2c218534545..6e08c8397d0 100644
--- a/searchcore/src/tests/proton/reference/gid_to_lid_change_registrator/gid_to_lid_change_registrator_test.cpp
+++ b/searchcore/src/tests/proton/reference/gid_to_lid_change_registrator/gid_to_lid_change_registrator_test.cpp
@@ -1,5 +1,5 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/document/base/globalid.h>
#include <vespa/searchcore/proton/reference/i_gid_to_lid_change_handler.h>
diff --git a/searchcore/src/tests/proton/reference/gid_to_lid_mapper/gid_to_lid_mapper_test.cpp b/searchcore/src/tests/proton/reference/gid_to_lid_mapper/gid_to_lid_mapper_test.cpp
index 36429c79a26..70211909296 100644
--- a/searchcore/src/tests/proton/reference/gid_to_lid_mapper/gid_to_lid_mapper_test.cpp
+++ b/searchcore/src/tests/proton/reference/gid_to_lid_mapper/gid_to_lid_mapper_test.cpp
@@ -1,5 +1,5 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h>
#include <vespa/searchcore/proton/documentmetastore/documentmetastore.h>
#include <vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h>
diff --git a/searchcore/src/tests/proton/reprocessing/document_reprocessing_handler/document_reprocessing_handler_test.cpp b/searchcore/src/tests/proton/reprocessing/document_reprocessing_handler/document_reprocessing_handler_test.cpp
index 97a319ecfd4..97c5b458867 100644
--- a/searchcore/src/tests/proton/reprocessing/document_reprocessing_handler/document_reprocessing_handler_test.cpp
+++ b/searchcore/src/tests/proton/reprocessing/document_reprocessing_handler/document_reprocessing_handler_test.cpp
@@ -4,7 +4,7 @@ LOG_SETUP("document_reprocessing_handler_test");
#include <vespa/searchcore/proton/reprocessing/document_reprocessing_handler.h>
#include <vespa/searchlib/test/doc_builder.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
using namespace document;
using namespace proton;
diff --git a/searchcore/src/tests/proton/reprocessing/reprocessing_runner/reprocessing_runner_test.cpp b/searchcore/src/tests/proton/reprocessing/reprocessing_runner/reprocessing_runner_test.cpp
index bb62b239cd2..5e7b11e09a7 100644
--- a/searchcore/src/tests/proton/reprocessing/reprocessing_runner/reprocessing_runner_test.cpp
+++ b/searchcore/src/tests/proton/reprocessing/reprocessing_runner/reprocessing_runner_test.cpp
@@ -4,7 +4,7 @@ LOG_SETUP("reprocessing_runner_test");
#include <vespa/searchcore/proton/reprocessing/i_reprocessing_task.h>
#include <vespa/searchcore/proton/reprocessing/reprocessingrunner.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
using namespace proton;
diff --git a/searchcore/src/tests/proton/server/CMakeLists.txt b/searchcore/src/tests/proton/server/CMakeLists.txt
index c522f4ede9c..abad9718818 100644
--- a/searchcore/src/tests/proton/server/CMakeLists.txt
+++ b/searchcore/src/tests/proton/server/CMakeLists.txt
@@ -42,3 +42,13 @@ vespa_add_executable(searchcore_memoryconfigstore_test_app TEST
searchcore_pcommon
)
vespa_add_test(NAME searchcore_memoryconfigstore_test_app COMMAND searchcore_memoryconfigstore_test_app)
+
+vespa_add_executable(searchcore_proton_server_vespa_test_app TEST
+ SOURCES
+ vespa_testrunner.cpp
+ move_operation_limiter_test.cpp
+ threading_service_config_test.cpp
+ DEPENDS
+ searchcore_server
+)
+vespa_add_test(NAME searchcore_proton_server_vespa_test_app COMMAND searchcore_proton_server_vespa_test_app)
diff --git a/searchcore/src/tests/proton/server/documentretriever_test.cpp b/searchcore/src/tests/proton/server/documentretriever_test.cpp
index 142a2b8693f..b05964fe7e0 100644
--- a/searchcore/src/tests/proton/server/documentretriever_test.cpp
+++ b/searchcore/src/tests/proton/server/documentretriever_test.cpp
@@ -40,7 +40,7 @@
#include <vespa/document/test/fieldvalue_helpers.h>
#include <vespa/vespalib/geo/zcurve.h>
#include <vespa/vespalib/test/insertion_operators.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/eval/eval/simple_value.h>
#include <vespa/eval/eval/tensor_spec.h>
diff --git a/searchcore/src/tests/proton/server/feeddebugger_test.cpp b/searchcore/src/tests/proton/server/feeddebugger_test.cpp
index cedaf2be12e..4d1bbdb2f03 100644
--- a/searchcore/src/tests/proton/server/feeddebugger_test.cpp
+++ b/searchcore/src/tests/proton/server/feeddebugger_test.cpp
@@ -6,7 +6,7 @@ LOG_SETUP("feeddebugger_test");
#include <vespa/document/base/documentid.h>
#include <vespa/searchcore/proton/common/feeddebugger.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
using document::DocumentId;
using std::string;
diff --git a/searchcore/src/tests/proton/server/feedstates_test.cpp b/searchcore/src/tests/proton/server/feedstates_test.cpp
index 8ecdfba63f5..c46510c5181 100644
--- a/searchcore/src/tests/proton/server/feedstates_test.cpp
+++ b/searchcore/src/tests/proton/server/feedstates_test.cpp
@@ -16,7 +16,7 @@
#include <vespa/searchlib/common/serialnum.h>
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/util/foreground_thread_executor.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/buffer.h>
#include <vespa/log/log.h>
diff --git a/searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp b/searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp
index 79b4b4a3627..0dc8390d7d9 100644
--- a/searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp
+++ b/searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp
@@ -1,6 +1,6 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/searchcore/proton/server/memory_flush_config_updater.h>
#include <vespa/vespalib/util/size_literals.h>
diff --git a/searchcore/src/tests/proton/server/memoryconfigstore_test.cpp b/searchcore/src/tests/proton/server/memoryconfigstore_test.cpp
index e07886f9576..c0245cc1a9d 100644
--- a/searchcore/src/tests/proton/server/memoryconfigstore_test.cpp
+++ b/searchcore/src/tests/proton/server/memoryconfigstore_test.cpp
@@ -7,7 +7,7 @@ LOG_SETUP("memoryconfigstore_test");
#include <vespa/searchcommon/common/schema.h>
#include <vespa/searchcore/proton/server/memoryconfigstore.h>
#include <vespa/searchcore/proton/test/documentdb_config_builder.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
using search::SerialNum;
using search::index::Schema;
diff --git a/searchcore/src/tests/proton/documentdb/move_operation_limiter/move_operation_limiter_test.cpp b/searchcore/src/tests/proton/server/move_operation_limiter_test.cpp
index 62530e9de7b..dee5fd2fd2c 100644
--- a/searchcore/src/tests/proton/documentdb/move_operation_limiter/move_operation_limiter_test.cpp
+++ b/searchcore/src/tests/proton/server/move_operation_limiter_test.cpp
@@ -2,12 +2,9 @@
#include <vespa/searchcore/proton/server/i_blockable_maintenance_job.h>
#include <vespa/searchcore/proton/server/move_operation_limiter.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <queue>
-#include <vespa/log/log.h>
-LOG_SETUP("move_operation_limiter_test");
-
using namespace proton;
struct MyBlockableMaintenanceJob : public IBlockableMaintenanceJob {
@@ -110,8 +107,3 @@ TEST_F("require that destructor callback has reference to limiter via shared ptr
f.endOp();
EXPECT_FALSE(f.job.blocked);
}
-
-TEST_MAIN()
-{
- TEST_RUN_ALL();
-}
diff --git a/searchcore/src/tests/proton/documentdb/threading_service_config/threading_service_config_test.cpp b/searchcore/src/tests/proton/server/threading_service_config_test.cpp
index 40b1904cd1a..567a723de39 100644
--- a/searchcore/src/tests/proton/documentdb/threading_service_config/threading_service_config_test.cpp
+++ b/searchcore/src/tests/proton/server/threading_service_config_test.cpp
@@ -2,12 +2,9 @@
#include <vespa/config-proton.h>
#include <vespa/searchcore/proton/server/threading_service_config.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/hw_info.h>
-#include <vespa/log/log.h>
-LOG_SETUP("threading_service_config_test");
-
using namespace proton;
using ProtonConfig = vespa::config::search::core::ProtonConfig;
using ProtonConfigBuilder = vespa::config::search::core::ProtonConfigBuilder;
@@ -63,8 +60,3 @@ TEST_FF("require that config can be somewhat updated", Fixture(), Fixture(3000,
cfg1.update(cfg2);
assertConfig(3000u, 1000u, cfg1);
}
-
-TEST_MAIN()
-{
- TEST_RUN_ALL();
-}
diff --git a/searchcore/src/tests/proton/server/vespa_testrunner.cpp b/searchcore/src/tests/proton/server/vespa_testrunner.cpp
new file mode 100644
index 00000000000..1e4e79047c3
--- /dev/null
+++ b/searchcore/src/tests/proton/server/vespa_testrunner.cpp
@@ -0,0 +1,8 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Unit tests for predicate_index.
+#include <vespa/vespalib/testkit/test_kit.h>
+
+#include <vespa/log/log.h>
+LOG_SETUP("proton_common_test");
+
+TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchcore/src/tests/proton/statusreport/.gitignore b/searchcore/src/tests/proton/statusreport/.gitignore
deleted file mode 100644
index 68753df292a..00000000000
--- a/searchcore/src/tests/proton/statusreport/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-searchcore_statusreport_test_app
diff --git a/searchcore/src/tests/proton/statusreport/CMakeLists.txt b/searchcore/src/tests/proton/statusreport/CMakeLists.txt
deleted file mode 100644
index 1f2a3cfbec1..00000000000
--- a/searchcore/src/tests/proton/statusreport/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchcore_statusreport_test_app TEST
- SOURCES
- statusreport_test.cpp
- DEPENDS
- searchcore_pcommon
-)
-vespa_add_test(NAME searchcore_statusreport_test_app COMMAND searchcore_statusreport_test_app)
diff --git a/searchcore/src/tests/proton/summaryengine/summaryengine_test.cpp b/searchcore/src/tests/proton/summaryengine/summaryengine_test.cpp
index bb1d06acb4c..2ab81058e43 100644
--- a/searchcore/src/tests/proton/summaryengine/summaryengine_test.cpp
+++ b/searchcore/src/tests/proton/summaryengine/summaryengine_test.cpp
@@ -1,5 +1,5 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/data/slime/slime.h>
#include <vespa/searchcore/proton/summaryengine/summaryengine.h>
#include <vespa/searchlib/engine/searchreply.h>
diff --git a/searchcore/src/tests/proton/verify_ranksetup/CMakeLists.txt b/searchcore/src/tests/proton/verify_ranksetup/CMakeLists.txt
index b27a7ee53c2..eb330be1446 100644
--- a/searchcore/src/tests/proton/verify_ranksetup/CMakeLists.txt
+++ b/searchcore/src/tests/proton/verify_ranksetup/CMakeLists.txt
@@ -5,4 +5,4 @@ vespa_add_executable(searchcore_verify_ranksetup_test_app TEST
DEPENDS
)
vespa_add_test(NAME searchcore_verify_ranksetup_test_app COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/verify_ranksetup_test.sh
- DEPENDS searchcore_verify_ranksetup_test_app searchcore_verify_ranksetup_app)
+ DEPENDS searchcore_verify_ranksetup_test_app searchcore_verify_ranksetup_app COST 50)