src/lsa-segment-storage: fix convergence w/o content store
refs: #4430
Change-Id: I5124e9fd49bd9850c904c31d221b42b4249553a3
diff --git a/tests/test-lsa-segment-storage.cpp b/tests/test-lsa-segment-storage.cpp
index e690ae8..85806c2 100644
--- a/tests/test-lsa-segment-storage.cpp
+++ b/tests/test-lsa-segment-storage.cpp
@@ -42,7 +42,6 @@
, nlsr(m_ioService, m_scheduler, face, m_keyChain)
, lsdb(nlsr.getLsdb())
, lsaStorage(lsdb.getLsaStorage())
- , lsaGeneratedBeforeNow(180)
{
}
@@ -53,7 +52,7 @@
ndn::Name s2{"name2"};
NamePrefixList npl1{s1, s2};
NameLsa nameLsa("/ndn/other-site/%C1.Router/other-router", 12,
- ndn::time::system_clock::now() - lsaGeneratedBeforeNow, npl1);
+ ndn::time::system_clock::now() + ndn::time::seconds(LSA_REFRESH_TIME_DEFAULT), npl1);
return nameLsa.serialize();
}
@@ -66,7 +65,7 @@
std::string content = makeLsaContent();
lsaSegment->setContent(reinterpret_cast<const uint8_t*>(content.c_str()), content.length());
if (isFinal) {
- lsaSegment->setFinalBlockId(lsaSegment->getName()[-1]);
+ lsaSegment->setFinalBlock(lsaSegment->getName()[-1]);
}
return signData(lsaSegment);
@@ -92,7 +91,6 @@
Nlsr nlsr;
Lsdb& lsdb;
LsaSegmentStorage& lsaStorage;
- ndn::time::seconds lsaGeneratedBeforeNow;
};
BOOST_FIXTURE_TEST_SUITE(TestLsaSegmentStorage, LsaSegmentStorageFixture)
@@ -174,7 +172,11 @@
BOOST_CHECK(lsaStorage.getLsaSegment(ndn::Interest(lsaInterestName)) != nullptr);
- advanceClocks(ndn::time::milliseconds(lsaGeneratedBeforeNow), 10);
+ // Make sure it was not deleted earlier somehow
+ advanceClocks(ndn::time::seconds(100), 10);
+ BOOST_CHECK(lsaStorage.getLsaSegment(ndn::Interest(lsaInterestName)) != nullptr);
+
+ advanceClocks(ndn::time::seconds(LSA_REFRESH_TIME_DEFAULT), 10);
BOOST_CHECK(lsaStorage.getLsaSegment(ndn::Interest(lsaInterestName)) == nullptr);
}