Skip to content
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

Merged
merged 9 commits into from
Dec 9, 2020

Conversation

Smityz
Copy link
Contributor

@Smityz Smityz commented Nov 27, 2020

No description provided.

@Smityz Smityz closed this Nov 30, 2020
@Smityz Smityz reopened this Nov 30, 2020
Comment on lines +313 to +332
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();
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/server/test/hotkey_collector_test.cpp Show resolved Hide resolved
@Smityz Smityz closed this Dec 3, 2020
@Smityz Smityz reopened this Dec 3, 2020
@levy5307 levy5307 merged commit cea104d into apache:master Dec 9, 2020
@neverchanje neverchanje mentioned this pull request Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants