1; config options
2server:
3	module-config: "validator iterator"
4	qname-minimisation: "no"
5	minimal-responses: no
6	serve-expired: yes
7	serve-expired-ttl: 10
8
9stub-zone:
10	name: "example.com"
11	stub-addr: 1.2.3.4
12CONFIG_END
13
14SCENARIO_BEGIN Test serve-expired
15; Scenario overview:
16; - query for example.com. IN A
17; - check that we get an answer for example.com. IN A with the correct TTL
18; - query again right after the TTL expired + serve-expired-ttl
19; - check that we get an updated answer and not the cached one
20
21; ns.example.com.
22RANGE_BEGIN 0 100
23	ADDRESS 1.2.3.4
24	ENTRY_BEGIN
25		MATCH opcode qtype qname
26		ADJUST copy_id
27		REPLY QR NOERROR
28		SECTION QUESTION
29			example.com. IN NS
30		SECTION ANSWER
31			example.com. IN NS ns.example.com.
32		SECTION ADDITIONAL
33			ns.example.com. IN A 1.2.3.4
34	ENTRY_END
35
36	ENTRY_BEGIN
37		MATCH opcode qtype qname
38		ADJUST copy_id
39		REPLY QR NOERROR
40		SECTION QUESTION
41			example.com. IN A
42		SECTION ANSWER
43			example.com. IN A 5.6.7.8
44		SECTION AUTHORITY
45			example.com. IN NS ns.example.com.
46		SECTION ADDITIONAL
47			ns.example.com. IN A 1.2.3.4
48	ENTRY_END
49RANGE_END
50
51; Query with RD flag
52STEP 1 QUERY
53ENTRY_BEGIN
54	REPLY RD
55	SECTION QUESTION
56		example.com. IN A
57ENTRY_END
58
59; Check that we got the correct answer (should be cached)
60STEP 10 CHECK_ANSWER
61ENTRY_BEGIN
62	MATCH all ttl
63	REPLY QR RD RA NOERROR
64	SECTION QUESTION
65		example.com. IN A
66	SECTION ANSWER
67		example.com. IN A 5.6.7.8
68	SECTION AUTHORITY
69		example.com. IN NS ns.example.com.
70	SECTION ADDITIONAL
71		ns.example.com. IN A 1.2.3.4
72ENTRY_END
73
74; Wait for the TTL to expire + serve-expired-ttl
75STEP 11 TIME_PASSES ELAPSE 3611
76
77; Query again
78STEP 30 QUERY
79ENTRY_BEGIN
80	REPLY RD
81	SECTION QUESTION
82		example.com. IN A
83ENTRY_END
84
85; Check that we got an updated answer
86STEP 40 CHECK_ANSWER
87ENTRY_BEGIN
88	MATCH all ttl
89	REPLY QR RD RA NOERROR
90	SECTION QUESTION
91		example.com. IN A
92	SECTION ANSWER
93		example.com.  IN A 5.6.7.8
94	SECTION AUTHORITY
95		example.com. IN NS ns.example.com.
96	SECTION ADDITIONAL
97		ns.example.com. IN A 1.2.3.4
98ENTRY_END
99
100SCENARIO_END
101