levy5307 commented on a change in pull request #604:
URL: https://github.com/apache/incubator-pegasus/pull/604#discussion_r490692037
##########
File path: src/server/test/hotspot_partition_test.cpp
##########
@@ -92,6 +107,29 @@ TEST_F(hotspot_partition_test, hotspot_partition_policy)
test_rows[HOT_SCENARIO_1_WRITE_HOT_PARTITION].put_qps = 5000.0;
expect_vector = {{0, 0, 0, 4, 0, 0, 0, 0}, {0, 0, 4, 0, 0, 0, 0, 0}};
test_policy_in_scenarios(test_rows, expect_vector, calculator);
+ clear_calculator_histories(calculator);
+}
+
+TEST_F(hotspot_partition_test, send_hotkey_detect_request)
+{
+ const int HOT_SCENARIO_0_READ_HOT_PARTITION = 7;
+ const int HOT_SCENARIO_0_WRITE_HOT_PARTITION = 0;
+ std::vector<row_data> test_rows = generate_row_data();
+ test_rows[HOT_SCENARIO_0_READ_HOT_PARTITION].get_qps = 5000.0;
+ test_rows[HOT_SCENARIO_0_WRITE_HOT_PARTITION].put_qps = 5000.0;
+ for (int i = 0; i < FLAGS_occurrence_threshold; i++) {
+ aggregate_analyse_data(test_rows, calculator);
+ }
+ std::vector<std::array<int, 2>> expect_result = {
+ {0, 100}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {100, 0}};
+ ASSERT_EQ(calculator._hotpartition_pool, expect_result);
+
+ test_rows = generate_row_data();
+ for (int i = 0; i < 50; i++) {
Review comment:
what's the meaning of number `50`?
we should avoid immediate value in our program
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]