Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Willemt Raft
Commits
e91d3e61
Commit
e91d3e61
authored
Aug 03, 2015
by
Willem Thiart
Browse files
Refactored test names
parent
9c07ad73
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/raft.h
View file @
e91d3e61
...
@@ -331,10 +331,12 @@ int raft_recv_requestvote_response(raft_server_t* me, int node,
...
@@ -331,10 +331,12 @@ int raft_recv_requestvote_response(raft_server_t* me, int node,
* Append the entry to the log
* Append the entry to the log
* Send appendentries to followers
* Send appendentries to followers
* This function will block if it needs to append the message.
* This function will block if it needs to append the message.
* Will fail:
* - if the server is not the leader
* @param node Index of the node who sent us this message
* @param node Index of the node who sent us this message
* @param[out] r The resulting response
* @param[out] r The resulting response
* @param e The entry message
* @param e The entry message
* @return 0 on success, -1
if the server is not the leader
*/
* @return 0 on success, -1
on failure
*/
int
raft_recv_entry
(
raft_server_t
*
me
,
int
node
,
msg_entry_t
*
e
,
int
raft_recv_entry
(
raft_server_t
*
me
,
int
node
,
msg_entry_t
*
e
,
msg_entry_response_t
*
r
);
msg_entry_response_t
*
r
);
...
...
tests/test_server.c
View file @
e91d3e61
...
@@ -581,7 +581,7 @@ TestRaft_follower_recv_appendentries_updates_currentterm_if_term_gt_currentterm(
...
@@ -581,7 +581,7 @@ TestRaft_follower_recv_appendentries_updates_currentterm_if_term_gt_currentterm(
CuAssertTrue
(
tc
,
1
==
current_leader
);
CuAssertTrue
(
tc
,
1
==
current_leader
);
}
}
void
TestRaft_follower_
doesnt_log_after_appendentry
_if_no_entries_are_specified
(
void
TestRaft_follower_
recv_appendentries_does_not_log
_if_no_entries_are_specified
(
CuTest
*
tc
)
CuTest
*
tc
)
{
{
void
*
r
;
void
*
r
;
...
@@ -610,7 +610,7 @@ void TestRaft_follower_doesnt_log_after_appendentry_if_no_entries_are_specified(
...
@@ -610,7 +610,7 @@ void TestRaft_follower_doesnt_log_after_appendentry_if_no_entries_are_specified(
CuAssertTrue
(
tc
,
0
==
raft_get_log_count
(
r
));
CuAssertTrue
(
tc
,
0
==
raft_get_log_count
(
r
));
}
}
void
TestRaft_follower_
increases_log_after_appendentry
(
CuTest
*
tc
)
void
TestRaft_follower_
recv_appendentries_increases_log
(
CuTest
*
tc
)
{
{
void
*
r
;
void
*
r
;
void
*
sender
;
void
*
sender
;
...
@@ -1009,7 +1009,7 @@ void TestRaft_follower_becoming_candidate_resets_election_timeout(CuTest * tc)
...
@@ -1009,7 +1009,7 @@ void TestRaft_follower_becoming_candidate_resets_election_timeout(CuTest * tc)
CuAssertTrue
(
tc
,
raft_get_timeout_elapsed
(
r
)
<
900
);
CuAssertTrue
(
tc
,
raft_get_timeout_elapsed
(
r
)
<
900
);
}
}
void
TestRaft_follower_rec
eiving
_appendentries_resets_election_timeout
(
void
TestRaft_follower_rec
v
_appendentries_resets_election_timeout
(
CuTest
*
tc
)
CuTest
*
tc
)
{
{
void
*
r
;
void
*
r
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment