Merge branch 'ticket25997'

This commit is contained in:
Nick Mathewson 2018-05-02 16:03:57 -04:00
commit eb00eff09d
2 changed files with 10 additions and 8 deletions

5
changes/ticket25997 Normal file
View File

@ -0,0 +1,5 @@
o Minor bugfixes (testing, coverage):
- Remove randomness from the hs_common/responsible_hsdirs test,
so that it always takes the same path through the function it tests.
Fixes bug 25997; bugfix on 0.3.2.1-alpha.

View File

@ -360,11 +360,8 @@ mock_networkstatus_get_live_consensus(time_t now)
static void static void
test_responsible_hsdirs(void *arg) test_responsible_hsdirs(void *arg)
{ {
time_t now = approx_time();
smartlist_t *responsible_dirs = smartlist_new(); smartlist_t *responsible_dirs = smartlist_new();
networkstatus_t *ns = NULL; networkstatus_t *ns = NULL;
int retval;
(void) arg; (void) arg;
hs_init(); hs_init();
@ -386,12 +383,12 @@ test_responsible_hsdirs(void *arg)
helper_add_hsdir_to_networkstatus(ns, 3, "spyro", 0); helper_add_hsdir_to_networkstatus(ns, 3, "spyro", 0);
} }
ed25519_keypair_t kp; /* Use a fixed time period and pub key so we always take the same path */
retval = ed25519_keypair_generate(&kp, 0); ed25519_public_key_t pubkey;
tt_int_op(retval, OP_EQ , 0); uint64_t time_period_num = 17653; // 2 May, 2018, 14:00.
memset(&pubkey, 42, sizeof(pubkey));
uint64_t time_period_num = hs_get_time_period_num(now); hs_get_responsible_hsdirs(&pubkey, time_period_num,
hs_get_responsible_hsdirs(&kp.pubkey, time_period_num,
0, 0, responsible_dirs); 0, 0, responsible_dirs);
/* Make sure that we only found 2 responsible HSDirs. /* Make sure that we only found 2 responsible HSDirs.