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

TestRaft_leader_recv_entry_resets_election_timeout error #31

Open
tinymindxx opened this issue Sep 19, 2016 · 0 comments
Open

TestRaft_leader_recv_entry_resets_election_timeout error #31

tinymindxx opened this issue Sep 19, 2016 · 0 comments
Assignees

Comments

@tinymindxx
Copy link

tinymindxx commented Sep 19, 2016

in test_server.c ,function TestRaft_leader_recv_entry_resets_election_timeout may exists some error .

void TestRaft_leader_recv_entry_resets_election_timeout(
CuTest * tc)
{
void *r = raft_new();
raft_set_election_timeout(r, 1000);
raft_set_state(r, RAFT_STATE_LEADER);

if we change 900 to 1, this test wont pass,because raft_periodic function will call raft_send_append_entries_all function when msec_since_last_period > request_timeout (default 200), which will reset the timeout_elapsed

raft_periodic(r, 900);

/* entry message */
msg_entry_t mety = {};
mety.id = 1;
mety.data.buf = "entry";
mety.data.len = strlen("entry");

add a new assert,this is true and still can pass the tests

CuAssertTrue(tc, 0 == raft_get_timeout_elapsed(r));

/* receive entry */
msg_entry_response_t cr;

this does not change the timeout_elapsed at all

raft_recv_entry(r, &mety, &cr);
CuAssertTrue(tc, 0 == raft_get_timeout_elapsed(r));

}

@willemt willemt self-assigned this Nov 21, 2017
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

No branches or pull requests

2 participants