diff options
Diffstat (limited to 'searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp')
-rw-r--r-- | searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp | 17 |
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(); } |