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
919d723d
Commit
919d723d
authored
Dec 23, 2013
by
willem
Browse files
Fixed voted for test
parent
e62f254f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
919d723d
...
@@ -7,7 +7,6 @@ GCOV_OUTPUT = *.gcda *.gcno *.gcov
...
@@ -7,7 +7,6 @@ GCOV_OUTPUT = *.gcda *.gcno *.gcov
GCOV_CCFLAGS
=
-fprofile-arcs
-ftest-coverage
GCOV_CCFLAGS
=
-fprofile-arcs
-ftest-coverage
SHELL
=
/bin/bash
SHELL
=
/bin/bash
CC
=
gcc
CC
=
gcc
#CCFLAGS = -g -O2 -Wall -Werror -Werror=return-type -Werror=uninitialized -Wcast-align -fno-omit-frame-pointer -fno-common -fsigned-char $(GCOV_CCFLAGS) -I$(HASHMAP_DIR) -I$(BITSTREAM_DIR) -I$(LLQUEUE_DIR)
CCFLAGS
=
-g
-O2
-Werror
-Werror
=
return
-type
-Werror
=
uninitialized
-Wcast-align
-fno-omit-frame-pointer
-fno-common
-fsigned-char
$(GCOV_CCFLAGS)
-I
$(HASHMAP_DIR)
-I
$(BITSTREAM_DIR)
-I
$(LLQUEUE_DIR)
CCFLAGS
=
-g
-O2
-Werror
-Werror
=
return
-type
-Werror
=
uninitialized
-Wcast-align
-fno-omit-frame-pointer
-fno-common
-fsigned-char
$(GCOV_CCFLAGS)
-I
$(HASHMAP_DIR)
-I
$(BITSTREAM_DIR)
-I
$(LLQUEUE_DIR)
all
:
tests_main
all
:
tests_main
...
...
test_server.c
View file @
919d723d
...
@@ -10,19 +10,16 @@
...
@@ -10,19 +10,16 @@
#include "raft.h"
#include "raft.h"
#include "mock_send_functions.h"
#include "mock_send_functions.h"
// TODO: appendentries receipt resets elapsed time timeout
// TODO: leader doesn't timeout and cause election
// TODO: leader doesn't timeout and cause election
#if 0
void
TestRaft_server_voted_for_records_who_we_voted_for
(
CuTest
*
tc
)
void T_estRaft_server_voted_for_records_who_we_voted_for(CuTest * tc)
{
{
void
*
r
;
void
*
r
;
r
=
raft_new
();
r
=
raft_new
();
raft_vote
(
r
,
2
);
raft_vote
(
r
,
2
);
CuAssertTrue(tc,
1
== raft_get_voted_for(r));
CuAssertTrue
(
tc
,
2
==
raft_get_voted_for
(
r
));
}
}
#endif
void
TestRaft_server_idx_starts_at_1
(
CuTest
*
tc
)
void
TestRaft_server_idx_starts_at_1
(
CuTest
*
tc
)
{
{
...
@@ -1191,6 +1188,22 @@ void TestRaft_follower_becoming_candidate_resets_election_timeout(CuTest * tc)
...
@@ -1191,6 +1188,22 @@ void TestRaft_follower_becoming_candidate_resets_election_timeout(CuTest * tc)
/* time is selected randomly */
/* time is selected randomly */
CuAssertTrue
(
tc
,
raft_get_timeout_elapsed
(
r
)
<
900
);
CuAssertTrue
(
tc
,
raft_get_timeout_elapsed
(
r
)
<
900
);
}
}
void
TestRaft_follower_receiving_appendentries_resets_election_timeout
(
CuTest
*
tc
)
{
void
*
r
;
r
=
raft_new
();
raft_set_election_timeout
(
r
,
1000
);
raft_periodic
(
r
,
900
);
msg_appendentries_t
ae
;
memset
(
&
ae
,
0
,
sizeof
(
msg_appendentries_t
));
ae
.
term
=
1
;
raft_recv_appendentries
(
r
,
1
,
&
ae
);
CuAssertTrue
(
tc
,
0
==
raft_get_timeout_elapsed
(
r
));
}
/* Candidate 5.2 */
/* Candidate 5.2 */
void
TestRaft_follower_becoming_candidate_requests_votes_from_other_servers
(
CuTest
*
tc
)
void
TestRaft_follower_becoming_candidate_requests_votes_from_other_servers
(
CuTest
*
tc
)
...
...
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