Commit 38599de2 authored by David Goulet's avatar David Goulet 🔆 Committed by Nick Mathewson
Browse files

test: Update approx_time before the test starts



This way we have the same time source when the IP is created and tested later.

Fixes #27810
Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
parent 633e9957
o Minor bugfixes (test, hidden service v3):
- Make the the hs_service tests uses the same time source when creating
the introduction point and testing it. This helps make test work on very
slow system like ARM or Travis. Fixes bug 27810; bugfix on
0.3.2.1-alpha.
...@@ -492,6 +492,8 @@ test_helper_functions(void *arg) ...@@ -492,6 +492,8 @@ test_helper_functions(void *arg)
MOCK(node_get_by_id, mock_node_get_by_id); MOCK(node_get_by_id, mock_node_get_by_id);
hs_service_init(); hs_service_init();
time_t now = time(NULL);
update_approx_time(now);
service = helper_create_service(); service = helper_create_service();
...@@ -551,7 +553,6 @@ test_helper_functions(void *arg) ...@@ -551,7 +553,6 @@ test_helper_functions(void *arg)
/* Testing can_service_launch_intro_circuit() */ /* Testing can_service_launch_intro_circuit() */
{ {
time_t now = time(NULL);
/* Put the start of the retry period back in time, we should be allowed. /* Put the start of the retry period back in time, we should be allowed.
* to launch intro circuit. */ * to launch intro circuit. */
service->state.num_intro_circ_launched = 2; service->state.num_intro_circ_launched = 2;
...@@ -575,7 +576,6 @@ test_helper_functions(void *arg) ...@@ -575,7 +576,6 @@ test_helper_functions(void *arg)
/* Testing intro_point_should_expire(). */ /* Testing intro_point_should_expire(). */
{ {
time_t now = time(NULL);
/* Just some basic test of the current state. */ /* Just some basic test of the current state. */
tt_u64_op(ip->introduce2_max, OP_GE, tt_u64_op(ip->introduce2_max, OP_GE,
INTRO_POINT_MIN_LIFETIME_INTRODUCTIONS); INTRO_POINT_MIN_LIFETIME_INTRODUCTIONS);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment