Closed marc-vanderwal closed 5 months ago
@marc-vanderwal, translator.t
fails in Travis. See #1170.
Tested and working on Ubuntu 20.04.6 and 22.04.4.
on Ubuntu 20.04 the migration script in cat /usr/local/share/perl/5.30.0/auto/share/dist/Zonemaster-Backend/patch/patch_db_zonemaster_backend_ver_11.2.0.pl
fail due to the line use List::MoreUtils qw(zip_unflatten);
Error:
Could not find sub 'zip_unflatten' exported by List::MoreUtils at /usr/local/share/perl/5.30.0/auto/share/dist/Zonemaster-Backend/patch/patch_db_zonemaster_backend_ver_11.2.0.pl line 4.
BEGIN failed--compilation aborted at /usr/local/share/perl/5.30.0/auto/share/dist/Zonemaster-Backend/patch/patch_db_zonemaster_backend_ver_11.2.0.pl line 4.
zip_unflatten
is not present in List::MoreUtils
version 0.416.
$ perl -MList::MoreUtils -le 'print $List::MoreUtils::VERSION'
0.416
Commenting the line make the migration script work.
ca9ad8b3
(before the merge of this PR)max_zonemaster_execution_time = 10
in /etc/zonemaster/backend_config.ini
sudo systemctl restart zm-*
pool.ntp.org
and note the test ID.
result of this first test:
...
"results": [
{
"module": "BACKEND_TEST_AGENT",
"testcase": "",
"level": "CRITICAL",
"message": "Le test a mis trop de temps à s’exécuter (la limite actuelle est de 10 secondes). Il y a peut-être trop de serveurs de noms, ou les serveurs de noms sont injoignables ou trop peu réactifs.\n"
}
...
develop
(after the merge of this PR)"results": [
{
"level": "CRITICAL",
"message": "The test took too long to run (the current limit is 10 seconds). Maybe there are too many name servers or the name servers are either unreachable or not responsive enough.\n",
"module": "Backend",
"testcase": ""
}
zmb get_test_results --test-id <IDTEST> --lang en|jq
. Message is not translated.
"results": [
{
"module": "BACKEND_TEST_AGENT",
"message": "BACKEND_TEST_AGENT:UNABLE_TO_FINISH_TEST max_execution_time=10\n",
"testcase": "",
"level": "CRITICAL"
}
/usr/local/share/perl/5.30.0/auto/share/dist/Zonemaster-Backend/patch/patch_db_zonemaster_backend_ver_11.2.0.pl
zmb get_test_results --test-id <IDTEST> --lang fr|jq
. Message is now translated.
"results": [
{
"module": "Backend",
"testcase": "",
"level": "CRITICAL",
"message": "Le test a mis trop de temps à s’exécuter (la limite actuelle est de 10 secondes). Il y a peut-être trop de serveurs de noms, ou les serveurs de noms sont injoignables ou trop peu réactifs.\n"
}
],
Oh, I see. We don’t need List::MoreUtils
in this script, so that’s something that should be fixed before the release.
Changes tagging of this from V-Patch
to V-Minor
to motivate the minor version upgrade.
Purpose
This PR adds unit tests for
Zonemaster::Backend::Translator
and addresses an oversight in Backend caused by storing the module’s names as mixed case instead of uppercase.Context
Submitting PR https://github.com/zonemaster/zonemaster-engine/pull/1346 made it clear that
Zonemaster::Backend::Translator
lacked appropriate unit tests. When adding them, I found more bugs, now addressed in the same PR. I also noticed that all Backend-generated messages suddenly became untranslated.Changes
Backend_Test_Agent
;How to test this PR
Prerequisite: PR https://github.com/zonemaster/zonemaster-engine/pull/1346 must be merged beforehand in Zonemaster-Engine. Alternatively, install a local copy Zonemaster-Engine from a local development branch with this PR merged. If not, one of the newly-added unit tests will fail.
Before merging this PR locally: run a test on a domain name that causes Zonemaster to time out, such as
pool.ntp.org
, usingzmtest
. Note the test ID. Wait for the test to time out. Notice that the UNABLE_TO_FINISH_TEST message is untranslated (i.e., only the message tag is visible).After merging this PR locally: run the unit tests. Ideally, make sure that the tests in
t/translator.t
have been executed.Run the database migration script. Then use
zmb get_test_results --test-id $TEST_ID
where$TEST_ID
is the test ID ofpool.ntp.org
that was run before merging the PR locally. Expect the UNABLE_TO_FINISH_TEST message to be translated.Run the same test again on
pool.ntp.org
usingzmtest
; wait for it to time out. Expect the UNABLE_TO_FINISH_TEST message to be translated as well.