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

Test zones for the CNAME function in Recursor.pm in Engine #1220

Merged
merged 16 commits into from
Jul 4, 2024

Conversation

matsduf
Copy link
Contributor

@matsduf matsduf commented Nov 15, 2023

Purpose

Test zone for unit tests for zonemaster/zonemaster-engine#1288

How to test this PR

Create unit tests based on these test zones when the PR in engine has been completed.

Copy link
Contributor

@marc-vanderwal marc-vanderwal left a comment

Choose a reason for hiding this comment

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

Looks fine. I just saw a few typos and I have one comment about a problem case.

Copy link
Contributor Author

@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.

@marc-vanderwal, also see the dig output in test-zone-data/Engine/Recursor-PM/README.md in this PR.

@@ -20,6 +20,446 @@ See [CNAME.md] for specification of the scenarios.

## zonemaster-cli commands and their output for each test scenario
Copy link
Contributor

Choose a reason for hiding this comment

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

But these are outputs from dig, not zonemaster-cli. And I suppose that they were obtained with CoreDNS.

Copy link
Contributor Author

@matsduf matsduf Nov 24, 2023

Choose a reason for hiding this comment

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

The outputs are with dig against the CoreDNS configuration. They are there to show what Zonemaster would get if the unit tests query for those names with query type A.

I am waiting for zonemaster/zonemaster-engine#1288 to be done.

This is different since there is no test case to run, is there? I do not see how I could run zonemaster-cli for these scenarios.

Copy link
Contributor

Choose a reason for hiding this comment

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

zonemaster/zonemaster-engine#1288 has been updated to include the changes discussed in the work group. Note that two unit tests are failing due to an issue with CoreDNS, see my other comments.
You should now be able to test this PR properly.

test-zone-data/Engine/Recursor-PM/README.md Outdated Show resolved Hide resolved
@matsduf
Copy link
Contributor Author

matsduf commented Nov 24, 2023

@marc-vanderwal and @tgreenx: Please re-review.

marc-vanderwal
marc-vanderwal previously approved these changes Nov 28, 2023
@matsduf
Copy link
Contributor Author

matsduf commented Nov 28, 2023

I want to hear from @tgreenx before merging. It should match zonemaster/zonemaster-engine#1288.

Comment on lines +288 to +298
;; ANSWER SECTION:
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.
Copy link
Contributor

@tgreenx tgreenx Nov 28, 2023

Choose a reason for hiding this comment

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

Why are there so many of the same CNAME record here? This is also what I get when running locally. Is it a bug in CoreDNS? There should be just one for this test scenario; otherwise Engine will output CNAME_MULTIPLE_FOR_NAME instead of CNAME_LOOP_INNER.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess it is a bug in CoreDNS, but on the other hand, the CNAME records are identical and I feel they should be considered to be one. I will check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have reported the bug to CoreDNS (coredns/coredns#6421). At least I think it is a bug. I suspect that CoreDNS "thinks" that it should follow CNAME from the response. Some sort of internal resolver.

I failed to find a work-around.

Comment on lines 328 to 338
;; ANSWER SECTION:
looped-cname-in-zone-2.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-2-a.cname.recursor.engine.xa.
looped-cname-in-zone-2-a.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-2-b.cname.recursor.engine.xa.
looped-cname-in-zone-2-b.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-2-a.cname.recursor.engine.xa.
looped-cname-in-zone-2-a.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-2-b.cname.recursor.engine.xa.
looped-cname-in-zone-2-b.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-2-a.cname.recursor.engine.xa.
looped-cname-in-zone-2-a.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-2-b.cname.recursor.engine.xa.
looped-cname-in-zone-2-b.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-2-a.cname.recursor.engine.xa.
looped-cname-in-zone-2-a.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-2-b.cname.recursor.engine.xa.
looped-cname-in-zone-2-b.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-2-a.cname.recursor.engine.xa.
looped-cname-in-zone-2-a.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-2-b.cname.recursor.engine.xa.
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment here. CNAME records are unexpectedly repeated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same answer as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have also reported this, but here I found a work-around wht with dig gives the following result:

; <<>> DiG 9.18.18-0ubuntu0.22.04.1-Ubuntu <<>> @127.30.1.31 looped-cname-in-zone-2.cname.recursor.engine.xa
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 13110
;; flags: qr aa rd; QUERY: 1, ANSWER: 3, AUTHORITY: 1, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 7a7a75c08fe99560 (echoed)
;; QUESTION SECTION:
;looped-cname-in-zone-2.cname.recursor.engine.xa. IN A

;; ANSWER SECTION:
looped-cname-in-zone-2.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-2-a.cname.recursor.engine.xa.
looped-cname-in-zone-2-a.cname.recursor.engine.xa. 3600	IN CNAME looped-cname-in-zone-2-b.cname.recursor.engine.xa.
looped-cname-in-zone-2-b.cname.recursor.engine.xa. 3600	IN CNAME looped-cname-in-zone-2-a.cname.recursor.engine.xa.

;; AUTHORITY SECTION:
cname.recursor.engine.xa. 3600	IN	NS	ns1.cname.recursor.engine.xa.

;; Query time: 0 msec
;; SERVER: 127.30.1.31#53(127.30.1.31) (UDP)
;; WHEN: Wed Nov 29 13:07:05 UTC 2023
;; MSG SIZE  rcvd: 488

I will update.

@@ -20,6 +20,446 @@ See [CNAME.md] for specification of the scenarios.

## zonemaster-cli commands and their output for each test scenario
Copy link
Contributor

Choose a reason for hiding this comment

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

zonemaster/zonemaster-engine#1288 has been updated to include the changes discussed in the work group. Note that two unit tests are failing due to an issue with CoreDNS, see my other comments.
You should now be able to test this PR properly.

@matsduf
Copy link
Contributor Author

matsduf commented Nov 29, 2023

@marc-vanderwal and @tgreenx: Please re-review.

@matsduf
Copy link
Contributor Author

matsduf commented Dec 1, 2023

@marc-vanderwal and @tgreenx: Please re-review.

Copy link
Contributor

@tgreenx tgreenx left a comment

Choose a reason for hiding this comment

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

Commit zonemaster/zonemaster-engine@32244e9 adds a message tag CNAME_START whenever the CNAME lookup functionality is used. This could be added to the list of expected message tags for each scenario.

@matsduf matsduf modified the milestones: v2023.2, v2024.1 Dec 7, 2023
@matsduf
Copy link
Contributor Author

matsduf commented Dec 7, 2023

Commit zonemaster/zonemaster-engine@32244e9 adds a message tag CNAME_START whenever the CNAME lookup functionality is used. This could be added to the list of expected message tags for each scenario.

What is the expected output where I have put "??"? Could you check the table?

Co-authored-by: tgreenx <96772376+tgreenx@users.noreply.github.com>
From review comment.

Co-authored-by: Marc van der Wal <103426270+marc-vanderwal@users.noreply.github.com>
@matsduf matsduf requested a review from tgreenx May 22, 2024 11:53
@tgreenx tgreenx modified the milestones: v2024.1, v2024.2 Jun 12, 2024
@matsduf matsduf merged commit 946f837 into zonemaster:develop Jul 4, 2024
@matsduf matsduf deleted the cname-resolver-test-zones branch July 4, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants