Rewrite Zone09 fully after specification update - #1543
marc-vanderwal merged 3 commits into
Conversation
|
Is the failing unit test due to error in a hint file for the scenarios? |
|
It’s an obsolete unit test file I forgot to delete. Previously, when different root hints are to be used for a scenario, that scenario had to go in a different |
b86c93f to
b4b29bc
Compare
b4b29bc to
00c3a82
Compare
Is this still a draft PR? |
It’s ready for review, but it shouldn’t be merged yet. I just hope that the specifications and the scenarios are stable enough so that this code is stable too. |
We should have an additional review on both PRs. I will soon review this PRs. |
matsduf
left a comment
There was a problem hiding this comment.
I have tested the scenarios with zonemaster-cli while updating the test-zones-output.md file. I have also inspected the normal output (non-raw). Everything looks fine and as expected.
The mail exchange domain name has a final dot '.' in the presentation, but in name/IP pairs the final dot is removed. It looks better and it is easier to read if the final dot of a domain name is always removed (unless it is the root node). |
Good point. I’ve fixed that. |
|
Yesterday I ran the same |
See scenarios in zonemaster/zonemaster#1517. Scenarios MIXED-CASE-RDATA-1 and MIXED-CASE-RDATA-2 do not pass.
0e676b4 to
83bb597
Compare
matsduf
left a comment
There was a problem hiding this comment.
I find a deviation:
| Scenario name | Mandatory message tags | Forbidden message tags |
|---|---|---|
| MIXED-CASE-RDATA-2 | Z09_MX_DATA | 2) |
zonemaster-cli --raw --test zone09 --hints hintfile.zone --level info mixed-case-rdata-2.zone09.xa
0.00 INFO GLOBAL_VERSION version=v9.0.0
0.07 INFO Z09_MX_DATA mxrdata_list=20 mail2.mixed-case-rdata-2.zone09.xa;20 mail2.mixed-case-rdata-2.zone09.xa; ns_list=ns1.mixed-case-rdata-2.zone09.xa/127.19.9.31;ns1.mixed-case-rdata-2.zone09.xa/fda1:b2:c3:0:127:19:9:31
0.07 INFO Z09_MX_DATA mxrdata_list=20 mail2.mixed-case-rdata-2.zone09.xa; ns_list=ns2.mixed-case-rdata-2.zone09.xa/127.19.9.32;ns2.mixed-case-rdata-2.zone09.xa/fda1:b2:c3:0:127:19:9:32
0.07 WARNING Z09_INCONSISTENT_MX_DATA
| scenario 'MIXED-CASE-RDATA-2' => sub { | ||
| expect Z09_MX_DATA => { | ||
| ns_list => 'ns1.mixed-case-rdata-2.zone09.xa/127.19.9.31;' | ||
| . 'ns1.mixed-case-rdata-2.zone09.xa/fda1:b2:c3:0:127:19:9:31;' | ||
| . 'ns2.mixed-case-rdata-2.zone09.xa/127.19.9.32;' | ||
| . 'ns2.mixed-case-rdata-2.zone09.xa/fda1:b2:c3:0:127:19:9:32', | ||
| mxrdata_list => '20 mail2.mixed-case-rdata-2.zone09.xa' | ||
| }; | ||
| forbid_others; | ||
| }; |
There was a problem hiding this comment.
This looks correct, but why did it pass?
|
I did run the new code since |
|
I tried rerecording the data file and now the MIXED-CASE-RDATA-2 scenario fails with the same error as what you got: But when I examine the packets in So that’s why the unit tests pass when we are not rerecording the data, while they fail when we are rerecording the packets. That’s a bug and I’ll create an issue. Meanwhile, the workaround is to test manually like you did. |
|
There is a bug in the implementation not removing the duplicate. Will you fix that? |
|
Yes, I’ve spotted it and I’m committing the fix right now. |
Rewrite the implementation of Zone09 completely, after the specification was updated. The previous implementation had two main issues: firstly, MX RRsets were not sorted before comparison; secondly, MX RRsets that only differ by TTL values were not deemed equal, although we wanted them to compare equal. Now, only the preference and exchange fields of the RDATA are used for sorting and comparison. Test scenarios were updated as well, so this commit also updates the corresponding unit tests. Said unit tests are ported to the DSL for good measure. When relevant, even the messages’ arguments are tested.
The rewriting of Zone09 also involved a migration from old Methods to MethodsV2, leading to a few more DNS queries made to authoritative servers in parent zones. The corresponding packets do not exist in the corresponding t/Test-zone.data file, so running this unit test fails. It cannot easily be rerecorded either and the .t file barely exercised the code anyway, so we can afford not to run Zone09 in that legacy test.
Use the newly-introduced _is_non_mail_domain() method and rewrite the logic of Zone11 in a way that is equivalent to the current logic, while involving fewer nested ifs.
83bb597 to
7271ac8
Compare
|
The remaining failing scenario (MIXED-CASE-RDATA-2) is marked as not testable because of #1554. But if you run it manually with |
matsduf
left a comment
There was a problem hiding this comment.
Now all scenarios pass, see zonemaster/zonemaster#1517
|
Good! Merging this PR, then. |
Purpose
This PR is a complete rewrite of the Zone09 test case, after its specification and test scenarios were updated.
The previous implementation had two main issues: firstly, MX RRsets were not sorted before comparison; secondly, MX RRsets that only differ by TTL values were not deemed equal, although we wanted them to compare equal. Now, only the preference and exchange fields of the RDATA are used for sorting and comparison.
Test scenarios were updated as well, so this commit also updates the corresponding unit tests. Said unit tests are ported to the DSL for good measure. When relevant, even the messages’ arguments are tested.
Context
See:
Changes
lib/Zonemaster/Engine/Test/Zone.pmso that lexical subroutines (state sub) can be used inside methodsHow to test this PR
Unit tests should still pass.