-
Notifications
You must be signed in to change notification settings - Fork 33
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
Updates methodsv2 unit tests #1351
Updates methodsv2 unit tests #1351
Conversation
58a034e
to
7b12a5c
Compare
1747b77
to
fb3ca78
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM so far
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest the following fix to handle undefined values in the input data hash :
diff --git a/t/TestUtil.pm b/t/TestUtil.pm
index 2f627823..28941126 100644
--- a/t/TestUtil.pm
+++ b/t/TestUtil.pm
@@ -334,9 +334,9 @@ sub perform_methodsv2_testing {
# Methods: get_del_ns_names() and get_zone_ns_names()
@method_names = qw( get_del_ns_names get_zone_ns_names );
- my @expected_del_ns_names = uniq map { (split( m(/), $_ ))[0] } @{ $expected_del_ns };
- my @expected_zone_ns_names = uniq map { (split( m(/), $_ ))[0] } @{ $expected_zone_ns };
- my @expected_ns_names = ( \@expected_del_ns_names, \@expected_zone_ns_names );
+ my $expected_del_ns_names = defined $expected_del_ns ? [ uniq map { (split( m(/), $_ ))[0] } @{ $expected_del_ns } ] : undef;
+ my $expected_zone_ns_names = defined $expected_zone_ns ? [ uniq map { (split( m(/), $_ ))[0] } @{ $expected_zone_ns } ] : undef;
+ my @expected_ns_names = ( $expected_del_ns_names, $expected_zone_ns_names );
foreach my $i ( 0..$#method_names ) {
my $method = $method_names[$i];
subtest $method => sub {
@@ -362,9 +362,9 @@ sub perform_methodsv2_testing {
# Methods: get_del_ns_ips() and get_zone_ns_ips()
@method_names = qw( get_del_ns_ips get_zone_ns_ips );
- my @expected_del_ns_ips = grep defined, uniq map { (split( m(/), $_ ))[1] } @{ $expected_del_ns };
- my @expected_zone_ns_ips = grep defined, uniq map { (split( m(/), $_ ))[1] } @{ $expected_zone_ns };
- my @expected_ns_ips = ( \@expected_del_ns_ips, \@expected_zone_ns_ips );
+ my $expected_del_ns_ips = defined $expected_del_ns ? [ uniq map { (split( m(/), $_ ))[1] } @{ $expected_del_ns } ] : undef;
+ my $expected_zone_ns_ips = defined $expected_zone_ns ? [ uniq map { (split( m(/), $_ ))[1] } @{ $expected_zone_ns } ] : undef;
+ my @expected_ns_ips = ( $expected_del_ns_ips, $expected_zone_ns_ips );
Moreover I suggest that some new checks be added around line 269 to forbid the presence of any undefined value in the arrays of the input data hash.
I implemented the proposal and ran one unit test under the latest code of #1373 and get the following output (still with defined array in methods.t):
It is hard to understand such a message. It should be clearer. It is not obvious what it means. If I add
|
I do not know what you suggest. |
83211a7
to
3ba6d01
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, save for a few typos.
* Explicit error messages expected list does not match extracted by code * Support for distrinktion between empty list and undefined list * Added feature "single scenario" * Added feature "disable scenarios" for one run * Corrected bug that created undefined IP address when IP addresses were extracted from name/IP expressions an expression was name only * Replaced built in IP address verification against from Zonemaster library
* Adds more scenarios/unit tests * Updates unit tests * Adds support for running a single scenario or temporarily disable a scenario or list of scenarios
Co-authored-by: Marc van der Wal <103426270+marc-vanderwal@users.noreply.github.com>
- Fix support of name servers without IP addresses in input data hash - Update unit tests - Update unit test data
984f046
to
a49117d
Compare
- Fix support of name servers without IP address - Add check for existence of single scenario - Update unit test and unit test data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Marc van der Wal <103426270+marc-vanderwal@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All tests pass. All comments handled. Has previously been approved by @marc-vanderwal |
Purpose
This PR provides unit tests based on test scenarios for MethodsV2, as defined in zonemaster/zonemaster#1254. It also updates
t/TestUtil.pm
.Updates of t/TestUtil.pm:
Updates of t/methodsv2.t:
Updated t/methodsv2.data
How to test
All unit tests should be enabled and all should pass. For that the result of #1373 must be installed.