aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/tests/persistence/filestorage
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2021-01-29 14:29:59 +0000
committerGeir Storli <geirst@verizonmedia.com>2021-01-29 14:34:29 +0000
commit9a676ff3b35353424d9a02a4c09d9dd1bb655f46 (patch)
treecaab73fa5881bb5f2527b22d3138663ba27d48be /storage/src/tests/persistence/filestorage
parent1341628ee1587fb39703a4fb6e3443286435dca0 (diff)
Wire reporting of attribute resource usage all the way to the cluster controller via the host info API.
Diffstat (limited to 'storage/src/tests/persistence/filestorage')
-rw-r--r--storage/src/tests/persistence/filestorage/service_layer_host_info_reporter_test.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/storage/src/tests/persistence/filestorage/service_layer_host_info_reporter_test.cpp b/storage/src/tests/persistence/filestorage/service_layer_host_info_reporter_test.cpp
index 86595fb44e8..a54c5c8ccf9 100644
--- a/storage/src/tests/persistence/filestorage/service_layer_host_info_reporter_test.cpp
+++ b/storage/src/tests/persistence/filestorage/service_layer_host_info_reporter_test.cpp
@@ -102,6 +102,28 @@ TEST_F(ServiceLayerHostInfoReporterTest, request_almost_immediate_node_state_as_
EXPECT_EQ(ResourceUsage(0.8, 0.7, {0.1, attr_es_name}, {0.2, attr_mv_name}), get_usage());
}
+TEST_F(ServiceLayerHostInfoReporterTest,
+ first_valid_attribute_enum_store_sample_triggers_immediate_node_state_when_below_slack_diff)
+{
+ // TODO: Assert this is below slack diff when that becomes configurable.
+ constexpr double usage_below_slack_diff = 0.00001;
+ notify(0.0, 0.0, {usage_below_slack_diff, attr_es_name}, {});
+ EXPECT_EQ(1, requested_almost_immediate_replies());
+ EXPECT_EQ(ResourceUsage(0.0, 0.0, {usage_below_slack_diff, attr_es_name}, {}), get_old_usage());
+ EXPECT_EQ(ResourceUsage(0.0, 0.0, {usage_below_slack_diff, attr_es_name}, {}), get_usage());
+}
+
+TEST_F(ServiceLayerHostInfoReporterTest,
+ first_valid_attribute_multi_value_sample_triggers_immediate_node_state_when_below_slack_diff)
+{
+ // TODO: Assert this is below slack diff when that becomes configurable.
+ constexpr double usage_below_slack_diff = 0.00001;
+ notify(0.0, 0.0, {}, {usage_below_slack_diff, attr_mv_name});
+ EXPECT_EQ(1, requested_almost_immediate_replies());
+ EXPECT_EQ(ResourceUsage(0.0, 0.0, {}, {usage_below_slack_diff, attr_mv_name}), get_old_usage());
+ EXPECT_EQ(ResourceUsage(0.0, 0.0, {}, {usage_below_slack_diff, attr_mv_name}), get_usage());
+}
+
TEST_F(ServiceLayerHostInfoReporterTest, json_report_generated)
{
EXPECT_EQ(ResourceUsage(0.0, 0.0), get_slime_usage());