[tor-commits] [tor/master] Fix another 20499-broken test
nickm at torproject.org
nickm at torproject.org
Mon Nov 7 21:11:07 UTC 2016
commit e482541cfb0bd85cab8a7fed86e31e0b18912730
Author: Nick Mathewson <nickm at torproject.org>
Date: Mon Nov 7 16:10:42 2016 -0500
Fix another 20499-broken test
---
src/test/test_dir.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 6a39b68..cdc56ac 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -3732,14 +3732,14 @@ test_dir_download_status_increment(void *arg)
current_time + delay1 + 10,
0) == 0);
- /* Check that failure increments don't happen on 503 for clients, but that
- * attempt increments do. */
+ /* Check that failure increments do happen on 503 for clients, and
+ * attempt increments do too. */
mock_get_options_calls = 0;
next_at = download_status_increment_failure(&dls_failure, 503, "test", 0,
current_time);
- tt_assert(next_at == current_time + delay1);
- tt_assert(download_status_get_n_failures(&dls_failure) == 1);
- tt_assert(download_status_get_n_attempts(&dls_failure) == 2);
+ tt_i64_op(next_at, ==, current_time + delay2);
+ tt_int_op(download_status_get_n_failures(&dls_failure), ==, 2);
+ tt_int_op(download_status_get_n_attempts(&dls_failure), ==, 2);
tt_assert(mock_get_options_calls >= 1);
/* Check that failure increments do happen on 503 for servers */
@@ -3747,7 +3747,7 @@ test_dir_download_status_increment(void *arg)
next_at = download_status_increment_failure(&dls_failure, 503, "test", 1,
current_time);
tt_assert(next_at == current_time + delay2);
- tt_assert(download_status_get_n_failures(&dls_failure) == 2);
+ tt_assert(download_status_get_n_failures(&dls_failure) == 3);
tt_assert(download_status_get_n_attempts(&dls_failure) == 3);
tt_assert(mock_get_options_calls >= 1);
@@ -3756,7 +3756,7 @@ test_dir_download_status_increment(void *arg)
next_at = download_status_increment_failure(&dls_failure, 404, "test", 0,
current_time);
tt_assert(next_at == current_time + delay2);
- tt_assert(download_status_get_n_failures(&dls_failure) == 3);
+ tt_assert(download_status_get_n_failures(&dls_failure) == 4);
tt_assert(download_status_get_n_attempts(&dls_failure) == 4);
tt_assert(mock_get_options_calls >= 1);
@@ -3918,8 +3918,13 @@ test_dir_download_status_increment(void *arg)
/* Check that attempt increments don't happen on failure-based schedules,
* and that the attempt is set at the end of time */
mock_get_options_calls = 0;
+ setup_full_capture_of_logs(LOG_WARN);
next_at = download_status_increment_attempt(&dls_failure, "test",
current_time);
+ expect_single_log_msg_containing(
+ "Tried to launch an attempt-based connection on a failure-based "
+ "schedule.");
+ teardown_capture_of_logs();
tt_assert(next_at == TIME_MAX);
tt_assert(download_status_get_n_failures(&dls_failure) == 0);
tt_assert(download_status_get_n_attempts(&dls_failure) == 0);
@@ -3931,6 +3936,7 @@ test_dir_download_status_increment(void *arg)
UNMOCK(get_options);
mock_options = NULL;
mock_get_options_calls = 0;
+ teardown_capture_of_logs();
}
static void
More information about the tor-commits
mailing list