aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_hs_service.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/test_hs_service.c')
-rw-r--r--src/test/test_hs_service.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c
index 8b94bb6cf1..66e8e2f473 100644
--- a/src/test/test_hs_service.c
+++ b/src/test/test_hs_service.c
@@ -54,6 +54,7 @@
#include "feature/hs/hs_ob.h"
#include "feature/hs/hs_cell.h"
#include "feature/hs/hs_intropoint.h"
+#include "feature/hs/hs_metrics.h"
#include "feature/hs/hs_service.h"
#include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h"
@@ -160,7 +161,7 @@ mock_router_have_minimum_dir_info_false(void)
}
/* Helper: from a set of options in conf, configure a service which will add
- * it to the staging list of the HS subsytem. */
+ * it to the staging list of the HS subsystem. */
static int
helper_config_service(const char *conf)
{
@@ -666,6 +667,7 @@ test_access_service(void *arg)
tt_mem_op(query, OP_EQ, s, sizeof(hs_service_t));
/* Remove service, check if it actually works and then put it back. */
remove_service(global_map, s);
+ hs_metrics_service_free(s);
tt_int_op(get_hs_service_map_size(), OP_EQ, 0);
query = find_service(global_map, &s->keys.identity_pk);
tt_ptr_op(query, OP_EQ, NULL);
@@ -675,6 +677,7 @@ test_access_service(void *arg)
tt_int_op(ret, OP_EQ, 0);
tt_int_op(get_hs_service_map_size(), OP_EQ, 1);
/* Twice should fail. */
+ hs_metrics_service_free(s); /* Avoid BUG() on metrics init. */
ret = register_service(global_map, s);
tt_int_op(ret, OP_EQ, -1);
/* Remove service from map so we don't double free on cleanup. */
@@ -777,7 +780,7 @@ mock_node_get_by_id(const char *digest)
{
(void) digest;
memset(mock_node.identity, 'A', DIGEST_LEN);
- /* Only return the matchin identity of As */
+ /* Only return the matching identity of As */
if (!tor_memcmp(mock_node.identity, digest, DIGEST_LEN)) {
return &mock_node;
}
@@ -1547,14 +1550,12 @@ test_build_update_descriptors(void *arg)
/* Now, we'll setup a node_t. */
{
- tor_addr_t ipv4_addr;
curve25519_secret_key_t curve25519_secret_key;
memset(&ri, 0, sizeof(routerinfo_t));
- tor_addr_parse(&ipv4_addr, "127.0.0.1");
- ri.addr = tor_addr_to_ipv4h(&ipv4_addr);
- ri.or_port = 1337;
+ tor_addr_parse(&ri.ipv4_addr, "127.0.0.1");
+ ri.ipv4_orport = 1337;
ri.purpose = ROUTER_PURPOSE_GENERAL;
/* Ugly yes but we never free the "ri" object so this just makes things
* easier. */
@@ -1621,7 +1622,7 @@ test_build_update_descriptors(void *arg)
/* We won't test the service IP object because there is a specific test
* already for this but we'll make sure that the state is coherent.*/
- /* Three link specifiers are mandatoy so make sure we do have them. */
+ /* Three link specifiers are mandatory so make sure we do have them. */
tt_int_op(smartlist_len(ip_cur->base.link_specifiers), OP_EQ, 3);
/* Make sure we have a valid encryption keypair generated when we pick an
* intro point in the update process. */