From fec4a4efba7d79a0b0cd9fb32d0a354af95d36c8 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Tue, 13 Feb 2007 15:58:39 +0000 Subject: [PATCH] Extra replay tests: error and two messages at a time (first is answered, second is not). git-svn-id: file:///svn/unbound/trunk@93 be551aaa-1e26-0410-a405-d3ace91eadb9 --- testcode/fake_event.c | 11 +++---- testdata/fwd_error.rpl | 18 +++++++++++ testdata/fwd_two.rpl | 69 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 6 deletions(-) create mode 100644 testdata/fwd_error.rpl create mode 100644 testdata/fwd_two.rpl diff --git a/testcode/fake_event.c b/testcode/fake_event.c index 5ede5bce6..957944f3d 100644 --- a/testcode/fake_event.c +++ b/testcode/fake_event.c @@ -665,12 +665,11 @@ pending_udp_query(struct outside_network* outnet, ldns_buffer* packet, log_info("testbound: do STEP %d %s", runtime->now->time_step, repevt_string(runtime->now->evt_type)); advance_moment(runtime); - } else { - log_info("testbound: created fake pending"); - /* add to list */ - pend->next = runtime->pending_list; - runtime->pending_list = pend; - } + } + log_info("testbound: created fake pending"); + /* add to list */ + pend->next = runtime->pending_list; + runtime->pending_list = pend; } /*********** End of Dummy routines ***********/ diff --git a/testdata/fwd_error.rpl b/testdata/fwd_error.rpl new file mode 100644 index 000000000..753419e23 --- /dev/null +++ b/testdata/fwd_error.rpl @@ -0,0 +1,18 @@ +SCENARIO_BEGIN Forwarder and a timeout happens on server query. +STEP 1 QUERY +ENTRY_BEGIN +SECTION QUESTION +www.example.com. IN A +ENTRY_END +; But the pending query fails due to error (say TCP failure or malloc or ...) +STEP 2 ERROR +; returns servfail +STEP 4 CHECK_ANSWER +ENTRY_BEGIN +MATCH opcode qname qtype +SECTION QUESTION +REPLY SERVFAIL QR +MATCH all +www.example.com. IN A +ENTRY_END +SCENARIO_END diff --git a/testdata/fwd_two.rpl b/testdata/fwd_two.rpl new file mode 100644 index 000000000..29223fccf --- /dev/null +++ b/testdata/fwd_two.rpl @@ -0,0 +1,69 @@ +SCENARIO_BEGIN Sample of a valid query + +; query responses from authority servers. +RANGE_BEGIN 0 100 +ENTRY_BEGIN + MATCH opcode qtype qname + ADJUST copy_id + SECTION QUESTION +www.example.net. IN A + SECTION ANSWER +www.example.net. IN A 10.20.30.40 + SECTION AUTHORITY +www.example.net. IN NS ns.example.net. + SECTION ADDITIONAL +ns.example.net. IN A 10.20.30.50 +ENTRY_END +RANGE_END + +STEP 1 QUERY +ENTRY_BEGIN +SECTION QUESTION +www.example.com. IN A +ENTRY_END + +STEP 2 CHECK_OUT_QUERY +ENTRY_BEGIN +MATCH qname qtype opcode +SECTION QUESTION +www.example.com. IN A +ENTRY_END + +; NO REPLY (this step is not needed) +STEP 3 NOTHING + +; another query +STEP 4 QUERY +ENTRY_BEGIN +SECTION QUESTION +www.example.net. IN A +ENTRY_END + +; reply from first query returns +STEP 5 REPLY +ENTRY_BEGIN + MATCH opcode qtype qname + ADJUST copy_id + 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 10 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 + +; testbound checks before exit: +; * no more pending queries outstanding. +; * and no answers that have not been checked. -- 2.47.2