-
Notifications
You must be signed in to change notification settings - Fork 379
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
LOOPIA: BUG: MX record integration tests failing #2218
Comments
Not sure where to dig for this problem - if your gnome senses know where to zoom in, that'd be a help. I thought I took care of all correction loops. |
Does this test fail if you run the tests on the master branch? If so, it's a global problem that I should fix the the core code. If it just happens on the v3.30.0test tag, then this is a problem with the providers/loopia code. The fix might look like this:
HTH |
Gonna have to check and run again. I'm fairly sure it happens normally. I
thought I got it when I was changing code before the loopia merge.
Evidently not 馃挬
|
Problem seems more global. I did:
if it helps you any, Loopia is not a 'by label' provider. They're a 'incremental-record' provider. I don't mind that this happens and eventually succeeds, but if it's a fail, so be it. Let's fix it. |
Just for fun, I tried your proposed fix, case "MX":
// err = rc.SetTargetMX(record.Priority, record.Rdata)
err = rc.SetTargetMX(record.Priority, dnsutil.AddOrigin(record.Rdata, origin)) and the results are the same but the names are not just subdomain names, but fqdns without the dot:
Fail. Then I tweaked your fix as a hack (I don't fully understand the implications of what I did) to; case "MX":
// err = rc.SetTargetMX(record.Priority, record.Rdata)
err = rc.SetTargetMX(record.Priority, dnsutil.AddOrigin(record.Rdata, origin) + ".") and it passed:
|
Perfect! Could you send a PR, please? |
Sure - although does your code still have agency if I just tack on a "." there? And isn't there a smarter helper function to add a "." (one that verifies if one doesn't already exist)? |
After a call to AddOrigin it is always safe to add a ".".
Nope. You'd be surprised at how rarely "add a dot if it missing" conditional is needed. APIs are very consistent: they return a field that is either FQDN all the time or FQDN+dot all the time. I've never seen an API that says "sometimes you'll get a trailing dot, but not always". In all the years this project has been around, no API has made that kind of breaking change. Therefore there's no need for such a conditional when processing API-generated values. It would add unneeded complexity, and add to the testing burden. On the other hand, humans are inconsistent. We need that kind of thing for data that comes from dnsconfig.js, but that is handled by DNSControl long before the provider gets access to the data. In fact, correcting what a human does is so complex that I had to write an article about the process: https://docs.dnscontrol.org/language-reference/why-the-dot At this point I may not have convinced you, so let's look at what would happen if the API did change: API included a dot, now it doesn't: You would think that having "if no trailing dot, add it" would future-proof the code and save the day, right? Nope. We can't be sure of that. Why would the provider make such a change? They wouldn't make the change for no reason, why break their clients? API didn't include the dot, now it does: Why did the API change? Did they get a great discount from their ISP and decided to luxuriously start wasting bandwidth like a drunken sailor? Unlikely. Random change? Unlikely... why break clients for no reason? Was it because they're now sending short names and need to signal when a FQDN is being sent? Possibly. Now our future-proofing code is doing the wrong thing. Better than "if no trailing dot, add it", would be "if no trailing dot, panic("the API did something unexpected"). And, while I like that kind of defensive data validation the risk does not outweigh the reward. Such a protocol change would break most of their users, so they're not going to make such a change without a major version change (semvar). |
Thank you for the details.
I just wasn't sure whether adding a dot here might cause other problems
further down the line.
PR is ready. 馃憣
|
Both of those tests look like the same issue. It is trying to change "foo" to "foo.example.com.". My guess is somewhere there should be a loop that turns all the targets for MX, CNAME, NS (and possibly others) from shortnames to FQDNs.
Let me know how I can help!
Originally posted by @tlimoncelli in #2214 (comment)
The text was updated successfully, but these errors were encountered: