-
Notifications
You must be signed in to change notification settings - Fork 23
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
Fixes broken unit tests #1192
Fixes broken unit tests #1192
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine, except for one teeny tiny little thing.
Co-authored-by: Marc van der Wal <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After investigating, I would suggest an alternative fix:
Firstly, the need for making new queries is due to zonemaster/zonemaster-engine#1397, which requires all DNSSEC queries to be re-recorded. I forgot to do it here, sorry. The unit tests do call Zonemaster::Backend::RPCAPI::get_data_from_parent_zone()
which does indeed make a DNSSEC query.
While creating and using distinct profiles can also solve the issue, I think the issue can be better addressed in Zonemaster::Backend::Config
. When loading profiles, currently Backend will start with an entirely new profile and disregard any values from the effective profile. So a simple one-line fix would be:
$ git diff
diff --git a/lib/Zonemaster/Backend/Config.pm b/lib/Zonemaster/Backend/Config.pm
index 78eba7b..6b59c62 100644
--- a/lib/Zonemaster/Backend/Config.pm
+++ b/lib/Zonemaster/Backend/Config.pm
@@ -93,7 +93,7 @@ sub load_profiles {
foreach my $name ( keys %profile_paths ) {
my $path = $profile_paths{$name};
- my $full_profile = Zonemaster::Engine::Profile->default;
+ my $full_profile = Zonemaster::Engine::Profile->effective;
if ( defined $path ) {
my $json = eval { read_file( $path, err_mode => 'croak' ) } #
// die "Error loading profile '$name': $@";
Regarding the unexpected making of new queries without ZONEMASTER_RECORD=1
, this can be explained by the following: in the t/test01.t
unit test file, method TestUtil::restore_datafile()
is called and sets profile parameter no_network
to 1 so it should prevent the sending of new queries. But this is rendered useless as Zonemaster::Backend::TestAgent::run() is called afterwards, which will override the settings in the effective profile with a profile that has been instantiated with default values instead of effective values.
I suggest that you create a new PR instead. |
Done, see #1193. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Temporary fix. Will be replaced by #1193 in another release.
It's a bit awkward, but it looks right to me. Not saying it's your fault that it's awkward. |
Purpose
Unit test file
t/test01.t
leaks queries when network is set to off. A change in .fr NS and DS triggered the tests to break. This PR:t/test01.t
with correct expectations on .fr.t/test01.t
so that it does not leak queries.t/test01.data
to match updates on .fr and updatedt
file.t/idn.t
so that it does not leak queries.Context
Issue #1191
How to test this PR