From: Robert LeBlanc Date: Wed, 2 Mar 2016 22:07:50 +0000 (+0000) Subject: Revert "test/common/test_weighted_priority_queue Fix the unit tests since the" X-Git-Tag: v10.2.0~19^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=33f68b88e9b6478d2eef7b56752743f43593e384;p=ceph.git Revert "test/common/test_weighted_priority_queue Fix the unit tests since the" This reverts commit 3a6d6279fe386f9591fdbd8c38fe2fb059dbc398. Since we added round robin back into the queue, make sure it works right. Signed-off-by: Robert LeBlanc --- diff --git a/src/test/common/test_weighted_priority_queue.cc b/src/test/common/test_weighted_priority_queue.cc index b8519794b6e1..d3ebc4199cfb 100644 --- a/src/test/common/test_weighted_priority_queue.cc +++ b/src/test/common/test_weighted_priority_queue.cc @@ -114,6 +114,13 @@ protected: // in the strict queue. LQ::reverse_iterator ri = strictq.rbegin(); EXPECT_EQ(std::get<0>(r), ri->first); + // Check that if there are multiple classes in a priority + // that it is not dequeueing the same class each time. + LastKlass::iterator si = last_strict.find(std::get<0>(r)); + if (strictq[std::get<0>(r)].size() > 1 && si != last_strict.end()) { + EXPECT_NE(std::get<1>(r), si->second); + } + last_strict[std::get<0>(r)] = std::get<1>(r); Item t = strictq[std::get<0>(r)][std::get<1>(r)].front().second; EXPECT_EQ(std::get<2>(r), std::get<2>(t)); @@ -125,6 +132,14 @@ protected: strictq.erase(std::get<0>(r)); } } else { + // Check that if there are multiple classes in a priority + // that it is not dequeueing the same class each time. + LastKlass::iterator si = last_norm.find(std::get<0>(r)); + if (normq[std::get<0>(r)].size() > 1 && si != last_norm.end()) { + EXPECT_NE(std::get<1>(r), si->second); + } + last_norm[std::get<0>(r)] = std::get<1>(r); + Item t = normq[std::get<0>(r)][std::get<1>(r)].front().second; EXPECT_EQ(std::get<2>(r), std::get<2>(t)); normq[std::get<0>(r)][std::get<1>(r)].pop_front();