]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
hs: Fix tests for congestion control
authorDavid Goulet <dgoulet@torproject.org>
Thu, 3 Feb 2022 12:11:42 +0000 (12:11 +0000)
committerMike Perry <mikeperry-git@torproject.org>
Tue, 22 Feb 2022 19:28:35 +0000 (19:28 +0000)
src/test/test_hs_client.c
src/test/test_hs_descriptor.c
src/test/test_protover.c

index 0fe71ed7bd40afeb79ee34daa1df0501031ec5d1..11a5589d2189edfee26ee0f720722d780b14a0e0 100644 (file)
@@ -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);
index ec6c8ba6b4e54c6771429f6714fd1ae763ebc2da..ecb7da2450d56fa4016a51f35855683fbd36323a 100644 (file)
@@ -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);
index 7ad02cb9c15e30ef3847e9e0f1c1917d3d0b72cd..9d14fd678a3e622d0ff7bbcdda113aee410d7140 100644 (file)
@@ -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");