diff options
author | George Kadianakis <desnacked@riseup.net> | 2018-04-25 15:10:24 +0300 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-04-27 12:44:54 -0400 |
commit | d00ed406e08942d6539281eb28e875939ee214e5 (patch) | |
tree | d9691bdb12dec7f01b9c410f7c7615a9f6058632 /src/test/test_entrynodes.c | |
parent | 3bf9974b6c4ee9f2a8204c058e1b7c206b99d620 (diff) | |
download | tor-d00ed406e08942d6539281eb28e875939ee214e5.tar.gz tor-d00ed406e08942d6539281eb28e875939ee214e5.zip |
Introduce torrc option NumPrimaryGuards
Diffstat (limited to 'src/test/test_entrynodes.c')
-rw-r--r-- | src/test/test_entrynodes.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c index 92a860360d..f55e9f0173 100644 --- a/src/test/test_entrynodes.c +++ b/src/test/test_entrynodes.c @@ -2679,6 +2679,23 @@ test_enty_guard_should_expire_waiting(void *arg) tor_free(fake_state); } +/** Test that the number of primary guards can be controlled using torrc */ +static void +test_entry_guard_number_of_primaries(void *arg) +{ + (void) arg; + + /* Get default value */ + tt_int_op(get_n_primary_guards(), OP_EQ, DFLT_N_PRIMARY_GUARDS); + + /* Set number of primaries using torrc */ + get_options_mutable()->NumPrimaryGuards = 42; + tt_int_op(get_n_primary_guards(), OP_EQ, 42); + + done: + ; +} + static void mock_directory_initiate_request(directory_request_t *req) { @@ -2826,6 +2843,8 @@ struct testcase_t entrynodes_tests[] = { test_entry_guard_parse_from_state_broken, TT_FORK, NULL, NULL }, { "get_guard_selection_by_name", test_entry_guard_get_guard_selection_by_name, TT_FORK, NULL, NULL }, + { "number_of_primaries", + test_entry_guard_number_of_primaries, TT_FORK, NULL, NULL }, BFN_TEST(choose_selection_initial), BFN_TEST(add_single_guard), BFN_TEST(node_filter), |