diff options
Diffstat (limited to 'storage/src/tests/storageserver')
3 files changed, 16 insertions, 11 deletions
diff --git a/storage/src/tests/storageserver/bucketintegritycheckertest.cpp b/storage/src/tests/storageserver/bucketintegritycheckertest.cpp index ae466f04734..8a68adf226c 100644 --- a/storage/src/tests/storageserver/bucketintegritycheckertest.cpp +++ b/storage/src/tests/storageserver/bucketintegritycheckertest.cpp @@ -1,7 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/storage/bucketdb/bucketmanager.h> -#include <vespa/storage/persistence/filestorage/filestormanager.h> #include <vespa/storage/storageserver/bucketintegritychecker.h> #include <vespa/storageapi/message/persistence.h> #include <tests/common/testhelper.h> @@ -9,6 +8,8 @@ #include <vespa/vespalib/io/fileutil.h> #include <tests/common/teststorageapp.h> #include <vespa/vespalib/gtest/gtest.h> +#include <vespa/vespalib/util/time.h> +#include <thread> using namespace ::testing; @@ -175,13 +176,13 @@ TEST_F(BucketIntegrityCheckerTest, basic_functionality) { checker.getSchedulingOptions()._minCycleTime = framework::SecondTime(60 * 60); topLink.open(); // Waiting for system to be initialized - FastOS_Thread::Sleep(10); // Give next message chance to come + std::this_thread::sleep_for(10ms); // Give next message chance to come ASSERT_COMMAND_COUNT(0, *dummyLink); topLink.doneInit(); checker.bump(); // Should have started new run with 2 pending per disk dummyLink->waitForMessages(4, _timeout); - FastOS_Thread::Sleep(10); // Give 5th message chance to come + std::this_thread::sleep_for(10ms); // Give 5th message chance to come ASSERT_COMMAND_COUNT(4, *dummyLink); auto* cmd1 = dynamic_cast<RepairBucketCommand*>(dummyLink->getCommand(0).get()); EXPECT_EQ(230, cmd1->getPriority()); @@ -200,13 +201,13 @@ TEST_F(BucketIntegrityCheckerTest, basic_functionality) { // Answering a message on disk with no more buckets does not trigger new auto reply1 = std::make_shared<RepairBucketReply>(*cmd3); ASSERT_TRUE(checker.onUp(reply1)); - FastOS_Thread::Sleep(10); // Give next message chance to come + std::this_thread::sleep_for(10ms); // Give next message chance to come ASSERT_COMMAND_COUNT(4, *dummyLink); // Answering a message on disk with more buckets trigger new repair auto reply2 = std::make_shared<RepairBucketReply>(*cmd2); ASSERT_TRUE(checker.onUp(reply2)); dummyLink->waitForMessages(5, _timeout); - FastOS_Thread::Sleep(10); // Give 6th message chance to come + std::this_thread::sleep_for(10ms); // Give 6th message chance to come ASSERT_COMMAND_COUNT(5, *dummyLink); auto* cmd5 = dynamic_cast<RepairBucketCommand*>(dummyLink->getCommand(4).get()); ASSERT_TRUE(cmd5); @@ -217,7 +218,7 @@ TEST_F(BucketIntegrityCheckerTest, basic_functionality) { reply3->setResult(api::ReturnCode(api::ReturnCode::IGNORED)); ASSERT_TRUE(checker.onUp(reply3)); dummyLink->waitForMessages(6, _timeout); - FastOS_Thread::Sleep(10); // Give 7th message chance to come + std::this_thread::sleep_for(10ms); // Give 7th message chance to come ASSERT_COMMAND_COUNT(6, *dummyLink); auto* cmd6 = dynamic_cast<RepairBucketCommand*>(dummyLink->getCommand(5).get()); ASSERT_TRUE(cmd6); @@ -227,7 +228,7 @@ TEST_F(BucketIntegrityCheckerTest, basic_functionality) { auto reply4 = std::make_shared<RepairBucketReply>(*cmd4); reply3->setResult(api::ReturnCode(api::ReturnCode::BUCKET_NOT_FOUND)); ASSERT_TRUE(checker.onUp(reply4)); - FastOS_Thread::Sleep(10); // Give 7th message chance to come + std::this_thread::sleep_for(10ms); // Give 7th message chance to come ASSERT_COMMAND_COUNT(6, *dummyLink); // Send a repair reply that actually have corrected the bucket. @@ -247,13 +248,13 @@ TEST_F(BucketIntegrityCheckerTest, basic_functionality) { EXPECT_EQ(document::BucketId(16, 0x234), cmd7->getBucketId()); auto reply7 = std::make_shared<RepairBucketReply>(*cmd7); ASSERT_TRUE(checker.onUp(reply7)); - FastOS_Thread::Sleep(10); // Give 8th message chance to come + std::this_thread::sleep_for(10ms); // Give 8th message chance to come ASSERT_COMMAND_COUNT(7, *dummyLink); // Still not time for next iteration dummyLink->reset(); _node->getClock().setAbsoluteTimeInSeconds(getDate("week1 sun 00:59:59")); - FastOS_Thread::Sleep(10); // Give new run chance to start + std::this_thread::sleep_for(10ms); // Give new run chance to start ASSERT_COMMAND_COUNT(0, *dummyLink); // Pass time until next cycle should start diff --git a/storage/src/tests/storageserver/communicationmanagertest.cpp b/storage/src/tests/storageserver/communicationmanagertest.cpp index caee6e6ab91..6657a9f1600 100644 --- a/storage/src/tests/storageserver/communicationmanagertest.cpp +++ b/storage/src/tests/storageserver/communicationmanagertest.cpp @@ -15,6 +15,8 @@ #include <vespa/vespalib/util/stringfmt.h> #include <vespa/documentapi/messagebus/messages/removedocumentmessage.h> #include <vespa/documentapi/messagebus/messages/getdocumentreply.h> +#include <vespa/vespalib/util/time.h> +#include <thread> #include <vespa/vespalib/gtest/gtest.h> using document::test::makeDocumentBucket; @@ -65,7 +67,7 @@ TEST_F(CommunicationManagerTest, simple) { distributor.open(); storage.open(); - FastOS_Thread::Sleep(1000); + std::this_thread::sleep_for(1s); // Send a message through from distributor to storage auto cmd = std::make_shared<api::GetCommand>( diff --git a/storage/src/tests/storageserver/statereportertest.cpp b/storage/src/tests/storageserver/statereportertest.cpp index c84f9311c52..dc8094275d1 100644 --- a/storage/src/tests/storageserver/statereportertest.cpp +++ b/storage/src/tests/storageserver/statereportertest.cpp @@ -11,6 +11,8 @@ #include <vespa/config/common/exceptions.h> #include <vespa/vespalib/data/slime/slime.h> #include <vespa/vespalib/gtest/gtest.h> +#include <vespa/vespalib/util/time.h> +#include <thread> #include <vespa/log/log.h> LOG_SETUP(".test.statereporter"); @@ -233,7 +235,7 @@ TEST_F(StateReporterTest, report_metrics) { uint64_t(_metricManager->getLastProcessedTime()) < _clock->getTimeInSeconds().getTime()) { - FastOS_Thread::Sleep(1); + std::this_thread::sleep_for(1ms); } } LOG(debug, "5 minute snapshot should have been taken. Adding put count"); |