Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Basic01 implementation #1357

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
475 changes: 257 additions & 218 deletions lib/Zonemaster/Engine/Test/Basic.pm

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions share/profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@
"A_QUERY_NO_RESPONSES" : "INFO",
"B01_CHILD_IS_ALIAS" : "NOTICE",
"B01_CHILD_FOUND" : "INFO",
"B01_CHILD_NOT_EXIST" : "INFO",
"B01_INCONSISTENT_ALIAS" : "ERROR",
"B01_INCONSISTENT_DELEGATION" : "ERROR",
"B01_NO_CHILD" : "ERROR",
"B01_PARENT_DISREGARDED" : "INFO",
"B01_PARENT_FOUND" : "INFO",
"B01_PARENT_NOT_FOUND" : "WARNING",
"B01_PARENT_UNDETERMINED" : "WARNING",
"B01_UNEXPECTED_NS_RESPONSE" : "WARNING",
"B01_ROOT_HAS_NO_PARENT" : "INFO",
"B01_SERVER_ZONE_ERROR" : "DEBUG",
"B02_AUTH_RESPONSE_SOA" : "INFO",
"B02_NO_DELEGATION" : "CRITICAL",
"B02_NO_WORKING_NS" : "CRITICAL",
Expand Down
25 changes: 19 additions & 6 deletions share/profile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,34 @@ test_levels:
TEST_CASE_START: DEBUG
BASIC:
A_QUERY_NO_RESPONSES: INFO
B01_CHILD_IS_ALIAS : NOTICE
B01_CHILD_FOUND : INFO
B01_INCONSISTENT_ALIAS : ERROR
B01_INCONSISTENT_DELEGATION : ERROR
B01_NO_CHILD : ERROR
B01_PARENT_DISREGARDED : INFO
B01_PARENT_FOUND : INFO
B01_PARENT_NOT_FOUND : WARNING
B01_PARENT_UNDETERMINED : WARNING
B01_ROOT_HAS_NO_PARENT : INFO
B01_SERVER_ZONE_ERROR : DEBUG
B02_AUTH_RESPONSE_SOA : INFO
B02_NO_DELEGATION : CRITICAL
B02_NO_WORKING_NS : CRITICAL
B02_NS_BROKEN : ERROR
B02_NS_NOT_AUTH : ERROR
B02_NS_NO_IP_ADDR : ERROR
B02_NS_NO_RESPONSE : WARNING
B02_UNEXPECTED_RCODE : ERROR
DOMAIN_NAME_LABEL_TOO_LONG: CRITICAL
DOMAIN_NAME_TOO_LONG: CRITICAL
DOMAIN_NAME_ZERO_LENGTH_LABEL: CRITICAL
HAS_A_RECORDS: ERROR
HAS_NAMESERVERS: INFO
HAS_NAMESERVER_NO_WWW_A_TEST: INFO
HAS_PARENT: INFO
IPV4_DISABLED: DEBUG
IPV4_ENABLED: DEBUG
IPV6_DISABLED: DEBUG
IPV6_ENABLED: DEBUG
NO_GLUE_PREVENTS_NAMESERVER_TESTS: CRITICAL
NO_PARENT: CRITICAL
NS_FAILED: ERROR
NS_NO_RESPONSE: DEBUG
TEST_CASE_END: DEBUG
TEST_CASE_START: DEBUG
CONNECTIVITY:
Expand Down
225 changes: 87 additions & 138 deletions t/Test-basic.data

Large diffs are not rendered by default.

25 changes: 4 additions & 21 deletions t/Test-basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,6 @@ my $zone;
ok( $res{B02_AUTH_RESPONSE_SOA}, q{B02_AUTH_RESPONSE_SOA} );
ok( $res{HAS_NAMESERVER_NO_WWW_A_TEST}, q{HAS_NAMESERVER_NO_WWW_A_TEST} );

%res = map { $_->tag => 1 } Zonemaster::Engine->test_module( q{basic}, q{birgerjarlhotel.se} );
ok( $res{A_QUERY_NO_RESPONSES}, q{A_QUERY_NO_RESPONSES} );

###########
# basic01
###########
$zone = Zonemaster::Engine->zone( 'exampledomain.fake' );
zone_gives('basic01', $zone, [qw{B01_PARENT_FOUND B01_NO_CHILD}] );
zone_gives_not( 'basic01', $zone, [qw{B01_CHILD_IS_ALIAS B01_CHILD_FOUND B01_CHILD_NOT_EXIST B01_INCONSISTENT_ALIAS B01_INCONSISTENT_DELEGATION B01_PARENT_UNDETERMINED B01_UNEXPECTED_NS_RESPONSE}] );

