From d1885191b97bbdc4924b8118172e0510ca912e16 Mon Sep 17 00:00:00 2001 From: Willem Thiart Date: Wed, 10 Jan 2018 11:41:52 +1300 Subject: [PATCH] Fixes #49 --- tests/test_snapshotting.c | 44 --------------------------------------- 1 file changed, 44 deletions(-) diff --git a/tests/test_snapshotting.c b/tests/test_snapshotting.c index 7c0d3a94..ce3347dc 100644 --- a/tests/test_snapshotting.c +++ b/tests/test_snapshotting.c @@ -562,47 +562,3 @@ void TestRaft_recv_entry_fails_if_snapshot_in_progress(CuTest* tc) ety.type = RAFT_LOGTYPE_ADD_NODE; CuAssertIntEquals(tc, RAFT_ERR_SNAPSHOT_IN_PROGRESS, raft_recv_entry(r, &ety, &cr)); } - -void TxestRaft_full_snapshot(CuTest * tc) -{ - raft_cbs_t funcs = { - .persist_term = __raft_persist_term, - .send_appendentries = __raft_send_appendentries, - }; - - void *r = raft_new(); - raft_set_callbacks(r, &funcs, NULL); - - msg_entry_response_t cr; - - raft_add_node(r, NULL, 1, 1); - raft_add_node(r, NULL, 2, 0); - - /* I am the leader */ - raft_set_state(r, RAFT_STATE_LEADER); - raft_set_current_term(r, 1); - CuAssertIntEquals(tc, 0, raft_get_log_count(r)); - - /* entry message */ - msg_entry_t ety = {}; - ety.id = 1; - ety.data.buf = "entry"; - ety.data.len = strlen("entry"); - - /* receive entry */ - raft_recv_entry(r, &ety, &cr); - raft_set_commit_idx(r, 1); - CuAssertIntEquals(tc, 1, raft_get_log_count(r)); - CuAssertIntEquals(tc, 1, raft_get_num_snapshottable_logs(r)); - - CuAssertIntEquals(tc, 0, raft_begin_snapshot(r)); - - raft_entry_t* _ety; - int i = raft_get_first_entry_idx(r); - for (; i < raft_get_commit_idx(r); i++) - CuAssertIntEquals(tc, 0, raft_poll_entry(r, &_ety)); - - CuAssertIntEquals(tc, 0, raft_end_snapshot(r)); - CuAssertIntEquals(tc, 0, raft_get_num_snapshottable_logs(r)); - CuAssertIntEquals(tc, 1, raft_get_log_count(r)); -}