diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-12-05 05:32:02 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-05 05:32:02 -0800 |
commit | 15d09c5b5a02bd3c7cf859401e4a613edeebd901 (patch) | |
tree | 440e04af619d9f83279fd593ca272dba772ddb5e /storage/src/tests/persistence/filestorage/filestormanagertest.cpp | |
parent | 17a8ab2b1d0600e9651b1aa0748edba8f48707bf (diff) | |
parent | 1cfdd7f98bf1a33e7edc6cfb646ee53d5654c7f4 (diff) |
Merge branch 'master' into balder/use-duration-in-messagebus-and-storageapi-rebased-1
Diffstat (limited to 'storage/src/tests/persistence/filestorage/filestormanagertest.cpp')
-rw-r--r-- | storage/src/tests/persistence/filestorage/filestormanagertest.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp index b46c0236150..64306fa7c24 100644 --- a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp +++ b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp @@ -20,8 +20,10 @@ #include <vespa/persistence/spi/test.h> #include <vespa/config/common/exceptions.h> #include <vespa/fastos/file.h> +#include <vespa/vespalib/util/time.h> #include <vespa/vespalib/gtest/gtest.h> #include <atomic> +#include <thread> #include <vespa/log/log.h> LOG_SETUP(".filestormanagertest"); @@ -556,7 +558,7 @@ public: auto cmd = std::make_shared<api::PutCommand>(makeDocumentBucket(bucket), _doc, 100); _handler.schedule(cmd, 0); - FastOS_Thread::Sleep(1); + std::this_thread::sleep_for(1ms); } _threadDone = true; @@ -589,13 +591,13 @@ public: if (msg.second.get()) { uint32_t originalConfig = _config.load(); _fetchedCount++; - FastOS_Thread::Sleep(5); + std::this_thread::sleep_for(5ms); if (_config.load() != originalConfig) { _failed = true; } } else { - FastOS_Thread::Sleep(1); + std::this_thread::sleep_for(1ms); } } @@ -634,7 +636,7 @@ TEST_F(FileStorManagerTest, handler_paused_multi_thread) { thread.start(pool); for (uint32_t i = 0; i < 50; ++i) { - FastOS_Thread::Sleep(2); + std::this_thread::sleep_for(2ms); ResumeGuard guard = filestorHandler.pause(); thread._config.fetch_add(1); uint32_t count = thread._fetchedCount; @@ -646,7 +648,7 @@ TEST_F(FileStorManagerTest, handler_paused_multi_thread) { ASSERT_FALSE(thread._failed); while (!pushthread._threadDone || !thread._threadDone) { - FastOS_Thread::Sleep(1); + std::this_thread::sleep_for(1ms); } } @@ -869,7 +871,7 @@ TEST_F(FileStorManagerTest, handler_timeout) { filestorHandler.schedule(cmd, 0); } - FastOS_Thread::Sleep(51); + std::this_thread::sleep_for(51ms); for (;;) { auto lock = filestorHandler.getNextMessage(0, stripeId); if (lock.first.get()) { @@ -944,7 +946,7 @@ TEST_F(FileStorManagerTest, priority) { // Wait until everything is done. int count = 0; while (documents.size() != top.getNumReplies() && count < 10000) { - FastOS_Thread::Sleep(10); + std::this_thread::sleep_for(10ms); count++; } ASSERT_LT(count, 10000); |