summaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/server/memory_flush_config_updater
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@oath.com>2017-12-05 12:33:26 +0000
committerTor Egge <Tor.Egge@oath.com>2017-12-05 12:33:26 +0000
commitb9140c781a6cd3b96436dcee68f582058d59257c (patch)
tree115abca752507d9edf0692f873daded08cb88da4 /searchcore/src/tests/proton/server/memory_flush_config_updater
parent43e141e0567ae7eb67c0d7eeb9eb8177a59fab04 (diff)
Allow more disk bloat while node state is retired.
Diffstat (limited to 'searchcore/src/tests/proton/server/memory_flush_config_updater')
-rw-r--r--searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp b/searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp
index a76596aa927..b3a7f5f525e 100644
--- a/searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp
+++ b/searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp
@@ -56,9 +56,16 @@ struct Fixture
EXPECT_EQUAL(expMaxEachMemory, strategy->getConfig().maxMemoryGain);
EXPECT_EQUAL(expMaxGlobalTlsSize, strategy->getConfig().maxGlobalTlsSize);
}
+ void assertStrategyDiskConfig(double expGlobalDiskBloatFactor, double expDiskBloatFactor) {
+ EXPECT_APPROX(expGlobalDiskBloatFactor, strategy->getConfig().globalDiskBloatFactor, 0.00001);
+ EXPECT_APPROX(expDiskBloatFactor, strategy->getConfig().diskBloatFactor, 0.00001);
+ }
void notifyDiskMemUsage(const ResourceUsageState &diskState, const ResourceUsageState &memoryState) {
updater.notifyDiskMemUsage(DiskMemUsageState(diskState, memoryState));
}
+ void setNodeRetired(bool nodeRetired) {
+ updater.setNodeRetired(nodeRetired);
+ }
};
TEST_F("require that strategy is updated when setting new config", Fixture)
@@ -133,4 +140,14 @@ TEST_F("require that we must go below low watermark for memory usage before usin
TEST_DO(f.assertStrategyConfig(4, 1, 20));
}
+TEST_F("require that more disk bloat is allowed while node state is retired", Fixture)
+{
+ f.notifyDiskMemUsage(ResourceUsageState(0.7, 0.3), belowLimit());
+ TEST_DO(f.assertStrategyDiskConfig(0.2, 0.2));
+ f.setNodeRetired(true);
+ TEST_DO(f.assertStrategyDiskConfig((0.8 - 0.3 / 0.7) * 0.8, 1.0));
+ f.notifyDiskMemUsage(belowLimit(), belowLimit());
+ TEST_DO(f.assertStrategyDiskConfig(0.2, 0.2));
+}
+
TEST_MAIN() { TEST_RUN_ALL(); }