Skip to content

Update implementation of Zone01 - #1028#1035

Merged
tgreenx merged 8 commits into
zonemaster:developfrom
tgreenx:patch#1028
Dec 5, 2022
Merged

Update implementation of Zone01 - #1028#1035
tgreenx merged 8 commits into
zonemaster:developfrom
tgreenx:patch#1028

Conversation

@tgreenx

@tgreenx tgreenx commented Jan 4, 2022

Copy link
Copy Markdown
Contributor

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

matsduf commented Jan 4, 2022

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

tgreenx commented Nov 15, 2022

Copy link
Copy Markdown
Contributor Author

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

@tgreenx tgreenx requested review from a user, hannaeko, marc-vanderwal and mattias-p November 16, 2022 10:16
@tgreenx

tgreenx commented Nov 16, 2022

Copy link
Copy Markdown
Contributor Author

Ready for review

Comment thread lib/Zonemaster/Engine/Test/Zone.pm
Comment thread lib/Zonemaster/Engine/Test/Zone.pm Outdated
Comment thread lib/Zonemaster/Engine/Test/Zone.pm Outdated
Comment thread lib/Zonemaster/Engine/Test/Zone.pm Outdated
@tgreenx tgreenx requested a review from matsduf November 28, 2022 14:27
@tgreenx

tgreenx commented Nov 28, 2022

Copy link
Copy Markdown
Contributor Author

@matsduf please re-review

matsduf
matsduf previously approved these changes Nov 28, 2022
@tgreenx

tgreenx commented Nov 29, 2022

Copy link
Copy Markdown
Contributor Author

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

Comment thread lib/Zonemaster/Engine/Test/Zone.pm Outdated
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated

Comment thread lib/Zonemaster/Engine/Test/Zone.pm Outdated
Comment on lines +513 to +514
$continue = 0;
last;

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated

@matsduf matsduf left a comment

Copy link
Copy Markdown
Contributor

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 thread lib/Zonemaster/Engine/Test/Zone.pm Outdated
Comment on lines +438 to +440
if ( not %mname_ns ){
return ( @results, info( TEST_CASE_END => { testcase => (split /::/, (caller(0))[3])[-1] } ) );
}

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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