diff options
Diffstat (limited to 'src/test/test_hs_common.c')
-rw-r--r-- | src/test/test_hs_common.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c index 2aff179687..c6104301e1 100644 --- a/src/test/test_hs_common.c +++ b/src/test/test_hs_common.c @@ -359,9 +359,10 @@ mock_networkstatus_get_latest_consensus(void) } static networkstatus_t * -mock_networkstatus_get_live_consensus(time_t now) +mock_networkstatus_get_reasonably_live_consensus(time_t now, int flavor) { (void) now; + (void) flavor; tt_assert(mock_ns); @@ -381,6 +382,8 @@ test_responsible_hsdirs(void *arg) MOCK(networkstatus_get_latest_consensus, mock_networkstatus_get_latest_consensus); + MOCK(networkstatus_get_reasonably_live_consensus, + mock_networkstatus_get_reasonably_live_consensus); ns = networkstatus_get_latest_consensus(); @@ -417,6 +420,8 @@ test_responsible_hsdirs(void *arg) smartlist_clear(ns->routerstatus_list); networkstatus_vote_free(mock_ns); cleanup_nodelist(); + + UNMOCK(networkstatus_get_reasonably_live_consensus); } static void @@ -466,6 +471,8 @@ test_desc_reupload_logic(void *arg) hs_init(); + MOCK(networkstatus_get_reasonably_live_consensus, + mock_networkstatus_get_reasonably_live_consensus); MOCK(router_have_minimum_dir_info, mock_router_have_minimum_dir_info); MOCK(get_or_state, @@ -877,9 +884,11 @@ static smartlist_t *service_responsible_hsdirs = NULL; static smartlist_t *client_responsible_hsdirs = NULL; static networkstatus_t * -mock_networkstatus_get_live_consensus_service(time_t now) +mock_networkstatus_get_reasonably_live_consensus_service(time_t now, + int flavor) { (void) now; + (void) flavor; if (mock_service_ns) { return mock_service_ns; @@ -895,13 +904,14 @@ mock_networkstatus_get_live_consensus_service(time_t now) static networkstatus_t * mock_networkstatus_get_latest_consensus_service(void) { - return mock_networkstatus_get_live_consensus_service(0); + return mock_networkstatus_get_reasonably_live_consensus_service(0, 0); } static networkstatus_t * -mock_networkstatus_get_live_consensus_client(time_t now) +mock_networkstatus_get_reasonably_live_consensus_client(time_t now, int flavor) { (void) now; + (void) flavor; if (mock_client_ns) { return mock_client_ns; @@ -917,7 +927,7 @@ mock_networkstatus_get_live_consensus_client(time_t now) static networkstatus_t * mock_networkstatus_get_latest_consensus_client(void) { - return mock_networkstatus_get_live_consensus_client(0); + return mock_networkstatus_get_reasonably_live_consensus_client(0, 0); } /* Mock function because we are not trying to test the close circuit that does @@ -1377,8 +1387,8 @@ run_reachability_scenario(const reachability_cfg_t *cfg, int num_scenario) * === Client setup === */ - MOCK(networkstatus_get_live_consensus, - mock_networkstatus_get_live_consensus_client); + MOCK(networkstatus_get_reasonably_live_consensus, + mock_networkstatus_get_reasonably_live_consensus_client); MOCK(networkstatus_get_latest_consensus, mock_networkstatus_get_latest_consensus_client); @@ -1402,14 +1412,14 @@ run_reachability_scenario(const reachability_cfg_t *cfg, int num_scenario) tt_int_op(smartlist_len(client_responsible_hsdirs), OP_EQ, 6); UNMOCK(networkstatus_get_latest_consensus); - UNMOCK(networkstatus_get_live_consensus); + UNMOCK(networkstatus_get_reasonably_live_consensus); /* * === Service setup === */ - MOCK(networkstatus_get_live_consensus, - mock_networkstatus_get_live_consensus_service); + MOCK(networkstatus_get_reasonably_live_consensus, + mock_networkstatus_get_reasonably_live_consensus_service); MOCK(networkstatus_get_latest_consensus, mock_networkstatus_get_latest_consensus_service); @@ -1436,7 +1446,7 @@ run_reachability_scenario(const reachability_cfg_t *cfg, int num_scenario) tt_int_op(smartlist_len(service_responsible_hsdirs), OP_EQ, 8); UNMOCK(networkstatus_get_latest_consensus); - UNMOCK(networkstatus_get_live_consensus); + UNMOCK(networkstatus_get_reasonably_live_consensus); /* Some testing of the values we just got from the client and service. */ tt_mem_op(&client_blinded_pk, OP_EQ, &service_blinded_pk, @@ -1687,8 +1697,8 @@ test_client_service_hsdir_set_sync(void *arg) MOCK(networkstatus_get_latest_consensus, mock_networkstatus_get_latest_consensus); - MOCK(networkstatus_get_live_consensus, - mock_networkstatus_get_live_consensus); + MOCK(networkstatus_get_reasonably_live_consensus, + mock_networkstatus_get_reasonably_live_consensus); MOCK(get_or_state, get_or_state_replacement); MOCK(hs_desc_encode_descriptor, |