|
@@ -2679,6 +2679,23 @@ test_enty_guard_should_expire_waiting(void *arg)
|
|
tor_free(fake_state);
|
|
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
|
|
static void
|
|
mock_directory_initiate_request(directory_request_t *req)
|
|
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 },
|
|
test_entry_guard_parse_from_state_broken, TT_FORK, NULL, NULL },
|
|
{ "get_guard_selection_by_name",
|
|
{ "get_guard_selection_by_name",
|
|
test_entry_guard_get_guard_selection_by_name, TT_FORK, NULL, NULL },
|
|
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(choose_selection_initial),
|
|
BFN_TEST(add_single_guard),
|
|
BFN_TEST(add_single_guard),
|
|
BFN_TEST(node_filter),
|
|
BFN_TEST(node_filter),
|