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 61306778d4..6f5f21f49a 100644 --- a/src/test/test_hs_common.c +++ b/src/test/test_hs_common.c @@ -360,9 +360,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); @@ -382,6 +383,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(); @@ -418,6 +421,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 @@ -467,6 +472,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, @@ -905,9 +912,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; @@ -923,13 +932,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; @@ -945,7 +955,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 @@ -1405,8 +1415,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); @@ -1430,14 +1440,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); @@ -1464,7 +1474,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, @@ -1715,8 +1725,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, |