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
09657b1c
Commit
09657b1c
authored
May 17, 2018
by
Willem Thiart
Browse files
Add test for #61
parent
eaa9e5cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/test_snapshotting.c
View file @
09657b1c
...
...
@@ -379,6 +379,22 @@ void TestRaft_follower_load_from_snapshot(CuTest * tc)
CuAssertIntEquals
(
tc
,
7
,
raft_get_commit_idx
(
r
));
}
void
TestRaft_follower_load_from_snapshot_fails_if_term_is_0
(
CuTest
*
tc
)
{
raft_cbs_t
funcs
=
{
};
void
*
r
=
raft_new
();
raft_set_callbacks
(
r
,
&
funcs
,
NULL
);
raft_add_node
(
r
,
NULL
,
1
,
1
);
raft_add_node
(
r
,
NULL
,
2
,
0
);
raft_set_state
(
r
,
RAFT_STATE_FOLLOWER
);
CuAssertIntEquals
(
tc
,
0
,
raft_get_log_count
(
r
));
CuAssertIntEquals
(
tc
,
-
1
,
raft_begin_load_snapshot
(
r
,
0
,
5
));
}
void
TestRaft_follower_load_from_snapshot_fails_if_already_loaded
(
CuTest
*
tc
)
{
raft_cbs_t
funcs
=
{
...
...
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