From: David Goulet Date: Thu, 3 Feb 2022 12:11:42 +0000 (+0000) Subject: hs: Fix tests for congestion control X-Git-Tag: tor-0.4.7.4-alpha~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27d948dab8f579890abdef155d20062938b84259;p=thirdparty%2Ftor.git hs: Fix tests for congestion control --- diff --git a/src/test/test_hs_client.c b/src/test/test_hs_client.c index 0fe71ed7bd..11a5589d21 100644 --- a/src/test/test_hs_client.c +++ b/src/test/test_hs_client.c @@ -54,6 +54,9 @@ #include "core/or/origin_circuit_st.h" #include "core/or/socks_request_st.h" +#define TOR_CONGESTION_CONTROL_PRIVATE +#include "core/or/congestion_control_common.h" + static int mock_connection_ap_handshake_send_begin(entry_connection_t *ap_conn) { @@ -771,6 +774,7 @@ test_desc_has_arrived_cleanup(void *arg) (void) arg; hs_init(); + congestion_control_set_cc_enabled(); MOCK(networkstatus_get_reasonably_live_consensus, mock_networkstatus_get_reasonably_live_consensus); diff --git a/src/test/test_hs_descriptor.c b/src/test/test_hs_descriptor.c index ec6c8ba6b4..ecb7da2450 100644 --- a/src/test/test_hs_descriptor.c +++ b/src/test/test_hs_descriptor.c @@ -24,6 +24,9 @@ #include "test/log_test_helpers.h" #include "test/rng_test_helpers.h" +#define TOR_CONGESTION_CONTROL_PRIVATE +#include "core/or/congestion_control_common.h" + #ifdef HAVE_CFLAG_WOVERLENGTH_STRINGS DISABLE_GCC_WARNING("-Woverlength-strings") /* We allow huge string constants in the unit tests, but not in the code @@ -247,6 +250,8 @@ test_decode_descriptor(void *arg) (void) arg; + congestion_control_set_cc_enabled(); + ret = ed25519_keypair_generate(&signing_kp, 0); tt_int_op(ret, OP_EQ, 0); desc = hs_helper_build_hs_desc_with_ip(&signing_kp); diff --git a/src/test/test_protover.c b/src/test/test_protover.c index 7ad02cb9c1..9d14fd678a 100644 --- a/src/test/test_protover.c +++ b/src/test/test_protover.c @@ -355,7 +355,6 @@ test_protover_supports_version(void *arg) #define PROTOVER_PADDING_V1 1 #define PROTOVER_FLOWCTRL_V1 1 -#define PROTOVER_FLOWCTRL_V2 2 #define PROTOVER_RELAY_NTOR_V3 4 @@ -704,22 +703,6 @@ test_protover_summarize_flags(void *args) /* Now check version exceptions */ - /* Congestion control. */ - memset(&flags, 0, sizeof(flags)); - summarize_protover_flags(&flags, - PROTOVER("FlowCtrl", PROTOVER_FLOWCTRL_V2), - NULL); - summarize_protover_flags(&flags, - PROTOVER("Relay", PROTOVER_RELAY_NTOR_V3), - NULL); - DEBUG_PROTOVER(flags); - tt_int_op(flags.protocols_known, OP_EQ, 1); - tt_int_op(flags.supports_congestion_control, OP_EQ, 1); - /* Now clear those flags, and check the rest are zero */ - flags.protocols_known = 0; - flags.supports_congestion_control = 0; - tt_mem_op(&flags, OP_EQ, &zero_flags, sizeof(flags)); - /* EXTEND2 cell support */ memset(&flags, 0, sizeof(flags)); summarize_protover_flags(&flags, NULL, "Tor 0.2.4.8-alpha");