aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/tests/configholder
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-03-02 10:56:55 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-03-02 10:56:55 +0000
commite325460fadf6f2a5f98c528ba4c5ee2758efbdac (patch)
tree727f0420d03767ee8fc92a7f767e51355c141dc7 /config/src/tests/configholder
parent3b94a726a38ecf74a83084a70d378f31076130de (diff)
Use wait_until deadline to reduce number of times we need to sample the clock.
Diffstat (limited to 'config/src/tests/configholder')
-rw-r--r--config/src/tests/configholder/configholder.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/config/src/tests/configholder/configholder.cpp b/config/src/tests/configholder/configholder.cpp
index b2f6cd83693..5ff0efc92dc 100644
--- a/config/src/tests/configholder/configholder.cpp
+++ b/config/src/tests/configholder/configholder.cpp
@@ -34,12 +34,12 @@ TEST("Require that waiting is done")
ConfigHolder holder;
vespalib::Timer timer;
- holder.wait(1000ms);
+ holder.wait_for(1000ms);
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));
+ ASSERT_TRUE(holder.wait_for(100ms));
}
TEST("Require that polling for elements work")
@@ -58,10 +58,10 @@ TEST("Require that negative time does not mean forever.") {
ConfigHolder holder;
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));
+ ASSERT_FALSE(holder.wait_for(10ms));
+ ASSERT_FALSE(holder.wait_for(0ms));
+ ASSERT_FALSE(holder.wait_for(-1ms));
+ ASSERT_FALSE(holder.wait_for(-7ms));
EXPECT_LESS(timer.elapsed(), ONE_MINUTE);
}
@@ -70,7 +70,7 @@ TEST_MT_F("Require that wait is interrupted", 2, ConfigHolder)
if (thread_id == 0) {
vespalib::Timer timer;
TEST_BARRIER();
- f.wait(1000ms);
+ f.wait_for(1000ms);
EXPECT_LESS(timer.elapsed(), ONE_MINUTE);
EXPECT_GREATER(timer.elapsed(), 400ms);
TEST_BARRIER();