zonemaster / zonemaster-backend

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

Fix message strings in test reports after migration #1145

Closed mattias-p closed 9 months ago

mattias-p commented 10 months ago

Purpose

This PR fixes translation of message strings in reports of test results that have been migrated from the previous version of the database schema.

Context

This problem was found while release testing v2023.2. The problem is described as item 3 in https://github.com/zonemaster/zonemaster-backend/pull/1092#issuecomment-1892265157.

Changes

The migration script is updated to save module and test case names the way zm-rpcapi expects to find them.

How to test this PR

  1. Create dist tarballs for Zonemaster-LDNS, Zonemaster-Engine and Zonemaster-Backend from both the master branch and the develop branch (or the PR branch in case it hasn't been merged) and place them in the $HOME/old and $HOME/new directories.
  2. Using the master branch dist tarballs, follow the installation instructions for Engine and Backend up to but excluding the "Database engine installation" section.
  3. Set age_reuse_previous_test = 60 for good measure.
  4. Take a snapshot of the machine and name it "old-before-db" (to be restored in later steps).
  5. For each DB engine as $db:
    1. Complete Backend installation using $db.
    2. Run zmtest nu > $HOME/$db-nu.old.result and save the test id as $test_id_nu.
    3. Run zmtest SE. > $HOME/$db-se.old.result and save the test id as $test_id_se.
    4. Take a snapshot of the machine and name it "old-$db" (in case we need get back here).
    5. Run sudo systemctl stop zm-rpcapi zm-testagent.
    6. Run sudo cpanm --notest $HOME/new/*.
    7. Run sudo perl $(perl -MFile::ShareDir=dist_dir -E 'say dist_dir("Zonemaster-Backend")')/patch/patch_db_zonemaster_backend_ver_11.0.3.pl.
    8. Run sudo systemctl start zm-rpcapi zm-testagent.
    9. Run zmb get_test_results --lang en --test-id $test_id_nu | jq -S > $HOME/$db-nu.migrated.result.
    10. Run zmb get_test_results --lang en --test-id $test_id_se | jq -S > $HOME/$db-se.migrated.result.
    11. Run zmtest nu > $HOME/$db-nu.new.result.
    12. Run zmtest SE. > $HOME/$db-se.new.result.
    13. Verify that the $HOME/$db-nu.* files are essentially identical.
    14. Verify that the $HOME/$db-se.* files are essentially identical.
    15. Take a snapshot of the machine and name it "new-$db" (in case we need get back here).
    16. Restore the "old-before-db" snapshot.
marc-vanderwal commented 9 months ago

@mattias-p, @tgreenx I’ve just pushed a commit onto this branch that also fixes some of the messages generated by Delegation01. I’ve tested this change on Rocky Linux 9.3 with PostgreSQL, MariaDB and MySQL, and I can confirm that the affected messages are correctly migrated.

However, as I also said in the commit message: I’m zipping together the list of names and the list of IPs, even though, according to zonemaster/zonemaster#1203, the names and IPs might not match. But I think it’s better to have mismatched names and IPs in the migrated messages, rather than messages having unfilled placeholders.

marc-vanderwal commented 9 months ago

Shouldn’t we merge this PR?