summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-11-12 09:43:09 -0500
committerNick Mathewson <nickm@torproject.org>2020-11-12 09:43:09 -0500
commite2d3c9c5f82a1369385dd99765c31ba479ba8f23 (patch)
tree90e51daffd4bad4b85e0f1de33853951fbb015f6
parentb79694ca18d92e8ffb9893cb95575cfa9a049e95 (diff)
parentf2168d28f7aa981c0ecdb9823ae18f11b578f57f (diff)
downloadtor-e2d3c9c5f82a1369385dd99765c31ba479ba8f23.tar.gz
tor-e2d3c9c5f82a1369385dd99765c31ba479ba8f23.zip
Merge branch 'ticket40187' into master
-rw-r--r--changes/bug401875
-rw-r--r--src/test/test_helpers.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/changes/bug40187 b/changes/bug40187
new file mode 100644
index 0000000000..563e4b4d76
--- /dev/null
+++ b/changes/bug40187
@@ -0,0 +1,5 @@
+ o Minor bugfixes (testing):
+ - Fix unit tests that used newly generated list of routers so that they
+ check them with respect to the date when they were generated, not
+ with respect to the current time. Fixes bug 40187; bugfix on
+ 0.4.5.1-alpha.
diff --git a/src/test/test_helpers.c b/src/test/test_helpers.c
index 851946931c..20d4582e74 100644
--- a/src/test/test_helpers.c
+++ b/src/test/test_helpers.c
@@ -113,12 +113,17 @@ helper_setup_fake_routerlist(void)
MOCK(router_descriptor_is_older_than,
router_descriptor_is_older_than_replacement);
+ // Pick a time when these descriptors' certificates were valid.
+ update_approx_time(1603981036);
+
/* Load all the test descriptors to the routerlist. */
retval = router_load_routers_from_string(TEST_DESCRIPTORS,
NULL, SAVED_IN_JOURNAL,
NULL, 0, NULL);
tt_int_op(retval, OP_EQ, HELPER_NUMBER_OF_DESCRIPTORS);
+ update_approx_time(0); // this restores the regular approx_time behavior
+
/* Sanity checking of routerlist and nodelist. */
our_routerlist = router_get_routerlist();
tt_int_op(smartlist_len(our_routerlist->routers), OP_EQ,