$zone = Zonemaster::Engine->zone( 'afnic.fr' );
zone_gives('basic01', $zone, [qw{B01_PARENT_FOUND B01_CHILD_FOUND}] );
zone_gives_not( 'basic01', $zone, [qw{B01_CHILD_IS_ALIAS B01_CHILD_NOT_EXIST B01_INCONSISTENT_ALIAS B01_INCONSISTENT_DELEGATION B01_NO_CHILD B01_PARENT_UNDETERMINED B01_UNEXPECTED_NS_RESPONSE}] );

###########
# basic02
###########
Expand Down Expand Up @@ -137,13 +123,10 @@ Zonemaster::Engine::Profile->effective->set( q{no_network}, 1 );
TODO: {
local $TODO = "Need to find/create zones with that error";

# basic01
ok( $tag{B01_CHILD_IS_ALIAS}, q{B01_CHILD_IS_ALIAS} );
ok( $tag{B01_CHILD_NOT_EXIST}, q{B01_CHILD_NOT_EXIST} );
ok( $tag{B01_INCONSISTENT_ALIAS}, q{B01_INCONSISTENT_ALIAS} );
ok( $tag{B01_INCONSISTENT_DELEGATION}, q{B01_INCONSISTENT_DELEGATION} );
ok( $tag{B01_PARENT_UNDETERMINED}, q{B01_PARENT_UNDETERMINED} );
ok( $tag{B01_UNEXPECTED_NS_RESPONSE}, q{B01_UNEXPECTED_NS_RESPONSE} );
#basic03
ok( $tag{A_QUERY_NO_RESPONSES}, q{A_QUERY_NO_RESPONSES} );
ok( $tag{HAS_A_RECORDS}, q{HAS_A_RECORDS} );
ok( $tag{NO_A_RECORDS}, q{NO_A_RECORDS} );
}

done_testing;
448 changes: 266 additions & 182 deletions t/Test-basic01.data

Large diffs are not rendered by default.

45 changes: 23 additions & 22 deletions t/Test-basic01.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ my $test_module = 'Basic';
my $test_case = 'basic01';
my @all_tags = qw(B01_CHILD_IS_ALIAS
B01_CHILD_FOUND
B01_CHILD_NOT_EXIST
B01_INCONSISTENT_ALIAS
B01_INCONSISTENT_DELEGATION
B01_NO_CHILD
B01_PARENT_DISREGARDED
B01_PARENT_FOUND
B01_PARENT_NOT_FOUND
B01_PARENT_UNDETERMINED
B01_ROOT_HAS_NO_PARENT
B01_SERVER_ZONE_ERROR);

