Fix unit test failure introduced by #20002

Updating the consensus algorithm made a non-valid node never get
listed, which messed up some other tests.
This commit is contained in:
Nick Mathewson 2016-09-07 13:40:38 -04:00
parent a49fee1c29
commit 075c52084d
2 changed files with 4 additions and 3 deletions

View File

@ -1714,8 +1714,8 @@ test_vrs_for_v3ns(vote_routerstatus_t *vrs, int voter, time_t now)
tt_int_op(rs->addr,OP_EQ, 0x99008801);
tt_int_op(rs->or_port,OP_EQ, 443);
tt_int_op(rs->dir_port,OP_EQ, 8000);
/* no flags except "running" (16) and "v2dir" (64) */
tt_u64_op(vrs->flags, OP_EQ, U64_LITERAL(80));
/* no flags except "running" (16) and "v2dir" (64) and "valid" (128) */
tt_u64_op(vrs->flags, OP_EQ, U64_LITERAL(0xd0));
} else if (tor_memeq(rs->identity_digest,
"\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5"
"\x5\x5\x5\x5",
@ -1812,7 +1812,7 @@ test_routerstatus_for_v3ns(routerstatus_t *rs, time_t now)
tt_assert(!rs->is_stable);
/* (If it wasn't running it wouldn't be here) */
tt_assert(rs->is_flagged_running);
tt_assert(!rs->is_valid);
tt_assert(rs->is_valid);
tt_assert(!rs->is_named);
tt_assert(rs->is_v2_dir);
/* XXXX check version */

View File

@ -89,6 +89,7 @@ dir_common_gen_routerstatus_for_v3ns(int idx, time_t now)
/* all flags but running and v2dir cleared */
rs->is_flagged_running = 1;
rs->is_v2_dir = 1;
rs->is_valid = 1; /* xxxxx */
break;
case 1:
/* Generate the second routerstatus. */