mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
Cache test.
git-svn-id: file:///svn/unbound/trunk@197 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
0280e3446a
commit
157defb03f
3 changed files with 65 additions and 3 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
26 March 2007: Wouter
|
26 March 2007: Wouter
|
||||||
- config settings for slab hash message cache.
|
- config settings for slab hash message cache.
|
||||||
|
- test for cached answer.
|
||||||
|
- Fixup deleting fake answer from testbound list.
|
||||||
|
|
||||||
23 March 2007: Wouter
|
23 March 2007: Wouter
|
||||||
- review of yesterday's commits.
|
- review of yesterday's commits.
|
||||||
|
|
|
||||||
|
|
@ -280,7 +280,7 @@ static void
|
||||||
answer_check_it(struct replay_runtime* runtime)
|
answer_check_it(struct replay_runtime* runtime)
|
||||||
{
|
{
|
||||||
struct replay_answer* ans = runtime->answer_list,
|
struct replay_answer* ans = runtime->answer_list,
|
||||||
**prev = &runtime->answer_list;
|
*prev = NULL;
|
||||||
log_assert(runtime && runtime->now &&
|
log_assert(runtime && runtime->now &&
|
||||||
runtime->now->evt_type == repevt_front_reply);
|
runtime->now->evt_type == repevt_front_reply);
|
||||||
while(ans) {
|
while(ans) {
|
||||||
|
|
@ -294,12 +294,16 @@ answer_check_it(struct replay_runtime* runtime)
|
||||||
log_info("testbound: do STEP %d %s",
|
log_info("testbound: do STEP %d %s",
|
||||||
runtime->now->time_step,
|
runtime->now->time_step,
|
||||||
repevt_string(runtime->now->evt_type));
|
repevt_string(runtime->now->evt_type));
|
||||||
*prev = ans->next;
|
if(prev)
|
||||||
|
prev->next = ans->next;
|
||||||
|
else runtime->answer_list = ans->next;
|
||||||
|
if(!ans->next)
|
||||||
|
runtime->answer_last = prev;
|
||||||
delete_replay_answer(ans);
|
delete_replay_answer(ans);
|
||||||
ans = n;
|
ans = n;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
prev = &ans->next;
|
prev = ans;
|
||||||
ans = ans->next;
|
ans = ans->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
56
testdata/fwd_cached.rpl
vendored
Normal file
56
testdata/fwd_cached.rpl
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
; This is a comment.
|
||||||
|
|
||||||
|
SCENARIO_BEGIN Query receives answer from the cache
|
||||||
|
|
||||||
|
STEP 1 QUERY
|
||||||
|
ENTRY_BEGIN
|
||||||
|
SECTION QUESTION
|
||||||
|
www.example.com. IN A
|
||||||
|
ENTRY_END
|
||||||
|
; the query is sent to the forwarder - no cache yet.
|
||||||
|
STEP 2 CHECK_OUT_QUERY
|
||||||
|
ENTRY_BEGIN
|
||||||
|
MATCH qname qtype opcode
|
||||||
|
SECTION QUESTION
|
||||||
|
www.example.com. IN A
|
||||||
|
ENTRY_END
|
||||||
|
STEP 3 REPLY
|
||||||
|
ENTRY_BEGIN
|
||||||
|
MATCH opcode qtype qname
|
||||||
|
ADJUST copy_id
|
||||||
|
REPLY QR RD RA NOERROR
|
||||||
|
SECTION QUESTION
|
||||||
|
www.example.com. IN A
|
||||||
|
SECTION ANSWER
|
||||||
|
www.example.com. IN A 10.20.30.40
|
||||||
|
SECTION AUTHORITY
|
||||||
|
www.example.com. IN NS ns.example.com.
|
||||||
|
SECTION ADDITIONAL
|
||||||
|
ns.example.com. IN A 10.20.30.50
|
||||||
|
ENTRY_END
|
||||||
|
STEP 4 CHECK_ANSWER
|
||||||
|
ENTRY_BEGIN
|
||||||
|
MATCH opcode qname qtype
|
||||||
|
SECTION QUESTION
|
||||||
|
www.example.com. IN A
|
||||||
|
SECTION ANSWER
|
||||||
|
www.example.com. IN A 10.20.30.40
|
||||||
|
ENTRY_END
|
||||||
|
|
||||||
|
; another query, same, so it must be answered frm the cache
|
||||||
|
STEP 5 QUERY
|
||||||
|
ENTRY_BEGIN
|
||||||
|
SECTION QUESTION
|
||||||
|
www.example.com. IN A
|
||||||
|
ENTRY_END
|
||||||
|
; immediate answer without an OUT_QUERY happening (checked on exit)
|
||||||
|
STEP 6 CHECK_ANSWER
|
||||||
|
ENTRY_BEGIN
|
||||||
|
MATCH opcode qname qtype
|
||||||
|
SECTION QUESTION
|
||||||
|
www.example.com. IN A
|
||||||
|
SECTION ANSWER
|
||||||
|
www.example.com. IN A 10.20.30.40
|
||||||
|
ENTRY_END
|
||||||
|
|
||||||
|
SCENARIO_END
|
||||||
Loading…
Reference in a new issue