Skip to content

Commit

Permalink
Merge pull request #1197 from zonemaster/develop
Browse files Browse the repository at this point in the history
Merge develop branch into master (Backend)
  • Loading branch information
matsduf authored Dec 9, 2024
2 parents d5fe5db + 9a406f2 commit 0e21f27
Show file tree
Hide file tree
Showing 15 changed files with 394 additions and 121 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ addons:
- build-essential
- cpanminus
- libclone-perl
- libextutils-pkgconfig-perl
- libfile-sharedir-perl
- libfile-slurp-perl
- libidn2-dev
- libintl-perl
- libio-socket-inet6-perl
- libjson-pp-perl
- liblist-compare-perl
- liblist-moreutils-perl
- liblocale-msgfmt-perl
- libmail-rfc822-address-perl
Expand Down
11 changes: 11 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
Release history for Zonemaster component Zonemaster-Backend


v11.3.0 2024-12-09 (part of Zonemaster v2024.2 release)

[Release information]
- Translations have not been fully updated in this release. They will
be updated in an upcoming release.

[Features]
- Makes utilities zmb() and zmtest() supported (not experimental) and adds file
function for batch creation in zmb() (#1186)


v11.2.0 2024-07-01 (part of Zonemaster v2024.1 release)

[Release information]
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ t/rpc_validation.t
t/test01.data
t/test01.t
t/test_profile.json
t/test_profile_network_true.json
t/test_profile_no_network.json
t/test_validate_syntax.t
t/TestUtil.pm
t/validator.t
Expand Down
4 changes: 4 additions & 0 deletions MANIFEST.SKIP
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,8 @@

# Avoid MYMETA files
^MYMETA\.

# Avoid MANIFEST test
t/manifest.t

#!end included /usr/share/perl/5.20/ExtUtils/MANIFEST.SKIP
6 changes: 3 additions & 3 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ requires
'Router::Simple::Declare' => 0,
'Starman' => 0,
'Try::Tiny' => 0.12,
'Zonemaster::LDNS' => 4.000002, # v4.0.2
'Zonemaster::Engine' => 6.000000, # v6.0.0
'Zonemaster::LDNS' => 4.001000, # v4.1.0
'Zonemaster::Engine' => 7.000000, # v7.0.0
;

test_requires 'DBD::SQLite' => 1.66;
test_requires 'Test::Differences';
test_requires 'Test::Exception';
test_requires 'Time::Local' => 1.26;
test_requires 'Test::NoWarnings';
test_requires 'Test::NoWarnings' => 0;

recommends 'DBD::mysql';
recommends 'DBD::Pg';
Expand Down
2 changes: 1 addition & 1 deletion lib/Zonemaster/Backend.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package Zonemaster::Backend;

our $VERSION = '11.2.0';
our $VERSION = '11.3.0';

use strict;
use warnings;
Expand Down
24 changes: 22 additions & 2 deletions script/zmb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ Zmb is meant to be pronounced I<Zimba>.
zmb [GLOBAL OPTIONS] COMMAND [OPTIONS]
This interface is unstable and will change in a future release.
=head1 GLOBAL OPTIONS
--help Show usage
Expand Down Expand Up @@ -454,11 +452,21 @@ sub cmd_add_api_user {
--client-version CLIENT_VERSION
--profile PROFILE_NAME
--queue QUEUE
--file FILENAME
"--domain" is repeated for each domain to be tested.
"--nameserver" can be repeated for each name server.
"--ds-info" can be repeated for each DS record.
"--file" points at a file with a list of domain names
to test, one name per line. Lines starting with "#",
empty lines and lines with white space only are
ignored. Trailing white space is ignored.
"--file" and "--domain" can be combined. Domains specified
by any "--domain" are added before those specified in the
file, if any.
DS_INFO is a comma separated list of key-value pairs. The expected pairs are:
keytag=NON_NEGATIVE_INTEGER
Expand All @@ -475,6 +483,7 @@ sub cmd_add_batch_job {
my $opt_api_key;
my @opt_nameserver;
my @opt_domains;
my $opt_file;
my $opt_client_id;
my $opt_client_version;
my @opt_ds_info;
Expand All @@ -495,8 +504,19 @@ sub cmd_add_batch_job {
'ipv6=s' => \$opt_ipv6,
'profile=s' => \$opt_profile,
'queue=s' => \$opt_queue,
'file=s' => \$opt_file,
) or pod2usage( 2 );

if ($opt_file) {
open( my $fh, "<", $opt_file ) or die "Can't open < $opt_file: $!";
while( <$fh> ) {
chomp;
s/\s+$//;
s/^\s+//;
next if /^#/ or /^$/;
push( @opt_domains, decode_utf8( $_ ) );
};
};

my %params = ( domains => \@opt_domains );

Expand Down
2 changes: 0 additions & 2 deletions script/zmtest
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ usage () {
[ -n "$message" ] && printf "%s\n" "${message}" >&2
echo "Usage: zmtest [OPTIONS] DOMAIN" >&2
echo >&2
echo "This interface is unstable and may change in a future release." >&2
echo >&2
echo "Options:" >&2
echo " -h --help Show usage (this documentation)." >&2
echo " -s URL --server URL Zonemaster Backend to query. Default is http://localhost:5000/" >&2
Expand Down
1 change: 0 additions & 1 deletion t/TestUtil.pm
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ sub restore_datafile {
die q{Stored data file missing} if not -r $datafile;
Zonemaster::Engine->preload_cache( $datafile );
Zonemaster::Engine->profile->set( q{no_network}, 1 );
diag "not recording";
} else {
diag "recording";
}
Expand Down
18 changes: 16 additions & 2 deletions t/idn.t
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ my $datafile = "$t_path/idn.data";
TestUtil::restore_datafile( $datafile );

my $tempdir = tempdir( CLEANUP => 1 );
my $config = Zonemaster::Backend::Config->parse( <<EOF );

my $configuration = <<"EOF";
[DB]
engine = $db_backend
Expand All @@ -46,10 +47,23 @@ database_file = $tempdir/zonemaster.sqlite
[LANGUAGE]
locale = en_US
EOF

if ( $ENV{ZONEMASTER_RECORD} ) {
$configuration .= <<"EOF";
[PUBLIC PROFILES]
test_profile=$t_path/test_profile_network_true.json
default=$t_path/test_profile_network_true.json
EOF
} else {
$configuration .= <<"EOF";
[PUBLIC PROFILES]
test_profile=$t_path/test_profile.json
test_profile=$t_path/test_profile_no_network.json
default=$t_path/test_profile_no_network.json
EOF
}

my $config = Zonemaster::Backend::Config->parse( $configuration );

my $db = TestUtil::init_db( $config );
my $agent = TestUtil::create_testagent( $config );
Expand Down
37 changes: 37 additions & 0 deletions t/manifest.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!perl
use v5.14.2;
use strict;
use warnings;
use utf8;
use Test::More tests => 2;
use Test::NoWarnings;

use File::Basename qw( dirname );

chdir dirname( dirname( __FILE__ ) ) or BAIL_OUT( "chdir: $!" );

my $makebin = 'make';

sub make {
my @make_args = @_;

undef $ENV{MAKEFLAGS};

my $command = join( ' ', $makebin, '-s', @make_args );
my $output = `$command 2>&1`;

if ( $? == -1 ) {
BAIL_OUT( "failed to execute: $!" );
}
elsif ( $? & 127 ) {
BAIL_OUT( "child died with signal %d, %s coredump\n", ( $? & 127 ), ( $? & 128 ) ? 'with' : 'without' );
}

return $output, $? >> 8;
}

subtest "distcheck" => sub {
my ( $output, $status ) = make "distcheck";
is $status, 0, $makebin . ' distcheck exits with value 0';
is $output, "", $makebin . ' distcheck gives empty output';
};
211 changes: 108 additions & 103 deletions t/test01.data

Large diffs are not rendered by default.

25 changes: 18 additions & 7 deletions t/test01.t
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ my $datafile = "$t_path/test01.data";
TestUtil::restore_datafile( $datafile );

my $tempdir = tempdir( CLEANUP => 1 );
my $config = Zonemaster::Backend::Config->parse( <<EOF );

my $configuration = <<"EOF";
[DB]
engine = $db_backend
Expand All @@ -46,10 +47,23 @@ database_file = $tempdir/zonemaster.sqlite
[LANGUAGE]
locale = en_US
EOF

if ( $ENV{ZONEMASTER_RECORD} ) {
$configuration .= <<"EOF";
[PUBLIC PROFILES]
test_profile=$t_path/test_profile_network_true.json
default=$t_path/test_profile_network_true.json
EOF
} else {
$configuration .= <<"EOF";
[PUBLIC PROFILES]
test_profile=$t_path/test_profile.json
test_profile=$t_path/test_profile_no_network.json
default=$t_path/test_profile_no_network.json
EOF
}

my $config = Zonemaster::Backend::Config->parse( $configuration );

my $rpcapi = TestUtil::create_rpcapi( $config );

Expand Down Expand Up @@ -181,7 +195,6 @@ subtest 'API calls' => sub {

my @ns_list = map { $_->{ns} } @{ $res->{ns_list} };
ok( grep( /d\.nic\.fr/, @ns_list ), 'Has "d.nic.fr" nameserver' );
ok( grep( /e\.ext\.nic\.fr/, @ns_list ), 'Has "e.ext.nic.fr" nameserver' );
ok( grep( /f\.ext\.nic\.fr/, @ns_list ), 'Has "f.ext.nic.fr" nameserver' );
ok( grep( /g\.ext\.nic\.fr/, @ns_list ), 'Has "g.ext.nic.fr" nameserver' );

Expand All @@ -190,16 +203,14 @@ subtest 'API calls' => sub {
ok( grep( /2001:678:c::1/, @ip_list ), 'Has "2001:678:c::1" ip' );
ok( grep( /194\.0\.36\.1/, @ip_list ), 'Has "194.0.36.1" ip' ); # g.ext.nic.fr
ok( grep( /2001:678:4c::1/, @ip_list ), 'Has "2001:678:4c::1" ip' );
ok( grep( /193\.176\.144\.22/, @ip_list ), 'Has "193.176.144.22" ip' ); # e.ext.nic.fr
ok( grep( /2a00:d78:0:102:193:176:144:22/, @ip_list ), 'Has "2a00:d78:0:102:193:176:144:22" ip' );
ok( grep( /194\.146\.106\.46/, @ip_list ), 'Has "194.146.106.46" ip' ); # f.ext.nic.fr
ok( grep( /2001:67c:1010:11::53/, @ip_list ), 'Has "2001:67c:1010:11::53" ip' );

my $ds_value = {
'algorithm' => 13,
'digest' => '1b3386864d30ccc8f4541b985bf2ca320e4f52c57c53353f6d29c9ad58a5671f',
'digest' => '1303e8da8fb60db500d5bea1ee5dc9a2bcc93dfe2fc43d346576658feccf5749', # must match case
'digtype' => 2,
'keytag' => 51508
'keytag' => 29133
};
is( scalar( @{ $res->{ds_list} } ), 1, 'Has only one DS set' );
is_deeply( $res->{ds_list}[0], $ds_value, 'Has correct DS values' );
Expand Down
85 changes: 85 additions & 0 deletions t/test_profile_network_true.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"no_network" : false,
"logfilter": {
"BASIC":{
"IPV6_DISABLED" : [
{
"when": {
"rrtype": [ "SOA", "NS" ]
},
"set": "INFO"
}
]
}
},
"test_cases": [
"address01",
"address02",
"address03",
"basic00",
"basic01",
"basic02",
"basic03",
"connectivity01",
"connectivity02",
"connectivity03",
"consistency01",
"consistency02",
"consistency03",
"consistency04",
"consistency05",
"consistency06",
"dnssec01",
"dnssec02",
"dnssec03",
"dnssec04",
"dnssec05",
"dnssec07",
"dnssec06",
"dnssec08",
"dnssec09",
"dnssec10",
"dnssec11",
"dnssec13",
"dnssec14",
"dnssec15",
"dnssec16",
"dnssec17",
"dnssec18",
"delegation01",
"delegation02",
"delegation03",
"delegation04",
"delegation05",
"delegation06",
"delegation07",
"nameserver01",
"nameserver02",
"nameserver04",
"nameserver05",
"nameserver06",
"nameserver07",
"nameserver10",
"nameserver11",
"nameserver12",
"nameserver13",
"syntax01",
"syntax02",
"syntax03",
"syntax04",
"syntax05",
"syntax06",
"syntax07",
"syntax08",
"zone01",
"zone02",
"zone03",
"zone04",
"zone05",
"zone06",
"zone07",
"zone08",
"zone09",
"zone10"
]
}
Loading

0 comments on commit 0e21f27

Please sign in to comment.