1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
|
use strict;
use warnings;
use Test::More;
use File::Basename;
use File::Spec::Functions qw( rel2abs );
use lib dirname( rel2abs( $0 ) );
BEGIN {
use_ok( q{Zonemaster::Engine} );
use_ok( q{Zonemaster::Engine::Nameserver} );
use_ok( q{Zonemaster::Engine::Test::Consistency} );
use_ok( q{TestUtil}, qw( perform_testcase_testing ) );
}
###########
# consistency05 - https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/test-zones/Consistency-TP/consistency05.md
# (when https://github.com/zonemaster/zonemaster/pull/1213 is merged)
my $test_module = q{Consistency};
my $test_case = 'consistency05';
my @all_tags = qw(ADDRESSES_MATCH
IN_BAILIWICK_ADDR_MISMATCH
OUT_OF_BAILIWICK_ADDR_MISMATCH
EXTRA_ADDRESS_CHILD
CHILD_ZONE_LAME
CHILD_NS_FAILED
NO_RESPONSE);
# Common hint file (test-zone-data/COMMON/hintfile)
Zonemaster::Engine::Recursor->remove_fake_addresses( '.' );
Zonemaster::Engine::Recursor->add_fake_addresses( '.',
{ 'ns1' => [ '127.1.0.1', 'fda1:b2:c3::127:1:0:1' ],
'ns2' => [ '127.1.0.2', 'fda1:b2:c3::127:1:0:2' ],
}
);
# Test zone scenarios
# - Documentation: L<TestUtil/perform_testcase_testing()>
# - Format: { SCENARIO_NAME => [
# testable,
# zone_name,
# [ MANDATORY_MESSAGE_TAGS ],
# [ FORBIDDEN_MESSAGE_TAGS ],
# [ UNDELEGATED_NS ],
# [ UNDELEGATED_DS ],
# ] }
#
# - One of MANDATORY_MESSAGE_TAGS and FORBIDDEN_MESSAGE_TAGS may be undefined.
# See documentation for the meaning of that.
# Scenarios CHILD-ZONE-LAME-1 and IB-ADDR-MISMATCH-3 cannot be tested due to a bug in the implementation. See
# https://github.com/zonemaster/zonemaster-engine/issues/1301
# Scenario IB-ADDR-MISMATCH-4 cannot be tested, see
# https://github.com/zonemaster/zonemaster-engine/issues/1349
my %subtests = (
'ADDRESSES-MATCH-1' => [
1,
q(addresses-match-1.consistency05.xa),
[ qw(ADDRESSES_MATCH) ],
undef,
[],
[]
],
'ADDRESSES-MATCH-2' => [
1,
q(addresses-match-2.consistency05.xa),
[ qw(ADDRESSES_MATCH) ],
undef,
[],
[]
],
'ADDRESSES-MATCH-3' => [
1,
q(addresses-match-3.consistency05.xa),
[ qw(ADDRESSES_MATCH CHILD_NS_FAILED) ],
undef,
[],
[]
],
'ADDRESSES-MATCH-4' => [
1,
q(addresses-match-4.consistency05.xa),
[ qw(ADDRESSES_MATCH CHILD_NS_FAILED) ],
undef,
[],
[]
],
'ADDRESSES-MATCH-5' => [
1,
q(addresses-match-5.consistency05.xa),
[ qw(ADDRESSES_MATCH NO_RESPONSE) ],
undef,
[],
[]
],
'ADDRESSES-MATCH-6' => [
1,
q(child.addresses-match-6.consistency05.xa),
[ qw(ADDRESSES_MATCH) ],
undef,
[],
[]
],
'ADDRESSES-MATCH-7' => [
1,
q(addresses-match-7.consistency05.xa),
[ qw(ADDRESSES_MATCH) ],
undef,
[],
[]
],
'ADDR-MATCH-DEL-UNDEL-1' => [
1,
q(addr-match-del-undel-1.consistency05.xa),
[ qw(ADDRESSES_MATCH) ],
undef,
[ qw(ns3.addr-match-del-undel-1.consistency05.xa/127.14.5.33 ns3.addr-match-del-undel-1.consistency05.xa/fda1:b2:c3:0:127:14:5:33 ns4.addr-match-del-undel-1.consistency05.xa/127.14.5.34 ns4.addr-match-del-undel-1.consistency05.xa/fda1:b2:c3:0:127:14:5:34) ],
[]
],
'ADDR-MATCH-DEL-UNDEL-2' => [
1,
q(addr-match-del-undel-2.consistency05.xa),
[ qw(ADDRESSES_MATCH) ],
undef,
[ qw(ns3.addr-match-del-undel-2.consistency05.xb ns4.addr-match-del-undel-2.consistency05.xb) ],
[]
],
'ADDR-MATCH-NO-DEL-UNDEL-1' => [
1,
q(addr-match-no-del-undel-1.consistency05.xa),
[ qw(ADDRESSES_MATCH) ],
undef,
[ qw(ns1.addr-match-no-del-undel-1.consistency05.xa/127.14.5.31 ns1.addr-match-no-del-undel-1.consistency05.xa/fda1:b2:c3:0:127:14:5:31 ns2.addr-match-no-del-undel-1.consistency05.xa/127.14.5.32 ns2.addr-match-no-del-undel-1.consistency05.xa/fda1:b2:c3:0:127:14:5:32) ],
[]
],
'ADDR-MATCH-NO-DEL-UNDEL-2' => [
1,
q(addr-match-no-del-undel-2.consistency05.xa),
[ qw(ADDRESSES_MATCH) ],
undef,
[ qw(ns3.addr-match-no-del-undel-2.consistency05.xb ns4.addr-match-no-del-undel-2.consistency05.xb) ],
[]
],
'CHILD-ZONE-LAME-1' => [
0,
q(child-zone-lame-1.consistency05.xa),
[ qw(CHILD_ZONE_LAME NO_RESPONSE) ],
undef,
[],
[]
],
'CHILD-ZONE-LAME-2' => [
1,
q(child-zone-lame-2.consistency05.xa),
[ qw(CHILD_ZONE_LAME CHILD_NS_FAILED) ],
undef,
[],
[]
],
'IB-ADDR-MISMATCH-1' => [
1,
q(ib-addr-mismatch-1.consistency05.xa),
[ qw(IN_BAILIWICK_ADDR_MISMATCH EXTRA_ADDRESS_CHILD) ],
undef,
[],
[]
],
'IB-ADDR-MISMATCH-2' => [
1,
q(ib-addr-mismatch-2.consistency05.xa),
[ qw(IN_BAILIWICK_ADDR_MISMATCH) ],
undef,
[],
[]
],
'IB-ADDR-MISMATCH-3' => [
0,
q(ib-addr-mismatch-3.consistency05.xa),
[ qw(IN_BAILIWICK_ADDR_MISMATCH NO_RESPONSE) ],
undef,
[],
[]
],
'IB-ADDR-MISMATCH-4' => [
0,
q(ib-addr-mismatch-4.consistency05.xa),
[ qw(IN_BAILIWICK_ADDR_MISMATCH) ],
undef,
[],
[]
],
'OOB-ADDR-MISMATCH' => [
1,
q(child.oob-addr-mismatch.consistency05.xa),
[ qw(OUT_OF_BAILIWICK_ADDR_MISMATCH) ],
undef,
[],
[]
],
'EXTRA-ADDRESS-CHILD' => [
1,
q(extra-address-child.consistency05.xa),
[ qw(EXTRA_ADDRESS_CHILD) ],
undef,
[],
[]
],
);
###########
my $datafile = 't/' . basename ($0, '.t') . '.data';
if ( not $ENV{ZONEMASTER_RECORD} ) {
die q{Stored data file missing} if not -r $datafile;
Zonemaster::Engine::Nameserver->restore( $datafile );
Zonemaster::Engine::Profile->effective->set( q{no_network}, 1 );
}
Zonemaster::Engine::Profile->effective->merge( Zonemaster::Engine::Profile->from_json( qq({ "test_cases": [ "$test_case" ] }) ) );
perform_testcase_testing( $test_case, $test_module, \@all_tags, \%subtests, $ENV{ZONEMASTER_SINGLE_SCENARIO}, $ENV{ZONEMASTER_DISABLE_SCENARIO} );
if ( $ENV{ZONEMASTER_RECORD} ) {
Zonemaster::Engine::Nameserver->save( $datafile );
}
done_testing;
|