Skip to content

Commit d188519

Browse files
committed
Fixes #49
1 parent d620a9f commit d188519

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

tests/test_snapshotting.c

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -562,47 +562,3 @@ void TestRaft_recv_entry_fails_if_snapshot_in_progress(CuTest* tc)
562562
ety.type = RAFT_LOGTYPE_ADD_NODE;
563563
CuAssertIntEquals(tc, RAFT_ERR_SNAPSHOT_IN_PROGRESS, raft_recv_entry(r, &ety, &cr));
564564
}
565-
566-
void TxestRaft_full_snapshot(CuTest * tc)
567-
{
568-
raft_cbs_t funcs = {
569-
.persist_term = __raft_persist_term,
570-
.send_appendentries = __raft_send_appendentries,
571-
};
572-
573-
void *r = raft_new();
574-
raft_set_callbacks(r, &funcs, NULL);
575-
576-
msg_entry_response_t cr;
577-
578-
raft_add_node(r, NULL, 1, 1);
579-
raft_add_node(r, NULL, 2, 0);
580-
581-
/* I am the leader */
582-
raft_set_state(r, RAFT_STATE_LEADER);
583-
raft_set_current_term(r, 1);
584-
CuAssertIntEquals(tc, 0, raft_get_log_count(r));
585-
586-
/* entry message */
587-
msg_entry_t ety = {};
588-
ety.id = 1;
589-
ety.data.buf = "entry";
590-
ety.data.len = strlen("entry");
591-
592-
/* receive entry */
593-
raft_recv_entry(r, &ety, &cr);
594-
raft_set_commit_idx(r, 1);
595-
CuAssertIntEquals(tc, 1, raft_get_log_count(r));
596-
CuAssertIntEquals(tc, 1, raft_get_num_snapshottable_logs(r));
597-
598-
CuAssertIntEquals(tc, 0, raft_begin_snapshot(r));
599-
600-
raft_entry_t* _ety;
601-
int i = raft_get_first_entry_idx(r);
602-
for (; i < raft_get_commit_idx(r); i++)
603-
CuAssertIntEquals(tc, 0, raft_poll_entry(r, &_ety));
604-
605-
CuAssertIntEquals(tc, 0, raft_end_snapshot(r));
606-
CuAssertIntEquals(tc, 0, raft_get_num_snapshottable_logs(r));
607-
CuAssertIntEquals(tc, 1, raft_get_log_count(r));
608-
}

0 commit comments

Comments
 (0)