Commit 14be4fb9 authored by Grigorii Demidov's avatar Grigorii Demidov

bugfix: rcode was never compared;policy module test was added (deny)

parent c636142e
......@@ -227,9 +227,9 @@ def setup_env(scenario, child_env, config, config_name_list, j2template_list):
elif k == 'stub-addr':
stub_addr = v.strip('"\'')
elif k == 'features':
featurelist = v.split(feature_list_delimiter)
feature_list = v.split(feature_list_delimiter)
try :
for f_item in featurelist:
for f_item in feature_list:
if f_item.find(feature_pair_delimiter) != -1:
f_key, f_value = [x.strip() for x in f_item.split(feature_pair_delimiter,1)]
else:
......@@ -237,7 +237,15 @@ def setup_env(scenario, child_env, config, config_name_list, j2template_list):
f_value = ""
features[f_key] = f_value
except Exception as e:
raise Exception ("can't parse features list in config section (%s)" % str(e));
raise Exception ("can't parse features (%s) in config section (%s)" % (v,str(e)));
elif k == 'feature-list':
try :
f_key, f_value = [x.strip() for x in v.split(feature_pair_delimiter,1)]
if f_key not in features:
features[f_key] = []
features[f_key].append(f_value)
except Exception as e:
raise Exception ("can't parse feature-list (%s) in config section (%s)" % (v,str(e)));
elif k == 'force-ipv6' and v.upper() == 'TRUE':
scenario.force_ipv6 = True
......
......@@ -55,6 +55,8 @@ class Entry:
return self.__compare_sub(expected.question[0].name, qname)
elif code == 'flags':
return self.__compare_val(dns.flags.to_text(expected.flags), dns.flags.to_text(msg.flags))
elif code == 'rcode':
return self.__compare_val(dns.rcode.to_text(expected.rcode()), dns.rcode.to_text(msg.rcode()))
elif code == 'question':
return self.__compare_rrs(expected.question, msg.question)
elif code == 'answer':
......@@ -70,7 +72,7 @@ class Entry:
""" Compare scripted reply to given message based on match criteria. """
match_fields = self.match_fields
if 'all' in match_fields:
match_fields = tuple(['flags'] + self.sections)
match_fields = tuple(['flags'] + ['rcode'] + self.sections)
for code in match_fields:
try:
res = self.match_part(code, msg)
......
; config options
stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
feature-list: policy=policy:add(policy.suffix(policy.DENY, {todname('example.cz')}))
CONFIG_END
SCENARIO_BEGIN Simple static hint test
STEP 10 QUERY
ENTRY_BEGIN
REPLY RD
SECTION QUESTION
www.example.cz. IN A
ENTRY_END
STEP 20 CHECK_ANSWER
ENTRY_BEGIN
MATCH all
REPLY QR RD RA NXDOMAIN
SECTION QUESTION
www.example.cz. IN A
SECTION ANSWER
ENTRY_END
SCENARIO_END
......@@ -24,6 +24,10 @@ renumber.config({{ '{{' }}'{{FEATURES.renumber_src}}','{{FEATURES.renumber_dst}}
{% endif %}
{% endif %}
{% for policy in FEATURES.policy %}
{{policy}}
{% endfor %}
verbose(true)
-- Self-checks on globals
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment