Server test extension

This commit is contained in:
Pavel Kirienko
2015-05-10 20:10:13 +03:00
parent b7a4c9524e
commit f2c393e90d
3 changed files with 12 additions and 0 deletions
@@ -875,6 +875,12 @@ public:
}
return LazyConstructor<LogEntryInfo>();
}
Log::Index getNumAllocations() const
{
// Remember that index zero contains a special-purpose entry that doesn't count as allocation
return persistent_state_.getLog().getLastIndex();
}
};
}
@@ -300,6 +300,8 @@ public:
return 0;
}
Log::Index getNumAllocations() const { return raft_core_.getNumAllocations(); }
};
}
@@ -149,6 +149,8 @@ TEST(DynamicNodeIDServer, Main)
ASSERT_LE(0, server.init(own_unique_id, 1));
ASSERT_EQ(0, server.getNumAllocations());
/*
* Client
*/
@@ -168,6 +170,8 @@ TEST(DynamicNodeIDServer, Main)
ASSERT_TRUE(client.isAllocationComplete());
ASSERT_EQ(PreferredNodeID, client.getAllocatedNodeID());
ASSERT_EQ(2, server.getNumAllocations()); // Server's own node ID + client
}