aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_hs_service.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-07-24 11:31:54 -0400
committerDavid Goulet <dgoulet@torproject.org>2017-07-24 11:33:52 -0400
commit10331081c731cba3e45fd2ffe2649e10797e193b (patch)
treee758c31e9d6ed743141a890e4a27be14b9a3b559 /src/test/test_hs_service.c
parentec5b30ca0b1d9a6a49463670d59a2817709472f2 (diff)
downloadtor-10331081c731cba3e45fd2ffe2649e10797e193b.tar.gz
tor-10331081c731cba3e45fd2ffe2649e10797e193b.zip
test: Remove buggy unit test in test_hs_service
There isn't much of a point of this buggy test afterall to add twice the same service object but with a different key which ultinately can end up failing the test because 1/N_BUCKETS of probability that we end up to put the service in the same bucket. Fixes #23023 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/test/test_hs_service.c')
-rw-r--r--src/test/test_hs_service.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c
index 24fca08a14..4a7cb81140 100644
--- a/src/test/test_hs_service.c
+++ b/src/test/test_hs_service.c
@@ -488,6 +488,7 @@ test_access_service(void *arg)
char *conf = NULL;
char *hsdir_v3 = tor_strdup(get_fname("hs3"));
hs_service_ht *global_map;
+ hs_service_t *s = NULL;
(void) arg;
@@ -513,7 +514,7 @@ test_access_service(void *arg)
* in the global map. */
hs_service_load_all_keys();
tt_int_op(get_hs_service_map_size(), OP_EQ, 1);
- hs_service_t *s = get_first_service();
+ s = get_first_service();
tt_assert(s);
global_map = get_hs_service_map();
tt_assert(global_map);
@@ -535,14 +536,9 @@ test_access_service(void *arg)
/* Twice should fail. */
ret = register_service(global_map, s);
tt_int_op(ret, OP_EQ, -1);
- /* Modify key of service and we should be able to put it back in. */
- s->keys.identity_pk.pubkey[1] = '\x42';
- ret = register_service(global_map, s);
- tt_int_op(ret, OP_EQ, 0);
- tt_int_op(get_hs_service_map_size(), OP_EQ, 2);
/* Remove service from map so we don't double free on cleanup. */
remove_service(global_map, s);
- tt_int_op(get_hs_service_map_size(), OP_EQ, 1);
+ tt_int_op(get_hs_service_map_size(), OP_EQ, 0);
query = find_service(global_map, &s->keys.identity_pk);
tt_assert(!query);
/* Let's try to remove twice for fun. */
@@ -552,6 +548,7 @@ test_access_service(void *arg)
teardown_capture_of_logs();
done:
+ hs_service_free(s);
tor_free(hsdir_v3);
hs_free_all();
}