File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
engines/ep/tests/module_tests Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1669,6 +1669,31 @@ TEST_P(KVBucketParamTest, VBucketDiskStatsENOENT) {
16691669 EXPECT_EQ (expected, store->getPerVBucketDiskStats ({}, mockStatFn));
16701670}
16711671
1672+ TEST_P (KVBucketParamTest, VbucketStateCounts) {
1673+ // confirm the vbMap correctly changes the number of vbuckets in a given
1674+ // state when vbuckets change state
1675+ auto vbA = Vbid (0 );
1676+ auto vbB = Vbid (1 );
1677+
1678+ auto expectVbCounts = [this ](uint16_t active, uint16_t replica) {
1679+ auto message = " Expected " + std::to_string (active) + " active and " +
1680+ std::to_string (replica) + " replica vbs" ;
1681+ EXPECT_EQ (active, store->getNumOfVBucketsInState (vbucket_state_active))
1682+ << message;
1683+ EXPECT_EQ (replica,
1684+ store->getNumOfVBucketsInState (vbucket_state_replica))
1685+ << message;
1686+ };
1687+ store->setVBucketState (vbA, vbucket_state_active);
1688+ expectVbCounts (1 , 0 );
1689+ store->setVBucketState (vbB, vbucket_state_active);
1690+ expectVbCounts (2 , 0 );
1691+ store->setVBucketState (vbA, vbucket_state_replica);
1692+ expectVbCounts (1 , 1 );
1693+ store->setVBucketState (vbB, vbucket_state_replica);
1694+ expectVbCounts (0 , 2 );
1695+ }
1696+
16721697class StoreIfTest : public KVBucketTest {
16731698public:
16741699 void SetUp () override {
You can’t perform that action at this time.
0 commit comments