diff options
author | George Kadianakis <desnacked@riseup.net> | 2017-08-13 20:16:21 +0300 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2017-08-19 16:28:47 +0300 |
commit | 1f7b8012ae9b6226e5853751685c98782a48c0c4 (patch) | |
tree | e71f5c0bcaaa7162060c49a6ea726ce6b3ed566a /src/test/test_hs_service.c | |
parent | 43343ec019e24cb3b1d5802d1369ab75ec0e8776 (diff) | |
download | tor-1f7b8012ae9b6226e5853751685c98782a48c0c4.tar.gz tor-1f7b8012ae9b6226e5853751685c98782a48c0c4.zip |
prop224: Only upload descriptor if we have good hash ring and SRV.
Make sure we have a live consensus (for SRV) and enough descriptors (for
hash ring).
Also fix unittests that broke.
Diffstat (limited to 'src/test/test_hs_service.c')
-rw-r--r-- | src/test/test_hs_service.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c index c0dd9fe251..7263e04579 100644 --- a/src/test/test_hs_service.c +++ b/src/test/test_hs_service.c @@ -1177,6 +1177,12 @@ test_build_update_descriptors(void *arg) UNMOCK(hs_overlap_mode_is_active); } +static int +mock_router_have_minimum_dir_info(void) +{ + return 1; +} + static void test_upload_descriptors(void *arg) { @@ -1191,7 +1197,6 @@ test_upload_descriptors(void *arg) MOCK(hs_overlap_mode_is_active, mock_hs_overlap_mode_is_active_true); MOCK(get_or_state, get_or_state_replacement); - dummy_state = tor_malloc_zero(sizeof(or_state_t)); /* Create a service with no descriptor. It's added to the global map. */ @@ -1229,9 +1234,13 @@ test_upload_descriptors(void *arg) ip->circuit_established = 1; service_intro_point_add(service->desc_current->intro_points.map, ip); + MOCK(networkstatus_get_live_consensus, + mock_networkstatus_get_live_consensus); + MOCK(router_have_minimum_dir_info, + mock_router_have_minimum_dir_info); + setup_full_capture_of_logs(LOG_WARN); run_upload_descriptor_event(now); - expect_log_msg_containing("No valid consensus so we can't get the"); teardown_capture_of_logs(); tt_u64_op(service->desc_current->next_upload_time, OP_GE, now + HS_SERVICE_NEXT_UPLOAD_TIME_MIN); |