summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-03-01 19:45:24 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-03-01 19:45:24 +0000
commit9c5049b423d485b722e12fd27520e4c99bdd9894 (patch)
treee5c24f83abfd1e477638189b793098a3e4a7ff3d /searchcore
parent00dc5f3e7bb3905702b87873e61a20bf91842b0d (diff)
Unify on system_time from chrono for file modification time.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/attribute/attributeflush_test.cpp7
-rw-r--r--searchcore/src/tests/proton/index/indexmanager_test.cpp7
2 files changed, 6 insertions, 8 deletions
diff --git a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp
index a10fec131e0..dfcc8d1f08b 100644
--- a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp
@@ -14,7 +14,6 @@
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/searchlib/test/directory_handler.h>
#include <vespa/searchcommon/attribute/config.h>
-#include <vespa/vespalib/datastore/datastorebase.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/foreground_thread_executor.h>
#include <vespa/vespalib/util/foregroundtaskexecutor.h>
@@ -530,20 +529,20 @@ Test::requireThatLastFlushTimeIsReported()
EXPECT_EQUAL(vespalib::system_time(), ft->getLastFlushTime());
ft->initFlush(200, std::make_shared<search::FlushToken>())->run();
EXPECT_TRUE(FastOS_File::Stat("flush/a9/snapshot-200", &stat));
- EXPECT_EQUAL(seconds(stat._modifiedTime), duration_cast<seconds>(ft->getLastFlushTime().time_since_epoch()));
+ EXPECT_EQUAL(stat._modifiedTime, ft->getLastFlushTime());
}
{ // snapshot flushed
AttributeManagerFixture amf(f);
AttributeManager &am = amf._m;
amf.addAttribute("a9");
IFlushTarget::SP ft = am.getFlushable("a9");
- EXPECT_EQUAL(seconds(stat._modifiedTime), duration_cast<seconds>(ft->getLastFlushTime().time_since_epoch()));
+ EXPECT_EQUAL(stat._modifiedTime, ft->getLastFlushTime());
{ // updated flush time after nothing to flush
std::this_thread::sleep_for(1100ms);
std::chrono::seconds now = duration_cast<seconds>(vespalib::system_clock::now().time_since_epoch());
Executor::Task::UP task = ft->initFlush(200, std::make_shared<search::FlushToken>());
EXPECT_FALSE(task);
- EXPECT_LESS(seconds(stat._modifiedTime), ft->getLastFlushTime().time_since_epoch());
+ EXPECT_LESS(stat._modifiedTime, ft->getLastFlushTime());
EXPECT_APPROX(now.count(), duration_cast<seconds>(ft->getLastFlushTime().time_since_epoch()).count(), 3);
}
}
diff --git a/searchcore/src/tests/proton/index/indexmanager_test.cpp b/searchcore/src/tests/proton/index/indexmanager_test.cpp
index 19035eaa7f7..880bf8aa3e0 100644
--- a/searchcore/src/tests/proton/index/indexmanager_test.cpp
+++ b/searchcore/src/tests/proton/index/indexmanager_test.cpp
@@ -4,7 +4,6 @@
#include <vespa/document/fieldvalue/document.h>
#include <vespa/document/fieldvalue/stringfieldvalue.h>
#include <vespa/document/repo/configbuilder.h>
-#include <vespa/document/fieldvalue/document.h>
#include <vespa/searchcore/proton/test/transport_helper.h>
#include <vespa/searchcorespi/index/index_manager_stats.h>
#include <vespa/searchcorespi/index/indexcollection.h>
@@ -305,7 +304,7 @@ TEST_F(IndexManagerTest, require_that_memory_index_is_flushed)
runAsMaster([&]() { flushTask = target.initFlush(1, std::make_shared<search::FlushToken>()); });
flushTask->run();
EXPECT_TRUE(FastOS_File::Stat("test_data/index.flush.1", &stat));
- EXPECT_EQ(seconds(stat._modifiedTime), duration_cast<seconds>(target.getLastFlushTime().time_since_epoch()));
+ EXPECT_EQ(stat._modifiedTime, target.getLastFlushTime());
sources = get_source_collection();
EXPECT_EQ(2u, sources->getSourceCount());
@@ -323,7 +322,7 @@ TEST_F(IndexManagerTest, require_that_memory_index_is_flushed)
{ // verify last flush time when loading disk index
resetIndexManager();
IndexFlushTarget target(_index_manager->getMaintainer());
- EXPECT_EQ(seconds(stat._modifiedTime), duration_cast<seconds>(target.getLastFlushTime().time_since_epoch()));
+ EXPECT_EQ(stat._modifiedTime, target.getLastFlushTime());
// updated serial number & flush time when nothing to flush
std::this_thread::sleep_for(2s);
@@ -332,7 +331,7 @@ TEST_F(IndexManagerTest, require_that_memory_index_is_flushed)
runAsMaster([&]() { task = target.initFlush(2, std::make_shared<search::FlushToken>()); });
EXPECT_FALSE(task);
EXPECT_EQ(2u, target.getFlushedSerialNum());
- EXPECT_LT(seconds(stat._modifiedTime), duration_cast<seconds>(target.getLastFlushTime().time_since_epoch()));
+ EXPECT_LT(stat._modifiedTime, target.getLastFlushTime());
EXPECT_NEAR(now.count(), duration_cast<seconds>(target.getLastFlushTime().time_since_epoch()).count(), 2);
}
}