diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-12-08 20:11:13 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-12-16 23:48:46 +0000 |
commit | c72bdc628b4493bfb2974ab3fe479d2af0d376f1 (patch) | |
tree | ce2f82f3f6f7cfd6ece7ac9ae06edef92986432f /config | |
parent | 6b4486254e67b61e7dbe7dab30ae50d3b0bf01bb (diff) |
WipeHistory has not been used for a very long time.
Diffstat (limited to 'config')
-rw-r--r-- | config/src/tests/configfetcher/configfetcher.cpp | 6 | ||||
-rw-r--r-- | config/src/tests/configholder/configholder.cpp | 22 | ||||
-rw-r--r-- | config/src/tests/configretriever/configretriever.cpp | 10 | ||||
-rw-r--r-- | config/src/tests/file_subscription/file_subscription.cpp | 6 | ||||
-rw-r--r-- | config/src/tests/frt/frt.cpp | 10 | ||||
-rw-r--r-- | config/src/tests/subscriber/subscriber.cpp | 20 | ||||
-rw-r--r-- | config/src/tests/subscription/subscription.cpp | 12 |
7 files changed, 41 insertions, 45 deletions
diff --git a/config/src/tests/configfetcher/configfetcher.cpp b/config/src/tests/configfetcher/configfetcher.cpp index be25e913980..24b943ec626 100644 --- a/config/src/tests/configfetcher/configfetcher.cpp +++ b/config/src/tests/configfetcher/configfetcher.cpp @@ -145,12 +145,12 @@ TEST_F("verify that config generation can be obtained from config fetcher", Conf f1.builder.myField = "bar"; cb._configured = false; f1.context->reload(); - fastos::StopWatch timer; - while (timer.elapsed().ms() < 120000) { + vespalib::Timer timer; + while (timer.elapsed() < 120s) { if (cb._configured) { break; } - std::this_thread::sleep_for(std::chrono::milliseconds(10));; + std::this_thread::sleep_for(10ms);; } EXPECT_EQUAL(2, fetcher.getGeneration()); EXPECT_EQUAL("bar", cb._config.get()->myField); diff --git a/config/src/tests/configholder/configholder.cpp b/config/src/tests/configholder/configholder.cpp index ce7e4f0531d..d69ad8022f9 100644 --- a/config/src/tests/configholder/configholder.cpp +++ b/config/src/tests/configholder/configholder.cpp @@ -1,15 +1,13 @@ // Copyright 2017 Yahoo Holdings. 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/config/common/configholder.h> -#include <vespa/fastos/timestamp.h> using namespace config; -using namespace std::chrono_literals; namespace { -constexpr long ONE_SEC = 1000; -constexpr long ONE_MINUTE = 60 * ONE_SEC; +constexpr vespalib::duration ONE_SEC = 1s; +constexpr vespalib::duration ONE_MINUTE = 60s; } @@ -34,10 +32,10 @@ TEST("Require that waiting is done") ConfigValue value; ConfigHolder holder; - fastos::StopWatch timer; + vespalib::Timer timer; holder.wait(1000ms); - EXPECT_GREATER_EQUAL(timer.elapsed().ms(), ONE_SEC); - EXPECT_LESS(timer.elapsed().ms(), ONE_MINUTE); + EXPECT_GREATER_EQUAL(timer.elapsed(), ONE_SEC); + EXPECT_LESS(timer.elapsed(), ONE_MINUTE); holder.handle(std::make_unique<ConfigUpdate>(value, true, 0)); ASSERT_TRUE(holder.wait(100ms)); @@ -57,23 +55,23 @@ TEST("Require that polling for elements work") TEST("Require that negative time does not mean forever.") { ConfigHolder holder; - fastos::StopWatch timer; + vespalib::Timer timer; ASSERT_FALSE(holder.poll()); ASSERT_FALSE(holder.wait(10ms)); ASSERT_FALSE(holder.wait(0ms)); ASSERT_FALSE(holder.wait(-1ms)); ASSERT_FALSE(holder.wait(-7ms)); - EXPECT_LESS(timer.elapsed().ms(), ONE_MINUTE); + EXPECT_LESS(timer.elapsed(), ONE_MINUTE); } TEST_MT_F("Require that wait is interrupted", 2, ConfigHolder) { if (thread_id == 0) { - fastos::StopWatch timer; + vespalib::Timer timer; TEST_BARRIER(); f.wait(1000ms); - EXPECT_LESS(timer.elapsed().ms(), ONE_MINUTE); - EXPECT_GREATER(timer.elapsed().ms(), 400.0); + EXPECT_LESS(timer.elapsed(), ONE_MINUTE); + EXPECT_GREATER(timer.elapsed(), 400ms); TEST_BARRIER(); } else { TEST_BARRIER(); diff --git a/config/src/tests/configretriever/configretriever.cpp b/config/src/tests/configretriever/configretriever.cpp index 87f189ad7d3..756ee815d56 100644 --- a/config/src/tests/configretriever/configretriever.cpp +++ b/config/src/tests/configretriever/configretriever.cpp @@ -245,9 +245,9 @@ public: snap = snapshot; configured = true; } - bool waitUntilConfigured(int64_t timeoutInMillis) { - fastos::StopWatch timer; - while (timer.elapsed().ms() < timeoutInMillis) { + bool waitUntilConfigured(vespalib::duration timeout) { + vespalib::Timer timer; + while (timer.elapsed() < timeout) { if (configured) { return true; } @@ -296,7 +296,7 @@ TEST_F("require that SimpleConfigurer usage works", ConfigurableFixture()) { f1.configured = false; fooBuilder.fooValue = "bimz"; ctx->reload(); - ASSERT_TRUE(f1.waitUntilConfigured(60000)); + ASSERT_TRUE(f1.waitUntilConfigured(60s)); snap = f1.snap; foo = snap.getConfig<FooConfig>("id"); ASSERT_EQUAL("bimz", foo->fooValue); @@ -304,7 +304,7 @@ TEST_F("require that SimpleConfigurer usage works", ConfigurableFixture()) { fooBuilder.fooValue = "bamz"; f1.configured = false; ctx->reload(); - ASSERT_FALSE(f1.waitUntilConfigured(2000)); + ASSERT_FALSE(f1.waitUntilConfigured(2s)); SimpleConfigurer configurer2(SimpleConfigRetriever::UP(new SimpleConfigRetriever(sub, ctx)), &f1); f1.throwException = true; diff --git a/config/src/tests/file_subscription/file_subscription.cpp b/config/src/tests/file_subscription/file_subscription.cpp index 9c40e2ffd77..ceaf16c9191 100644 --- a/config/src/tests/file_subscription/file_subscription.cpp +++ b/config/src/tests/file_subscription/file_subscription.cpp @@ -12,8 +12,6 @@ #include <config-bar.h> #include <config-foobar.h> #include <vespa/log/log.h> -#include <vespa/fastos/timestamp.h> - LOG_SETUP(".filesubscription_test"); using namespace config; @@ -103,8 +101,8 @@ TEST("requireThatReconfigIsCalledWhenConfigChanges") { writeFile("my.cfg", "bar"); context->reload(); bool correctValue = false; - fastos::StopWatch timer; - while (!correctValue && timer.elapsed().ms() < 20000.0) { + vespalib::Timer timer; + while (!correctValue && timer.elapsed() < 20s) { LOG(info, "Testing value..."); if (s.nextConfig(1000ms)) { break; diff --git a/config/src/tests/frt/frt.cpp b/config/src/tests/frt/frt.cpp index 28dea82bfe7..1925b87d600 100644 --- a/config/src/tests/frt/frt.cpp +++ b/config/src/tests/frt/frt.cpp @@ -43,10 +43,10 @@ namespace { bool poll() override { return notified; } void interrupt() override { } - bool waitUntilResponse(int timeoutInMillis) + bool waitUntilResponse(vespalib::duration timeout) { - fastos::StopWatch timer; - while (timer.elapsed().ms() < timeoutInMillis) { + vespalib::Timer timer; + while (timer.elapsed() < timeout) { if (notified) break; std::this_thread::sleep_for(100ms); @@ -255,8 +255,8 @@ TEST_FF("require that request is config task is scheduled", SourceFixture(), FRT f2.src.getConfig(); ASSERT_TRUE(f2.result.notified); f2.result.notified = false; - fastos::StopWatch timer; - while (timer.elapsed().ms() < 10000) { + vespalib::Timer timer; + while (timer.elapsed() < 10s) { f1.conn.scheduler.CheckTasks(); if (f2.result.notified) break; diff --git a/config/src/tests/subscriber/subscriber.cpp b/config/src/tests/subscriber/subscriber.cpp index 0c14928521e..0fbf0d4bee8 100644 --- a/config/src/tests/subscriber/subscriber.cpp +++ b/config/src/tests/subscriber/subscriber.cpp @@ -274,10 +274,10 @@ TEST_FFF("requireThatCorrectConfigIsReturnedAfterTimestampUpdate", MyManager, AP TEST_MT_FFF("requireThatConfigIsReturnedWhenUpdatedDuringNextConfig", 2, MyManager, APIFixture(f1), StandardFixture(f1, f2)) { if (thread_id == 0) { - fastos::StopWatch timer; + vespalib::Timer timer; ASSERT_TRUE(f3.s.nextConfig(10000ms)); - ASSERT_TRUE(timer.elapsed().ms() > 250); - ASSERT_TRUE(timer.elapsed().ms() <= 5000); + ASSERT_TRUE(timer.elapsed() > 250ms); + ASSERT_TRUE(timer.elapsed() <= 5s); verifyConfig("foo2", f3.h1->getConfig()); verifyConfig("bar", f3.h2->getConfig()); } else { @@ -289,14 +289,14 @@ TEST_MT_FFF("requireThatConfigIsReturnedWhenUpdatedDuringNextConfig", 2, MyManag } TEST_FFF("requireThatConfigIsReturnedWhenUpdatedBeforeNextConfig", MyManager, APIFixture(f1), StandardFixture(f1, f2)) { - fastos::StopWatch timer; + vespalib::Timer timer; ASSERT_FALSE(f3.s.nextConfig(1000ms)); - ASSERT_TRUE(timer.elapsed().ms() > 850); + ASSERT_TRUE(timer.elapsed() > 850ms); f1.updateGeneration(0, 2); f1.updateGeneration(1, 2); - timer.restart(); + timer = vespalib::Timer(); ASSERT_TRUE(f3.s.nextGeneration(10000ms)); - ASSERT_TRUE(timer.elapsed().ms() <= 5000); + ASSERT_TRUE(timer.elapsed() <= 5s); verifyConfig("foo", f3.h1->getConfig()); verifyConfig("bar", f3.h2->getConfig()); } @@ -324,10 +324,10 @@ TEST_FFF("requireThatNothingCanBeCalledAfterClose", MyManager, APIFixture(f1), S TEST_MT_FFF("requireThatNextConfigIsInterruptedOnClose", 2, MyManager, APIFixture(f1), StandardFixture(f1, f2)) { if (thread_id == 0) { - fastos::StopWatch timer; + vespalib::Timer timer; ASSERT_FALSE(f3.s.nextConfig(5000ms)); - ASSERT_TRUE(timer.elapsed().ms() >= 500.0); - ASSERT_TRUE(timer.elapsed().ms() < 60000.0); + ASSERT_TRUE(timer.elapsed() >= 500ms); + ASSERT_TRUE(timer.elapsed() < 60s); } else { std::this_thread::sleep_for(std::chrono::milliseconds(1000)); f3.s.close(); diff --git a/config/src/tests/subscription/subscription.cpp b/config/src/tests/subscription/subscription.cpp index 5b8fc22bf4e..90dc678ecb7 100644 --- a/config/src/tests/subscription/subscription.cpp +++ b/config/src/tests/subscription/subscription.cpp @@ -66,18 +66,18 @@ TEST_F("requireThatNextUpdateBlocks", SubscriptionFixture(ConfigKey::create<MyCo { ASSERT_FALSE(f1.sub.nextUpdate(0, 0ms)); f1.holder->handle(std::make_unique<ConfigUpdate>(ConfigValue(), 1, 1)); - fastos::StopWatch timer; + vespalib::Timer timer; ASSERT_FALSE(f1.sub.nextUpdate(1, 500ms)); - ASSERT_TRUE(timer.elapsed().ms() > 400.0); + ASSERT_TRUE(timer.elapsed() > 400ms); } TEST_MT_F("requireThatNextUpdateReturnsWhenNotified", 2, SubscriptionFixture(ConfigKey::create<MyConfig>("myid"))) { if (thread_id == 0) { - fastos::StopWatch timer; + vespalib::Timer timer; f1.holder->handle(std::make_unique<ConfigUpdate>(ConfigValue(), 1, 1)); ASSERT_TRUE(f1.sub.nextUpdate(2, 5000ms)); - ASSERT_TRUE(timer.elapsed().ms() > 200.0); + ASSERT_TRUE(timer.elapsed() > 200ms); } else { std::this_thread::sleep_for(std::chrono::milliseconds(500)); f1.holder->handle(std::make_unique<ConfigUpdate>(ConfigValue(), 1, 1)); @@ -88,10 +88,10 @@ TEST_MT_F("requireThatNextUpdateReturnsWhenNotified", 2, SubscriptionFixture(Con TEST_MT_F("requireThatNextUpdateReturnsInterrupted", 2, SubscriptionFixture(ConfigKey::create<MyConfig>("myid"))) { if (thread_id == 0) { - fastos::StopWatch timer; + vespalib::Timer timer; f1.holder->handle(std::make_unique<ConfigUpdate>(ConfigValue(), 1, 1)); ASSERT_TRUE(f1.sub.nextUpdate(1, 5000ms)); - ASSERT_TRUE(timer.elapsed().ms() > 300.0); + ASSERT_TRUE(timer.elapsed() > 300ms); } else { std::this_thread::sleep_for(std::chrono::milliseconds(500)); f1.sub.close(); |