aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_conscache.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-04-11 15:50:06 -0400
committerNick Mathewson <nickm@torproject.org>2017-04-15 11:21:32 -0400
commit06ecb9432f4596f10e73f82bb1ff6677060756f9 (patch)
treeac9f568f9fc3d9082dfee524c68baf14a4be2cb3 /src/test/test_conscache.c
parentb081a7ed21ae729f6e195715e130edaca3e0b7fe (diff)
downloadtor-06ecb9432f4596f10e73f82bb1ff6677060756f9.tar.gz
tor-06ecb9432f4596f10e73f82bb1ff6677060756f9.zip
conscache.c: do not match entries that are slated for removal.
Diffstat (limited to 'src/test/test_conscache.c')
-rw-r--r--src/test/test_conscache.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/test/test_conscache.c b/src/test/test_conscache.c
index 12184f0cc6..c316411a79 100644
--- a/src/test/test_conscache.c
+++ b/src/test/test_conscache.c
@@ -200,8 +200,7 @@ test_conscache_cleanup(void *arg)
tt_assert(e_tmp);
tt_assert(consensus_cache_entry_is_mapped(e_tmp));
e_tmp = consensus_cache_find_first(cache, "index", "7");
- tt_assert(e_tmp);
- tt_assert(consensus_cache_entry_is_mapped(e_tmp));
+ tt_assert(e_tmp == NULL); // not found because pending deletion.
/* Delete the pending-deletion items. */
consensus_cache_delete_pending(cache);
@@ -210,12 +209,12 @@ test_conscache_cleanup(void *arg)
consensus_cache_find_all(entries, cache, NULL, NULL);
int n = smartlist_len(entries);
smartlist_free(entries);
- tt_int_op(n, OP_EQ, 20 - 1); /* 1 entry was deleted */
+ tt_int_op(n, OP_EQ, 20 - 2); /* 1 entry was deleted; 1 is not-found. */
}
e_tmp = consensus_cache_find_first(cache, "index", "7"); // refcnt == 1...
tt_assert(e_tmp == NULL); // so deleted.
e_tmp = consensus_cache_find_first(cache, "index", "14"); // refcnt == 2
- tt_assert(e_tmp); // so, not deleted.
+ tt_assert(e_tmp == NULL); // not deleted; but not found.
/* Now do lazy unmapping. */
// should do nothing.