zonemaster / zonemaster-backend

The Zonemaster Backend - part of the Zonemaster project
Other
14 stars 23 forks source link

Fixes issue #1173 with translator.t + Downgrade Travis worker to make Mysql work #1175

Closed matsduf closed 3 months ago

matsduf commented 3 months ago

Purpose

Purpose 1

This PR makes locale being set so that translation works in t/translator.t in all OSs.

Travis is an exception where it has not been possible to make it work for all subtests. To prevent it from failing the script ends before all subtests have been run.

Purpose 2

The MySQL service suddenly fails to start in Jammy, but it still works in Focal. For Postgresql Jammy must be kept.

Context

Fixes #1173 and fixes issue with failing Mysql in Travis

How to test this PR

Purpose 1

Purpose 2

Travis should pass.

matsduf commented 3 months ago

Well, on Debian 12 it seems to work.

matsduf commented 3 months ago

There is another unrelated error from Travis:

$ if [[ "$TARGET" == "MySQL" ]]; then mysql -u root -e "CREATE USER 'travis_zm'@'localhost' IDENTIFIED BY '*****************';"; fi

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
matsduf commented 3 months ago

Glad you found the root cause. Those pesky environment variables!

Unfortunetely, there is more to it.

tgreenx commented 3 months ago

Glad you found the root cause. Those pesky environment variables!

Unfortunetely, there is more to it.

Yes, for sure. For example on OSes where only one test fail, i.e a Backend specific message, where the locale is correctly set.

mattias-p commented 3 months ago

Regarding the MySQL problem I noticed this: https://app.travis-ci.com/github/zonemaster/zonemaster-backend/jobs/623371555#L1060

$ sudo systemctl start mysql
Failed to start mysql.service: Unit mysql.service not found.
MySQL did not start within 10 seconds
matsduf commented 3 months ago

Regarding the MySQL problem I noticed this: https://app.travis-ci.com/github/zonemaster/zonemaster-backend/jobs/623371555#L1060

$ sudo systemctl start mysql
Failed to start mysql.service: Unit mysql.service not found.
MySQL did not start within 10 seconds

It should be fixed in a separate PR.

matsduf commented 3 months ago

@marc-vanderwal and @mattias-p, please re-review. I have used the model proposed by @mattias-p on our meeting. Disregard the Mysql issue for this PR.

mattias-p commented 3 months ago

I've created matsduf/zonemaster-backend#7 to update this PR with a fix for the MySQL problem.

mattias-p commented 3 months ago

It seem Jammy can't handle MySQL and Focal can't handle PostgreSQL. But it's possible to specify dist per job like this: https://github.com/zonemaster/zonemaster-backend/pull/1174/commits/ab41ad3385c23189075ca58ec1700d3ff289aac9.

matsduf commented 3 months ago

It seem Jammy can't handle MySQL and Focal can't handle PostgreSQL. But it's possible to specify dist per job like this: ab41ad3.

Already solved that in the same way, but with a different setting.

matsduf commented 3 months ago

@tgreenx @mattias-p @marc-vanderwal @MichaelTimbert: Please review, and then verify that "your" OS works correctly. See "how to test".

marc-vanderwal commented 3 months ago

Testing completed successfully on Rocky 9:

$ git log -1 --oneline
81d55a45 (HEAD -> fix-issue-translation.t, matsduf/fix-issue-translation.t) Keeps Jammy for Postgresql
$ printenv | grep -i utf
LANG=en_US.UTF-8
$ unset LANG
$ printenv | grep -i utf
$ prove t/translator.t
t/translator.t .. ok
All tests successful.
Files=1, Tests=9,  2 wallclock secs ( 0.02 usr  0.00 sys +  0.69 cusr  0.09 csys =  0.80 CPU)
Result: PASS
MichaelTimbert commented 3 months ago

fix work on Ubuntu 20.04.

$ prove t/translator.t
t/translator.t .. ok
All tests successful.
Files=1, Tests=9,  1 wallclock secs ( 0.02 usr  0.00 sys +  0.72 cusr  0.05 csys =  0.79 CPU)
Result: PASS
MichaelTimbert commented 3 months ago

fix work on Ubuntu 22.04.

$ prove t/translator.t
t/translator.t .. ok
All tests successful.
Files=1, Tests=9,  0 wallclock secs ( 0.01 usr  0.00 sys +  0.29 cusr  0.02 csys =  0.32 CPU)
Result: PASS