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_server_recv_requestvote_response_increase_votes_for_me problem #30

Closed
tinymindxx opened this issue Sep 13, 2016 · 2 comments
Closed

Comments

@tinymindxx
Copy link

tinymindxx commented Sep 13, 2016

in test_server.c

void TestRaft_server_recv_requestvote_response_increase_votes_for_me(
CuTest * tc
)
{
void *r = raft_new();
raft_add_node(r, NULL, 1, 1);
raft_add_node(r, NULL, 2, 0);
raft_set_current_term(r, 1);
CuAssertTrue(tc, 0 == raft_get_nvotes_for_me(r));

vote for myself ,so vote nums is 1

raft_become_candidate(r);

msg_requestvote_response_t rvr;
memset(&rvr, 0, sizeof(msg_requestvote_response_t));
rvr.term = 1;
rvr.vote_granted = 1;

recv vote response, so vote nums increases to 2

raft_recv_requestvote_response(r, raft_get_node(r, 2), &rvr);

maybe this should be 2

CuAssertTrue(tc, 1 == raft_get_nvotes_for_me(r));

}

wonder is my understanding error, or a mistake ,thanks!

@willemt
Copy link
Owner

willemt commented Sep 15, 2016

Hi I've already answered this in #28 😄

Please pull the latest version from Github?

@willemt willemt closed this as completed Sep 15, 2016
@tinymindxx
Copy link
Author

sorry, i missed this.

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