diff options
author | Alexander Færøy <ahf@torproject.org> | 2021-04-12 18:36:05 +0000 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2021-04-13 15:11:03 -0400 |
commit | 705ea32c6e832ab2f063dc9802a03f53e4371b9a (patch) | |
tree | f5d16b823e6790c194118f496fc661608f82d238 /src/test/test_stats.c | |
parent | 1b48a28a7476d8c29cb505ad53daa3c4fe275500 (diff) | |
download | tor-705ea32c6e832ab2f063dc9802a03f53e4371b9a.tar.gz tor-705ea32c6e832ab2f063dc9802a03f53e4371b9a.zip |
relay: Move "overload-general" from extra-info to server descriptor.
Fixes #40364
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/test/test_stats.c')
-rw-r--r-- | src/test/test_stats.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/src/test/test_stats.c b/src/test/test_stats.c index 465256a1e1..081ae22cd5 100644 --- a/src/test/test_stats.c +++ b/src/test/test_stats.c @@ -727,7 +727,7 @@ test_overload_stats(void *arg) update_approx_time(current_time); /* Now check the string */ - stats_str = rep_hist_get_overload_stats_lines(); + stats_str = rep_hist_get_overload_general_line(); tt_str_op("overload-general 1 2002-01-03 23:00:00\n", OP_EQ, stats_str); tor_free(stats_str); @@ -735,7 +735,7 @@ test_overload_stats(void *arg) current_time += 3600*72; update_approx_time(current_time); - stats_str = rep_hist_get_overload_stats_lines(); + stats_str = rep_hist_get_overload_general_line(); tt_assert(!stats_str); /* Now the time should be 2002-01-07 00:00:00 */ @@ -743,16 +743,19 @@ test_overload_stats(void *arg) /* Note a DNS overload */ rep_hist_note_overload(OVERLOAD_GENERAL); - stats_str = rep_hist_get_overload_stats_lines(); + stats_str = rep_hist_get_overload_general_line(); tt_str_op("overload-general 1 2002-01-07 00:00:00\n", OP_EQ, stats_str); tor_free(stats_str); /* Also note an fd exhaustion event */ rep_hist_note_overload(OVERLOAD_FD_EXHAUSTED); + stats_str = rep_hist_get_overload_general_line(); + tt_str_op("overload-general 1 2002-01-07 00:00:00\n", OP_EQ, stats_str); + tor_free(stats_str); + stats_str = rep_hist_get_overload_stats_lines(); - tt_str_op("overload-general 1 2002-01-07 00:00:00\n" - "overload-fd-exhausted 1 2002-01-07 00:00:00\n", OP_EQ, stats_str); + tt_str_op("overload-fd-exhausted 1 2002-01-07 00:00:00\n", OP_EQ, stats_str); tor_free(stats_str); /* Move the time forward. Register DNS overload. See that the time changed */ @@ -761,9 +764,12 @@ test_overload_stats(void *arg) rep_hist_note_overload(OVERLOAD_GENERAL); + stats_str = rep_hist_get_overload_general_line(); + tt_str_op("overload-general 1 2002-01-07 02:00:00\n", OP_EQ, stats_str); + tor_free(stats_str); + stats_str = rep_hist_get_overload_stats_lines(); - tt_str_op("overload-general 1 2002-01-07 02:00:00\n" - "overload-fd-exhausted 1 2002-01-07 00:00:00\n", OP_EQ, stats_str); + tt_str_op("overload-fd-exhausted 1 2002-01-07 00:00:00\n", OP_EQ, stats_str); tor_free(stats_str); /* Move the time forward. Register a bandwidth ratelimit event. See that the @@ -777,9 +783,12 @@ test_overload_stats(void *arg) get_options_mutable()->BandwidthRate = 1000; get_options_mutable()->BandwidthBurst = 2000; + stats_str = rep_hist_get_overload_general_line(); + tt_str_op("overload-general 1 2002-01-07 02:00:00\n", OP_EQ, stats_str); + tor_free(stats_str); + stats_str = rep_hist_get_overload_stats_lines(); - tt_str_op("overload-general 1 2002-01-07 02:00:00\n" - "overload-ratelimits 1 2002-01-07 04:00:00 1000 2000 1 0\n" + tt_str_op("overload-ratelimits 1 2002-01-07 04:00:00 1000 2000 1 0\n" "overload-fd-exhausted 1 2002-01-07 00:00:00\n", OP_EQ, stats_str); tor_free(stats_str); @@ -787,16 +796,19 @@ test_overload_stats(void *arg) current_time += 3600*24; update_approx_time(current_time); + stats_str = rep_hist_get_overload_general_line(); + tt_str_op("overload-general 1 2002-01-07 02:00:00\n", OP_EQ, stats_str); + tor_free(stats_str); + stats_str = rep_hist_get_overload_stats_lines(); - tt_str_op("overload-general 1 2002-01-07 02:00:00\n" - "overload-fd-exhausted 1 2002-01-07 00:00:00\n", OP_EQ, stats_str); + tt_str_op("overload-fd-exhausted 1 2002-01-07 00:00:00\n", OP_EQ, stats_str); tor_free(stats_str); /* Move the time forward 44 hours: no fd exhausted line anymore. */ current_time += 3600*44; update_approx_time(current_time); - stats_str = rep_hist_get_overload_stats_lines(); + stats_str = rep_hist_get_overload_general_line(); tt_str_op("overload-general 1 2002-01-07 02:00:00\n", OP_EQ, stats_str); tor_free(stats_str); @@ -804,6 +816,9 @@ test_overload_stats(void *arg) current_time += 3600*2; update_approx_time(current_time); + stats_str = rep_hist_get_overload_general_line(); + tt_assert(!stats_str); + stats_str = rep_hist_get_overload_stats_lines(); tt_assert(!stats_str); |