diff options
author | George Kadianakis <desnacked@riseup.net> | 2021-07-01 17:42:34 +0300 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2021-07-01 18:15:55 +0300 |
commit | 314a6b42c59c7d9ea240b758ccffd796963efd0f (patch) | |
tree | 0fefab4b7fabf6ec93ae6772e95265caa5ee1e53 /src/test/test_entrynodes.c | |
parent | e71db3a4be1cab933f721d63d4ed98f50dddd7c0 (diff) | |
download | tor-314a6b42c59c7d9ea240b758ccffd796963efd0f.tar.gz tor-314a6b42c59c7d9ea240b758ccffd796963efd0f.zip |
Introduce vanguards-lite subsystem and some of its entry points
Co-authored-by: Mike Perry <mikeperry-git@torproject.org>
Diffstat (limited to 'src/test/test_entrynodes.c')
-rw-r--r-- | src/test/test_entrynodes.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c index c94b5d6a23..785ce296d3 100644 --- a/src/test/test_entrynodes.c +++ b/src/test/test_entrynodes.c @@ -92,6 +92,12 @@ bfn_mock_node_get_by_id(const char *id) return NULL; } +static int +mock_router_have_minimum_dir_info(void) +{ + return 1; +} + /* Helper function to free a test node. */ static void test_node_free(node_t *n) @@ -3087,6 +3093,23 @@ test_entry_guard_vanguard_path_selection(void *arg) circuit_free_(circ); } +static void +test_entry_guard_layer2_guards(void *arg) +{ + (void) arg; + MOCK(router_have_minimum_dir_info, mock_router_have_minimum_dir_info); + + /* Create the guardset */ + maintain_layer2_guards(); + + routerset_t *l2_guards = get_layer2_guards(); + tt_assert(l2_guards); + tt_int_op(routerset_len(l2_guards), OP_EQ, 4); + + done: + UNMOCK(router_have_minimum_dir_info); +} + static const struct testcase_setup_t big_fake_network = { big_fake_network_setup, big_fake_network_cleanup }; @@ -3152,6 +3175,8 @@ struct testcase_t entrynodes_tests[] = { BFN_TEST(manage_primary), BFN_TEST(correct_cascading_order), + BFN_TEST(layer2_guards), + EN_TEST_FORK(guard_preferred), BFN_TEST(select_for_circuit_no_confirmed), |