tests: don't store shared_ptr<pit::Entry> in StrategyTester
refs #3205 Change-Id: I20ed5023fe07ba71d8df56a02228013acb8a8cb6
This commit is contained in:
1 parent
b9420cf0c1
commit
8ff0a86e18
2 files changed
+12
-15
No files matched your search
@@ -207,10 +207,10 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(IncomingInterest, Scenario, NoRouteScenarios)
|
||||
strategy.afterReceiveInterest(*face1, *interest, pitEntry);
|
||||
|
||||
BOOST_REQUIRE_EQUAL(strategy.rejectPendingInterestHistory.size(), 1);
|
||||
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory[0].pitEntry, pitEntry);
|
||||
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory[0].pitInterest, pitEntry->getInterest());
|
||||
|
||||
BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
|
||||
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitEntry, pitEntry);
|
||||
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitInterest, pitEntry->getInterest());
|
||||
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].outFaceId, face1->getId());
|
||||
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].header.getReason(), lp::NackReason::NO_ROUTE);
|
||||
}
|
||||
@@ -238,9 +238,9 @@ BOOST_AUTO_TEST_CASE(OneUpstream) // one upstream, send Nack when Nack arrives
|
||||
strategy.afterReceiveNack(*face3, nack3, pitEntry);
|
||||
|
||||
BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 2);
|
||||
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitEntry, pitEntry);
|
||||
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitInterest, pitEntry->getInterest());
|
||||
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].header.getReason(), lp::NackReason::CONGESTION);
|
||||
BOOST_CHECK_EQUAL(strategy.sendNackHistory[1].pitEntry, pitEntry);
|
||||
BOOST_CHECK_EQUAL(strategy.sendNackHistory[1].pitInterest, pitEntry->getInterest());
|
||||
BOOST_CHECK_EQUAL(strategy.sendNackHistory[1].header.getReason(), lp::NackReason::CONGESTION);
|
||||
std::unordered_set<FaceId> nackFaceIds{strategy.sendNackHistory[0].outFaceId,
|
||||
strategy.sendNackHistory[1].outFaceId};
|
||||
@@ -273,7 +273,7 @@ BOOST_AUTO_TEST_CASE(TwoUpstreams) // two upstreams, send Nack when both Nacks a
|
||||
strategy.afterReceiveNack(*face4, nack4, pitEntry);
|
||||
|
||||
BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
|
||||
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitEntry, pitEntry);
|
||||
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitInterest, pitEntry->getInterest());
|
||||
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].outFaceId, face1->getId());
|
||||
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].header.getReason(), lp::NackReason::CONGESTION);
|
||||
}
|
||||
@@ -446,7 +446,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(CombineReasons, Combination, NackReasonCombination
|
||||
strategy.afterReceiveNack(*face4, nack4, pitEntry);
|
||||
|
||||
BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
|
||||
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitEntry, pitEntry);
|
||||
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitInterest, pitEntry->getInterest());
|
||||
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].outFaceId, face1->getId());
|
||||
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].header.getReason(), combination.getExpectedResult());
|
||||
}
|
||||
|
||||
@@ -56,8 +56,7 @@ protected:
|
||||
Face& outFace,
|
||||
bool wantNewNonce = false) override
|
||||
{
|
||||
SendInterestArgs args{pitEntry, outFace.getId(), wantNewNonce};
|
||||
sendInterestHistory.push_back(args);
|
||||
sendInterestHistory.push_back({pitEntry->getInterest(), outFace.getId(), wantNewNonce});
|
||||
pitEntry->insertOrUpdateOutRecord(outFace, pitEntry->getInterest());
|
||||
afterAction();
|
||||
}
|
||||
@@ -65,8 +64,7 @@ protected:
|
||||
virtual void
|
||||
rejectPendingInterest(const shared_ptr<pit::Entry>& pitEntry) override
|
||||
{
|
||||
RejectPendingInterestArgs args{pitEntry};
|
||||
rejectPendingInterestHistory.push_back(args);
|
||||
rejectPendingInterestHistory.push_back({pitEntry->getInterest()});
|
||||
afterAction();
|
||||
}
|
||||
|
||||
@@ -74,8 +72,7 @@ protected:
|
||||
sendNack(const shared_ptr<pit::Entry>& pitEntry, const Face& outFace,
|
||||
const lp::NackHeader& header) override
|
||||
{
|
||||
SendNackArgs args{pitEntry, outFace.getId(), header};
|
||||
sendNackHistory.push_back(args);
|
||||
sendNackHistory.push_back({pitEntry->getInterest(), outFace.getId(), header});
|
||||
pitEntry->deleteInRecord(outFace);
|
||||
afterAction();
|
||||
}
|
||||
@@ -83,7 +80,7 @@ protected:
|
||||
public:
|
||||
struct SendInterestArgs
|
||||
{
|
||||
shared_ptr<pit::Entry> pitEntry;
|
||||
Interest pitInterest;
|
||||
FaceId outFaceId;
|
||||
bool wantNewNonce;
|
||||
};
|
||||
@@ -91,13 +88,13 @@ public:
|
||||
|
||||
struct RejectPendingInterestArgs
|
||||
{
|
||||
shared_ptr<pit::Entry> pitEntry;
|
||||
Interest pitInterest;
|
||||
};
|
||||
std::vector<RejectPendingInterestArgs> rejectPendingInterestHistory;
|
||||
|
||||
struct SendNackArgs
|
||||
{
|
||||
shared_ptr<pit::Entry> pitEntry;
|
||||
Interest pitInterest;
|
||||
FaceId outFaceId;
|
||||
lp::NackHeader header;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user