-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(hotkey): add unit test of hotkey collector #648
Conversation
on_detect_hotkey(generate_control_rpc(dsn::replication::hotkey_type::READ, | ||
dsn::replication::detect_action::START), | ||
resp); | ||
ASSERT_EQ(resp.err, dsn::ERR_OK); | ||
ASSERT_EQ(get_collector_stat(collector), hotkey_collector_state::COARSE_DETECTING); | ||
|
||
for (int i = 0; i < 1000; i++) { | ||
dsn::tasking::enqueue(LPC_WRITE, &_tracker, [&] { | ||
_server->on_get(generate_get_rpc(generate_hash_key_by_random(false))); | ||
}); | ||
} | ||
collector->analyse_data(); | ||
ASSERT_EQ(get_collector_stat(collector), hotkey_collector_state::COARSE_DETECTING); | ||
|
||
on_detect_hotkey(generate_control_rpc(dsn::replication::hotkey_type::READ, | ||
dsn::replication::detect_action::STOP), | ||
resp); | ||
ASSERT_EQ(resp.err, dsn::ERR_OK); | ||
ASSERT_EQ(get_collector_stat(collector), hotkey_collector_state::STOPPED); | ||
_tracker.wait_outstanding_tasks(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entire block of tests are redundant. It repeates the previous lines, from STOPPED to COARSE_DETECTING, and STOPPED. You don't have to repeat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/apache/incubator-pegasus/pull/648/files/b7927974330ad1b93d5f28cd2b798d2e7ce2d244#diff-d16dd94725655577d994a6cb037e9e369e6ddcd03f4c5fdbe6dfd99d69362236R321
this block is to test the state transform in normal data
https://github.com/apache/incubator-pegasus/pull/648/files/b7927974330ad1b93d5f28cd2b798d2e7ce2d244#diff-d16dd94725655577d994a6cb037e9e369e6ddcd03f4c5fdbe6dfd99d69362236R287
And the previous block is to test it in hotspot data
No description provided.