# Common hint file (test-zone-data/COMMON/hintfile)
Expand Down Expand Up @@ -60,7 +61,7 @@ my %subtests = (
[],
],
'GOOD-MIXED-1' => [
0,
1,
q(child.parent.good-mixed-1.basic01.xa),
[ qw(B01_CHILD_FOUND B01_PARENT_FOUND) ],
undef,
Expand Down Expand Up @@ -94,47 +95,47 @@ my %subtests = (
'GOOD-UNDEL-1' => [
1,
q(child.parent.good-undel-1.basic01.xa),
[ qw(B01_CHILD_FOUND B01_PARENT_FOUND) ],
[ qw(B01_CHILD_FOUND B01_PARENT_DISREGARDED) ],
undef,
[ qw(ns3-undelegated-child.basic01.xa ns4-undelegated-child.basic01.xa) ],
[],
],
'GOOD-MIXED-UNDEL-1' => [
0,
1,
q(child.parent.good-mixed-undel-1.basic01.xa),
[ qw(B01_CHILD_FOUND B01_PARENT_FOUND) ],
[ qw(B01_CHILD_FOUND B01_PARENT_DISREGARDED) ],
undef,
[ qw(ns3-undelegated-child.basic01.xa ns4-undelegated-child.basic01.xa) ],
[],
],
'GOOD-MIXED-UNDEL-2' => [
1,
q(child.parent.good-mixed-undel-2.basic01.xa),
[ qw(B01_CHILD_FOUND B01_PARENT_FOUND) ],
[ qw(B01_CHILD_FOUND B01_PARENT_DISREGARDED) ],
undef,
[ qw(ns3-undelegated-child.basic01.xa ns4-undelegated-child.basic01.xa) ],
[],
],
'NO-DEL-UNDEL-1' => [
0,
1,
q(child.parent.no-del-undel-1.basic01.xa),
[ qw(B01_CHILD_NOT_EXIST B01_PARENT_FOUND) ],
[ qw(B01_CHILD_FOUND B01_PARENT_DISREGARDED) ],
undef,
[ qw(ns3-undelegated-child.basic01.xa ns4-undelegated-child.basic01.xa) ],
[],
],
'NO-DEL-MIXED-UNDEL-1' => [
0,
1,
q(child.parent.no-del-mixed-undel-1.basic01.xa),
[ qw(B01_CHILD_NOT_EXIST B01_PARENT_FOUND) ],
[ qw(B01_CHILD_FOUND B01_PARENT_DISREGARDED) ],
undef,
[ qw(ns3-undelegated-child.basic01.xa ns4-undelegated-child.basic01.xa) ],
[],
],
'NO-DEL-MIXED-UNDEL-2' => [
0,
1,
q(child.w.x.parent.y.z.no-del-mixed-undel-2.basic01.xa),
[ qw(B01_CHILD_NOT_EXIST B01_PARENT_FOUND) ],
[ qw(B01_CHILD_FOUND B01_PARENT_DISREGARDED) ],
undef,
[ qw(ns3-undelegated-child.basic01.xa ns4-undelegated-child.basic01.xa) ],
[],
Expand Down Expand Up @@ -236,9 +237,9 @@ my %subtests = (
[],
],
'CHLD-FOUND-INCONSIST-9' => [
0,
1,
q(child.parent.chld-found-inconsist-9.basic01.xa),
[ qw(B01_CHILD_IS_ALIAS B01_CHILD_FOUND B01_INCONSISTENT_DELEGATION) ],
[ qw(B01_CHILD_IS_ALIAS B01_CHILD_FOUND B01_INCONSISTENT_DELEGATION B01_PARENT_FOUND) ],
undef,
[],
[],
Expand All @@ -252,23 +253,23 @@ my %subtests = (
[],
],
'NO-DEL-UNDEL-NO-PAR-1' => [
0,
1,
q(child.parent.no-del-undel-no-par-1.basic01.xa),
[ qw(B01_CHILD_NOT_EXIST B01_PARENT_NOT_FOUND B01_SERVER_ZONE_ERROR) ],
[ qw(B01_CHILD_FOUND B01_PARENT_DISREGARDED) ],
undef,
[ qw(ns3-undelegated-child.basic01.xa ns4-undelegated-child.basic01.xa) ],
[],
],
'NO-DEL-UNDEL-PAR-UND-1' => [
0,
1,
q(child.parent.no-del-undel-par-und-1.basic01.xa),
[ qw(B01_CHILD_NOT_EXIST B01_PARENT_FOUND B01_PARENT_UNDETERMINED) ],
[ qw(B01_CHILD_FOUND B01_PARENT_DISREGARDED) ],
undef,
[ qw(ns3-undelegated-child.basic01.xa ns4-undelegated-child.basic01.xa) ],
[],
],
'NO-CHLD-NO-PAR-1' => [
0,
1,
q(child.parent.no-chld-no-par-1.basic01.xa),
[ qw(B01_NO_CHILD B01_PARENT_NOT_FOUND B01_SERVER_ZONE_ERROR) ],
undef,
Expand All @@ -292,23 +293,23 @@ my %subtests = (
[],
],
'ZONE-ERR-GRANDPARENT-1' => [
0,
1,
q(child.parent.zone-err-grandparent-1.basic01.xa),
[ qw(B01_CHILD_FOUND B01_PARENT_FOUND B01_SERVER_ZONE_ERROR) ],
undef,
[],
[],
],
'ZONE-ERR-GRANDPARENT-2' => [
0,
1,
q(child.parent.zone-err-grandparent-2.basic01.xa),
[ qw(B01_CHILD_FOUND B01_PARENT_FOUND B01_SERVER_ZONE_ERROR) ],
undef,
[],
[],
],
'ZONE-ERR-GRANDPARENT-3' => [
0,
1,
q(child.parent.zone-err-grandparent-3.basic01.xa),
[ qw(B01_CHILD_FOUND B01_PARENT_FOUND B01_SERVER_ZONE_ERROR) ],
undef,
Expand Down
2 changes: 1 addition & 1 deletion t/translator.t
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ subtest 'Everything but Test::NoWarnings' => sub {
module => 'Basic',
testcase => 'Basic01',
tag => 'B01_PARENT_FOUND',
args => { domain => 'nothing.nowhere', ns_ip_list => 'ns1.nothing.nowhere/1.1.1.1' },
args => { domain => 'nothing.nowhere', ns_list => 'ns1.nothing.nowhere/1.1.1.1' },
}
);

Expand Down
Loading
Loading