diff options
Diffstat (limited to 'searchcore/src/tests')
6 files changed, 20 insertions, 23 deletions
diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp index 26abd6be914..7db4b6fc9dd 100644 --- a/searchcore/src/tests/proton/docsummary/docsummary.cpp +++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp @@ -45,6 +45,7 @@ using namespace search::engine; using namespace search::index; using namespace search::transactionlog; using namespace search; +using namespace std::chrono_literals; using document::DocumenttypesConfig; using document::test::makeBucketSpace; @@ -210,7 +211,7 @@ public: std::make_shared<BucketspacesConfig>(), _tuneFileDocumentDB, _hwInfo); _configMgr.forwardConfig(b); - _configMgr.nextGeneration(0); + _configMgr.nextGeneration(0ms); if (! FastOS_File::MakeDirectory((std::string("tmpdb/") + docTypeName).c_str())) { LOG_ABORT("should not be reached"); } 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 76b6bf55534..c26bb975a7a 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 @@ -43,6 +43,7 @@ using namespace search::transactionlog; using namespace search; using namespace searchcorespi; using namespace vespalib; +using namespace std::chrono_literals; using document::test::makeBucketSpace; using proton::bucketdb::BucketDBHandler; @@ -278,7 +279,7 @@ struct MyConfigSnapshot config::DirSpec spec(cfgDir); DocumentDBConfigHelper mgr(spec, "searchdocument"); mgr.forwardConfig(_bootstrap); - mgr.nextGeneration(1); + mgr.nextGeneration(1ms); _cfg = mgr.getConfig(); } }; diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp index 2c9a2b300eb..4064fc24105 100644 --- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp @@ -6,7 +6,6 @@ #include <vespa/fastos/file.h> #include <vespa/document/test/make_bucket_space.h> #include <vespa/searchcore/proton/attribute/flushableattribute.h> -#include <vespa/searchcore/proton/common/feedtoken.h> #include <vespa/searchcore/proton/common/statusreport.h> #include <vespa/searchcore/proton/docsummary/summaryflushtarget.h> #include <vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h> @@ -31,6 +30,7 @@ using namespace cloud::config::filedistribution; using namespace proton; using namespace vespalib::slime; +using namespace std::chrono_literals; using document::DocumentType; using document::DocumentTypeRepo; @@ -103,7 +103,7 @@ Fixture::Fixture() std::make_shared<BucketspacesConfig>(), tuneFileDocumentDB, HwInfo())); mgr.forwardConfig(b); - mgr.nextGeneration(0); + mgr.nextGeneration(0ms); _db.reset(new DocumentDB(".", mgr.getConfig(), "tcp/localhost:9014", _queryLimiter, _clock, DocTypeName("typea"), makeBucketSpace(), *b->getProtonConfigSP(), _myDBOwner, _summaryExecutor, _summaryExecutor, _tls, _dummy, diff --git a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp index 581db62fce5..d2d9f573326 100644 --- a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp +++ b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp @@ -25,6 +25,7 @@ using namespace search::index; using namespace search; using namespace vespa::config::search::core; using namespace vespa::config::search; +using namespace std::chrono_literals; using vespa::config::content::core::BucketspacesConfig; using proton::matching::RankingConstants; @@ -48,10 +49,10 @@ makeBaseConfigSnapshot() std::make_shared<BucketspacesConfig>(), std::make_shared<TuneFileDocumentDB>(), HwInfo())); dbcm.forwardConfig(b); - dbcm.nextGeneration(0); + dbcm.nextGeneration(0ms); DocumentDBConfig::SP snap = dbcm.getConfig(); snap->setConfigId(myId); - ASSERT_TRUE(snap.get() != NULL); + ASSERT_TRUE(snap); return snap; } diff --git a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp index e6df649af93..c732da58dd7 100644 --- a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp +++ b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp @@ -26,8 +26,6 @@ #include <vespa/searchcore/proton/test/disk_mem_usage_notifier.h> #include <vespa/searchcore/proton/test/mock_attribute_manager.h> #include <vespa/searchcore/proton/test/test.h> -#include <vespa/searchlib/attribute/attributecontext.h> -#include <vespa/searchlib/attribute/attributeguard.h> #include <vespa/searchlib/common/gatecallback.h> #include <vespa/searchlib/common/idocumentmetastore.h> #include <vespa/searchlib/index/docbuilder.h> @@ -70,8 +68,7 @@ typedef std::set<BucketId> BucketIdSet; constexpr int TIMEOUT_MS = 60000; constexpr double TIMEOUT_SEC = 60.0; -namespace -{ +namespace { void sampleThreadId(FastOS_ThreadId *threadId) @@ -806,12 +803,9 @@ MyExecutor::isIdle() bool MyExecutor::waitIdle(double timeout) { - FastOS_Time startTime; - startTime.SetNow(); + fastos::StopWatch timer; while (!isIdle()) { - FastOS_Time cTime; - cTime.SetNow(); - if (cTime.Secs() - startTime.Secs() >= timeout) + if (timer.elapsed().sec() >= timeout) return false; } return true; 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 fb80f6f55b4..d86a750794f 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 @@ -13,7 +13,7 @@ #include <vespa/fileacquirer/config-filedistributorrpc.h> #include <vespa/vespalib/util/varholder.h> #include <vespa/vespalib/testkit/testapp.h> -#include <vespa/fastos/time.h> +#include <vespa/fastos/timestamp.h> #include <vespa/config-bucketspaces.h> #include <vespa/config-attributes.h> #include <vespa/config-imported-fields.h> @@ -29,6 +29,7 @@ using namespace vespa::config::search::core; using namespace vespa::config::search::summary; using namespace vespa::config::search; using namespace cloud::config::filedistribution; +using namespace std::chrono_literals; using vespa::config::content::core::BucketspacesConfig; using vespa::config::content::core::BucketspacesConfigBuilder; @@ -169,10 +170,9 @@ struct ProtonConfigOwner : public proton::IProtonConfigurer VarHolder<std::shared_ptr<ProtonConfigSnapshot>> _config; ProtonConfigOwner() : _configured(false), _config() { } - bool waitUntilConfigured(int timeout) { - FastOS_Time timer; - timer.SetNow(); - while (timer.MilliSecsToNow() < timeout) { + bool waitUntilConfigured(int64_t timeout) { + fastos::StopWatch timer; + while (timer.elapsed().ms() < timeout) { if (getConfigured()) return true; FastOS_Thread::Sleep(100); @@ -290,7 +290,7 @@ TEST_FF("require that documentdb config manager builds schema with imported attr TEST_FFF("require that proton config fetcher follows changes to bootstrap", ConfigTestFixture("search"), ProtonConfigOwner(), - ProtonConfigFetcher(ConfigUri(f1.configId, f1.context), f2, 60000)) { + ProtonConfigFetcher(ConfigUri(f1.configId, f1.context), f2, 60000ms)) { f3.start(); ASSERT_TRUE(f2._configured); ASSERT_TRUE(f1.configEqual(f2.getBootstrapConfig())); @@ -305,7 +305,7 @@ TEST_FFF("require that proton config fetcher follows changes to bootstrap", TEST_FFF("require that proton config fetcher follows changes to doctypes", ConfigTestFixture("search"), ProtonConfigOwner(), - ProtonConfigFetcher(ConfigUri(f1.configId, f1.context), f2, 60000)) { + ProtonConfigFetcher(ConfigUri(f1.configId, f1.context), f2, 60000ms)) { f3.start(); f2._configured = false; @@ -325,7 +325,7 @@ TEST_FFF("require that proton config fetcher follows changes to doctypes", TEST_FFF("require that proton config fetcher reconfigures dbowners", ConfigTestFixture("search"), ProtonConfigOwner(), - ProtonConfigFetcher(ConfigUri(f1.configId, f1.context), f2, 60000)) { + ProtonConfigFetcher(ConfigUri(f1.configId, f1.context), f2, 60000ms)) { f3.start(); ASSERT_FALSE(f2.getDocumentDBConfig("typea")); |