[tor-commits] [tor/main] hs: Fix tests for congestion control

dgoulet at torproject.org dgoulet at torproject.org
Tue Feb 22 20:48:20 UTC 2022


commit 27d948dab8f579890abdef155d20062938b84259
Author: David Goulet <dgoulet at torproject.org>
Date:   Thu Feb 3 12:11:42 2022 +0000

    hs: Fix tests for congestion control
---
 src/test/test_hs_client.c     |  4 ++++
 src/test/test_hs_descriptor.c |  5 +++++
 src/test/test_protover.c      | 17 -----------------
 3 files changed, 9 insertions(+), 17 deletions(-)

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");





More information about the tor-commits mailing list