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 implementation of Zone01 - #1028 #1035

Merged
merged 8 commits into from
Dec 5, 2022

Conversation

tgreenx
Copy link
Contributor

@tgreenx tgreenx commented Jan 4, 2022

Purpose

This PR proposes an update to the implementation of Zone01 as described in zonemaster/zonemaster#1028.
The corresponding update to the specification can be found in zonemaster/zonemaster#1032.

Context

Addresses zonemaster/zonemaster#1028.

How to test this PR

Tests should pass

@matsduf
Copy link
Contributor

matsduf commented Jan 4, 2022

The process we have followed so far is to have the specification completed before implementation starts. In that we lower that risk of have work to be redone. I suggest that the implementation is paused until the specification is done.

@vlevigneron
Copy link
Contributor

I agree with @matsduf. We should follow the same process we had before. Specifications first, then implementation.
BTW @tgreenx, some links in your PR are wrong, for instance you refer to #1028 instead of zonemaster/zonemaster#1028 in many places

@tgreenx tgreenx added the A-TestCase Area: Test case specification or implementation of test case label May 5, 2022
@tgreenx tgreenx added this to the v2022.2 milestone May 5, 2022
@tgreenx tgreenx changed the title Implementation of Zone11 - #1028 Update implementation of Zone01 - #1028 Sep 1, 2022
@tgreenx
Copy link
Contributor Author

tgreenx commented Nov 15, 2022

Unit tests are not updated yet and thus will fail. More soon.

@tgreenx
Copy link
Contributor Author

tgreenx commented Nov 16, 2022

Ready for review

lib/Zonemaster/Engine/Test/Zone.pm Show resolved Hide resolved
lib/Zonemaster/Engine/Test/Zone.pm Outdated Show resolved Hide resolved
lib/Zonemaster/Engine/Test/Zone.pm Outdated Show resolved Hide resolved
lib/Zonemaster/Engine/Test/Zone.pm Outdated Show resolved Hide resolved
@tgreenx tgreenx requested a review from matsduf November 28, 2022 14:27
@tgreenx
Copy link
Contributor Author

tgreenx commented Nov 28, 2022

@matsduf please re-review

matsduf
matsduf previously approved these changes Nov 28, 2022
@tgreenx
Copy link
Contributor Author

tgreenx commented Nov 29, 2022

@matsduf please re-approve. I just added a reminder for untested message tags in unitary tests.

Z01_MNAME_NOT_MASTER => {
ns_list => join( q{;}, sort map { $_ . '/' . %{ $mname_not_master{$_} } } keys %mname_not_master ),
soaserial => max( map { $mname_not_master{$_} } keys %mname_not_master ),
soaserial_list => join( q{;}, @serial_ns )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@serial_ns -> uniq @serial_ns, maybe?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Either that or turn "serial_ns" into a hash as I suggested above. Compare with %mname_ns.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Comment on lines 513 to 514
$continue = 0;
last;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve had a hard time understanding this bit. Here’s what I suggest:

  • Give the foreach my $mname_ip a label:
MNAME_IP: foreach my $mname_ip ( keys %{ $mname_ns{$mname} } ){
next MNAME_IP;
  • Get rid of the $continue variable.

Doing so will, IMHO, make the code state its intent more clearly.

I’ve implemented this change myself locally to ensure that this suggestion is sound, and unit tests still pass on my machine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. There are three foreach-loops and it would maybe be easier of the enclosed ones are labeled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link
Contributor

@matsduf matsduf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides one minor comment and the two comments by @marc-vanderwal it looks fine.

Comment on lines 438 to 440
if ( not %mname_ns ){
return ( @results, info( TEST_CASE_END => { testcase => (split /::/, (caller(0))[3])[-1] } ) );
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This follows the specification, but if this is removed then the same thing will happen after foreach my $mname ( keys %mname_ns ){ ... } and if ( $found_serial ){ ... } since the two statements will be false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, updated.

@tgreenx tgreenx merged commit 8a455cf into zonemaster:develop Dec 5, 2022
@tgreenx tgreenx deleted the patch#1028 branch December 7, 2022 16:12
@marc-vanderwal marc-vanderwal added the S-ReleaseTested Status: The PR has been successfully tested in release testing label Dec 8, 2022
@marc-vanderwal
Copy link
Contributor

Unit tests pass. Also, I was able to elicit the following messages which are not covered yet by unit tests:

  • Z01_MNAME_HAS_LOCALHOST_ADDR
  • Z01_MNAME_IS_LOCALHOST

However a more complex setup, which I do not yet have at my disposal, would be needed to check the following messages:

  • Z01_MNAME_NOT_AUTHORITATIVE
  • Z01_MNAME_NOT_MASTER
  • Z01_MNAME_UNEXPECTED_RCODE.

@matsduf matsduf added the V-Minor Versioning: The change gives an update of minor in version. label Dec 13, 2022
@tgreenx tgreenx mentioned this pull request Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-TestCase Area: Test case specification or implementation of test case S-ReleaseTested Status: The PR has been successfully tested in release testing V-Minor Versioning: The change gives an update of minor in version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants