summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarsten Loesing <karsten.loesing@gmx.net>2009-05-27 23:47:59 +0200
committerNick Mathewson <nickm@torproject.org>2009-05-27 18:04:55 -0400
commitd49711e52c22e77e95c30660f78b19d4f6025d04 (patch)
tree6f26d6645faadb0c651a44ef8ea4f00116c097f3
parentec7e0546681f57a1ba1769cca2b8339f9b0dc8b0 (diff)
downloadtor-d49711e52c22e77e95c30660f78b19d4f6025d04.tar.gz
tor-d49711e52c22e77e95c30660f78b19d4f6025d04.zip
Fix unit tests that were broken after last fix of #932.
With the last fix of task 932 (5f03d6c), client requests are only added to the history when they happen after the start of the current history. This conflicts with the unit tests that insert current requests first (defining the start of the client request history) followed by requests in the past. The fix is to insert requests in chronological order in the unit tests.
-rw-r--r--src/or/test.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/or/test.c b/src/or/test.c
index 2d15f1a9e8..7b7411e2f8 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -4678,25 +4678,25 @@ test_geoip(void)
get_options()->BridgeRecordUsageByCountry = 1;
/* Put 9 observations in AB... */
for (i=32; i < 40; ++i)
- geoip_note_client_seen(GEOIP_CLIENT_CONNECT, i, now);
- geoip_note_client_seen(GEOIP_CLIENT_CONNECT, 225, now);
+ geoip_note_client_seen(GEOIP_CLIENT_CONNECT, i, now-7200);
+ geoip_note_client_seen(GEOIP_CLIENT_CONNECT, 225, now-7200);
/* and 3 observations in XY, several times. */
for (j=0; j < 10; ++j)
for (i=52; i < 55; ++i)
geoip_note_client_seen(GEOIP_CLIENT_CONNECT, i, now-3600);
/* and 17 observations in ZZ... */
for (i=110; i < 127; ++i)
- geoip_note_client_seen(GEOIP_CLIENT_CONNECT, i, now-7200);
+ geoip_note_client_seen(GEOIP_CLIENT_CONNECT, i, now);
s = geoip_get_client_history(now+5*24*60*60, GEOIP_CLIENT_CONNECT);
test_assert(s);
test_streq("zz=24,ab=16,xy=8", s);
tor_free(s);
- /* Now clear out all the zz observations. */
+ /* Now clear out all the AB observations. */
geoip_remove_old_clients(now-6000);
s = geoip_get_client_history(now+5*24*60*60, GEOIP_CLIENT_CONNECT);
test_assert(s);
- test_streq("ab=16,xy=8", s);
+ test_streq("zz=24,xy=8", s);
done:
tor_free(s);