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

correct behavior around trust_nx_responses #1556

Merged
merged 1 commit into from
Sep 23, 2021

Conversation

peterthejohnston
Copy link
Contributor

In this change which moved the trust_nx_responses config from a configuration on the Resolver to a configuration at the name server level, the option was also renamed from distrust_nx_responses. There were some places in the codebase where the corresponding boolean value was not also flipped, unintentionally changing the semantics. This has led to some confusing behavior. For example, in this name_server_pool_test, where distrust_nx_responses was previously set to false, trust_nx_responses was left as false in the change, where it should have been changed to true.

This PR fixes a bug where retry behavior doesn't occur unless trust_nx_responses is set to true (due to an error response not being considered a ResolveError), and reworks the tests to accurately test the current behavior. It also consolidates the test_distrust_nx_responses and test_retry_on_error_response tests into one test, as they exercised the same functionality.

@codecov
Copy link

codecov bot commented Sep 22, 2021

Codecov Report

Merging #1556 (6d7df2f) into main (f7465c9) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1556   +/-   ##
=======================================
  Coverage   83.39%   83.40%           
=======================================
  Files         171      171           
  Lines       17029    17026    -3     
=======================================
- Hits        14201    14199    -2     
+ Misses       2828     2827    -1     

In 1b524af, which moved the
`trust_nx_responses` setting from a configuration on the resolver to a
configuration at the name server level, the option was also renamed from
`distrust_nx_responses`. There were some places in the codebase where
the corresponding boolean value was not also flipped, unintentionally
changing the semantics. This has led to some confusing behavior. For
example, in the `test_trust_nx_responses_fails_servfail` test, where
`distrust_nx_responses` was previously set to `false`,
`trust_nx_responses` was left as `false` in the change, where it should
have been changed to `true`.

This change fixes a bug where retry behavior doesn't occur unless
`trust_nx_responses` is set to `true` (due to an error response not
being considered a `ResolveError`), and reworks the tests to accurately
test the current behavior. It also consolidates the
`test_distrust_nx_responses` and `test_retry_on_error_response` tests
into one test, as they exercised the same functionality.
Copy link
Collaborator

@djc djc left a comment

Choose a reason for hiding this comment

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

LGTM, sorry for breaking this, and thanks for fixing it!

@djc djc merged commit 227105a into hickory-dns:main Sep 23, 2021
@peterthejohnston
Copy link
Contributor Author

Thanks for the review! Is there a plan for when the next alpha release of v0.21.0 will be tagged, or when v0.21.0 itself will come out? We'd like to be able to pull in this change whenever it's included in a release.

got {:#?}",
kind,
),
}
}

#[test]
fn test_distrust_nx_responses() {
Copy link
Member

Choose a reason for hiding this comment

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

Is this test totally invalid now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's basically testing the exact same thing as the test below it, which i added in #1526 — that when trust_nx_responses is set to false, we see the resolver try other name servers after getting an negative response.

So, I made sure that SERVFAIL, which is tested in test_distrust_nx_responses, was covered in the test below, and combined them. Does that make sense?

@bluejekyll
Copy link
Member

Thanks for the review! Is there a plan for when the next alpha release of v0.21.0 will be tagged, or when v0.21.0 itself will come out? We'd like to be able to pull in this change whenever it's included in a release.

I can publish a new release whenever. Is there a date you'd like that?

@peterthejohnston
Copy link
Contributor Author

As soon as you're able to publish a new release would be excellent. There's no specific day, but the sooner the better.

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.

None yet

3 participants