Skip to content

Commit

Permalink
test: Convert replication tests to use the v1 API
Browse files Browse the repository at this point in the history
Signed-off-by: Free Ekanayaka <free@ekanayaka.io>
  • Loading branch information
freeekanayaka committed Dec 27, 2023
1 parent aacf671 commit d3ca447
Show file tree
Hide file tree
Showing 5 changed files with 348 additions and 159 deletions.
2 changes: 1 addition & 1 deletion src/convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "request.h"
#include "tracing.h"

#define infof(...) Tracef(r->tracer, __VA_ARGS__)
#define infof(...) Infof(r->tracer, " " __VA_ARGS__)
#define tracef(...) Tracef(r->tracer, __VA_ARGS__)

/* Convenience for setting a new state value and asserting that the transition
Expand Down
6 changes: 3 additions & 3 deletions test/integration/test_election.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,20 +130,20 @@ TEST_V1(election, GrantAgain, setUp, tearDown, 0, NULL)
* result and eventually starts a new election round. */
CLUSTER_DISCONNECT(2, 1);
CLUSTER_TRACE(
"[ 270] 1 > timeout as candidate\n"
"[ 200] 1 > timeout as candidate\n"
" stay candidate, start election for term 3\n");

/* Reconnecting the two servers eventually makes the first server win the
* election. */
CLUSTER_RECONNECT(2, 1);

CLUSTER_TRACE(
"[ 280] 2 > recv request vote from server 1\n"
"[ 210] 2 > recv request vote from server 1\n"
" remote term is higher (3 vs 2) -> bump term\n"
" remote log equal or longer (1^1 vs 1^1) -> grant vote\n");

CLUSTER_TRACE(
"[ 290] 1 > recv request vote result from server 2\n"
"[ 220] 1 > recv request vote result from server 2\n"
" quorum reached with 2 votes out of 2 -> convert to leader\n"
" replicate 1 new entry (2^3)\n"
" probe server 2 sending 1 entry (2^3)\n");
Expand Down
Loading

0 comments on commit d3ca447

Please sign in to comment.