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 @@ -1591,6 +1591,31 @@ TEST_P(KVBucketParamTest, VBucketDiskStatsENOENT) {
15911591 EXPECT_EQ (expected, store->getPerVBucketDiskStats ({}, mockStatFn));
15921592}
15931593
1594+ TEST_P (KVBucketParamTest, VbucketStateCounts) {
1595+ // confirm the vbMap correctly changes the number of vbuckets in a given
1596+ // state when vbuckets change state
1597+ auto vbA = Vbid (0 );
1598+ auto vbB = Vbid (1 );
1599+
1600+ auto expectVbCounts = [this ](uint16_t active, uint16_t replica) {
1601+ auto message = " Expected " + std::to_string (active) + " active and " +
1602+ std::to_string (replica) + " replica vbs" ;
1603+ EXPECT_EQ (active, store->getNumOfVBucketsInState (vbucket_state_active))
1604+ << message;
1605+ EXPECT_EQ (replica,
1606+ store->getNumOfVBucketsInState (vbucket_state_replica))
1607+ << message;
1608+ };
1609+ store->setVBucketState (vbA, vbucket_state_active);
1610+ expectVbCounts (1 , 0 );
1611+ store->setVBucketState (vbB, vbucket_state_active);
1612+ expectVbCounts (2 , 0 );
1613+ store->setVBucketState (vbA, vbucket_state_replica);
1614+ expectVbCounts (1 , 1 );
1615+ store->setVBucketState (vbB, vbucket_state_replica);
1616+ expectVbCounts (0 , 2 );
1617+ }
1618+
15941619class StoreIfTest : public KVBucketTest {
15951620public:
15961621 void SetUp () override {
You can’t perform that action at this time.
0 commit comments