diff options
Diffstat (limited to 'searchcore/src/tests/proton/documentdb')
2 files changed, 18 insertions, 47 deletions
diff --git a/searchcore/src/tests/proton/documentdb/executor_threading_service/executor_threading_service_test.cpp b/searchcore/src/tests/proton/documentdb/executor_threading_service/executor_threading_service_test.cpp index d4f4e24ba6c..bc02f460b4e 100644 --- a/searchcore/src/tests/proton/documentdb/executor_threading_service/executor_threading_service_test.cpp +++ b/searchcore/src/tests/proton/documentdb/executor_threading_service/executor_threading_service_test.cpp @@ -26,16 +26,13 @@ public: ExecutorThreadingServiceTest() : _transport(1), field_writer_executor(SequencedTaskExecutor::create(my_field_writer_executor, 3, 200)), - service() - { - } - void setup(uint32_t indexing_threads) { - service = std::make_unique<ExecutorThreadingService>(_transport.shared(), + service(std::make_unique<ExecutorThreadingService>(_transport.shared(), _transport.transport(), _transport.clock(), *field_writer_executor, nullptr, - ThreadingServiceConfig::make(indexing_threads)); + ThreadingServiceConfig::make())) + { } SequencedTaskExecutor* index_inverter() { return to_concrete_type(service->indexFieldInverter()); @@ -60,7 +57,6 @@ assert_executor(SequencedTaskExecutor* exec, uint32_t exp_executors, uint32_t ex TEST_F(ExecutorThreadingServiceTest, shared_field_writer_specified_from_the_outside) { - setup(4); EXPECT_EQ(field_writer(), index_inverter()); EXPECT_EQ(field_writer(), index_writer()); EXPECT_EQ(field_writer(), attribute_writer()); @@ -69,7 +65,6 @@ TEST_F(ExecutorThreadingServiceTest, shared_field_writer_specified_from_the_outs TEST_F(ExecutorThreadingServiceTest, tasks_limits_can_be_updated) { - setup(4); service->set_task_limits(5, 7, 11); EXPECT_EQ(5, service->master_task_limit()); EXPECT_EQ(7, service->index().getTaskLimit()); diff --git a/searchcore/src/tests/proton/documentdb/threading_service_config/threading_service_config_test.cpp b/searchcore/src/tests/proton/documentdb/threading_service_config/threading_service_config_test.cpp index fc8bd474813..1cee63ecfcc 100644 --- a/searchcore/src/tests/proton/documentdb/threading_service_config/threading_service_config_test.cpp +++ b/searchcore/src/tests/proton/documentdb/threading_service_config/threading_service_config_test.cpp @@ -14,54 +14,32 @@ using ProtonConfigBuilder = vespa::config::search::core::ProtonConfigBuilder; struct Fixture { ProtonConfig cfg; - Fixture(uint32_t baseLineIndexingThreads = 2, uint32_t master_task_limit = 2000, int32_t task_limit = 500) - : cfg(makeConfig(baseLineIndexingThreads, master_task_limit, task_limit)) + Fixture(uint32_t master_task_limit = 2000, int32_t task_limit = 500) + : cfg(makeConfig(master_task_limit, task_limit)) { } - ProtonConfig makeConfig(uint32_t baseLineIndexingThreads, uint32_t master_task_limit, int32_t task_limit) { + ProtonConfig makeConfig(uint32_t master_task_limit, int32_t task_limit) { ProtonConfigBuilder builder; - builder.indexing.threads = baseLineIndexingThreads; builder.indexing.tasklimit = task_limit; builder.feeding.masterTaskLimit = master_task_limit; return builder; } - ThreadingServiceConfig make(uint32_t cpuCores) { - return ThreadingServiceConfig::make(cfg, 0.5, HwInfo::Cpu(cpuCores)); - } - void assertIndexingThreads(uint32_t expIndexingThreads, uint32_t cpuCores) { - EXPECT_EQUAL(expIndexingThreads, make(cpuCores).indexingThreads()); + ThreadingServiceConfig make() { + return ThreadingServiceConfig::make(cfg); } }; -TEST_F("require that indexing threads are set based on cpu cores and feeding concurrency", Fixture) -{ - TEST_DO(f.assertIndexingThreads(2, 1)); - TEST_DO(f.assertIndexingThreads(2, 4)); - TEST_DO(f.assertIndexingThreads(2, 8)); - TEST_DO(f.assertIndexingThreads(2, 12)); - TEST_DO(f.assertIndexingThreads(3, 13)); - TEST_DO(f.assertIndexingThreads(3, 18)); - TEST_DO(f.assertIndexingThreads(4, 19)); - TEST_DO(f.assertIndexingThreads(4, 24)); - TEST_DO(f.assertIndexingThreads(11, 64)); -} - -TEST_F("require that indexing threads is always >= 1", Fixture(0)) -{ - TEST_DO(f.assertIndexingThreads(1, 0)); -} - TEST_F("require that task limits are set", Fixture) { - auto tcfg = f.make(24); + auto tcfg = f.make(); EXPECT_EQUAL(2000u, tcfg.master_task_limit()); EXPECT_EQUAL(500u, tcfg.defaultTaskLimit()); EXPECT_TRUE(tcfg.is_task_limit_hard()); } -TEST_F("require that negative task limit makes it soft", Fixture(2, 3000, -700)) +TEST_F("require that negative task limit makes it soft", Fixture(3000, -700)) { - auto tcfg = f.make(24); + auto tcfg = f.make(); EXPECT_EQUAL(3000u, tcfg.master_task_limit()); EXPECT_EQUAL(700u, tcfg.defaultTaskLimit()); EXPECT_FALSE(tcfg.is_task_limit_hard()); @@ -69,23 +47,21 @@ TEST_F("require that negative task limit makes it soft", Fixture(2, 3000, -700)) namespace { -void assertConfig(uint32_t exp_indexing_threads, uint32_t exp_master_task_limit, - uint32_t exp_default_task_limit, const ThreadingServiceConfig& config) { - EXPECT_EQUAL(exp_indexing_threads, config.indexingThreads()); +void assertConfig(uint32_t exp_master_task_limit, uint32_t exp_default_task_limit, const ThreadingServiceConfig& config) { EXPECT_EQUAL(exp_master_task_limit, config.master_task_limit()); EXPECT_EQUAL(exp_default_task_limit, config.defaultTaskLimit()); } } -TEST_FF("require that config can be somewhat updated", Fixture(), Fixture(2, 3000, 1000)) +TEST_FF("require that config can be somewhat updated", Fixture(), Fixture(3000, 1000)) { - auto cfg1 = f1.make(1); - assertConfig(2u, 2000, 500u, cfg1); - const auto cfg2 = f2.make(13); - assertConfig(3u, 3000u, 1000u, cfg2); + auto cfg1 = f1.make(); + assertConfig(2000, 500u, cfg1); + const auto cfg2 = f2.make(); + assertConfig(3000u, 1000u, cfg2); cfg1.update(cfg2); - assertConfig(2u, 3000u, 1000u, cfg1); // Indexing threads not changed + assertConfig(3000u, 1000u, cfg1); } TEST_MAIN() |