Closed marc-vanderwal closed 4 months ago
In the "how to test" it should be jq -r .result
not jq -r result
, at least with the jq
I have.
In the "how to test" it should be
jq -r .result
notjq -r result
, at least with thejq
I have.
That’s because it was a typo. I’ve fixed the procedure.
I've tested this according to the testing instruction above with successful results.
Purpose
This PR fixes some regressions, presumably introduced by #1319, that could not be caught in Zonemaster::Engine’s unit tests.
Context
Problems
In Zonemaster::Backend, there is a
Zonemaster::Backend::Translator
class which inherits fromZonemaster::Engine::Translator
. This is done in order to override thetranslate_tag
method with a custom version.When “un-Moosing” Zonemaster::Engine, however, changes were introduced that were harmless for Zonemaster::Engine, but not for Zonemaster::Backend. This caused two issues to emerge:
zmb get_test_results
, that rely on translating messages pulled from the database, stopped working;Cause
The root cause of the first problem is that when calling
Zonemaster::Backend::Translator->new()
, the newly-created instance was always blessed as Zonemaster::Engine::Translator (the superclass), not as the inheriting class. Thus,translate_tag()
method calls always called the method in the superclass instead of the inheriting class.As for the second problem, this is due to Backend’s Translator overriding another method,
_build_all_tag_descriptions
, from Engine’s Translator, and the initialization code in Zonemaster::Engine::Translator failing to call the overridden_build_all_tag_description
when invoked as the Backend’s Translator class.Changes
__PACKAGE__
(a macro that always expands toZonemaster::Engine::Translator
), bless with$class
instead._build_all_tag_descriptions
subroutine a proper class method and haveinitialize
hand over to the method of the correct class.How to test this PR
Make sure https://github.com/zonemaster/zonemaster-backend/pull/1166 is merged first.
Run a test with
zmb
and grab the test ID (or have a test ID of a previous test handy and skip the following command):Then, run the following after the test is done:
This command should print
"localhost"
(or whatever the domain under test was) and set an exit status of 0. Any other result, ornull
, is abnormal.Using
zmtest
, run a test on a domain name that causes Zonemaster to time out, such aspool.ntp.org
. The error message stating that the test took too long to complete should be translated (i.e., the raw untranslated message tag must not appear).