Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(55)

Unified Diff: src/BackupSelectorTest.cc

Issue 237001: flush method using c++ erase API, crash recovery updated to use the new flush and getTableConfig API
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/BackupSelector.cc ('k') | src/CoordinatorServerList.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/BackupSelectorTest.cc
diff --git a/src/BackupSelectorTest.cc b/src/BackupSelectorTest.cc
index c7accea45c02a1325b775570ed42b1d9e6324a8e..b29e0b1a81b6eedbf305a2448465898f6df6cbfb 100644
--- a/src/BackupSelectorTest.cc
+++ b/src/BackupSelectorTest.cc
@@ -225,6 +225,23 @@ TEST_F(BackupSelectorTest, selectSecondary) {
EXPECT_EQ(ServerId(4, 0), id);
}
+TEST_F(BackupSelectorTest, signalFreedPrimary) {
+ MockRandom _(1);
+ // getRandomServerIdWithServer(BACKUP_SERVICE) returns backups in order
+ // that they enlisted above.
+ std::vector<ServerId> ids;
+ addEqualHosts(ids);
+
+ ServerId backup = selector->selectPrimary(0, NULL); // use backup1 / id 2
+ EXPECT_EQ(ids[0], backup);
+
+ BackupStats *stats = selector->tracker[backup];
+ stats->primaryReplicaCount = 10;
+ EXPECT_EQ(10u, stats->primaryReplicaCount);
+ selector->signalFreedPrimary(backup);
+ EXPECT_EQ(9u, stats->primaryReplicaCount);
+}
+
#if 0
// This test should run forever, hence why it is commented out.
// Occasionally, when self-doubt mounts, it is worth running, though.
« no previous file with comments | « src/BackupSelector.cc ('k') | src/CoordinatorServerList.h » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld aab5469