Add CI tests to ensure created backups are valid

Created on 19 September 2024, 3 months ago

Problem/Motivation

From https://www.drupal.org/project/backup_migrate/issues/3228379#comment-157... πŸ› Download errors, backup files contain trailing HTML, corrupts archive backups Needs work

Is there already a test available to check the resulting backup for consistency? (Not being broken like before)? Then we should also add that one for all backup tests, I think!

If not, we should have a follow-up to implement one to save us from dangerous broken / corrupted backups?

Steps to reproduce

Proposed resolution

Add tests to ensure created backups are created correctly using the techniques and storage options in this module.
In the past there were issues with corrupted backups due to bugs: πŸ› Download errors, backup files contain trailing HTML, corrupts archive backups Needs work

We should have tests in the future to save us from that.

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

5.1

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @solideogloria
  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Thanks for the follow-up @solideogloria!

    I think, it might make sense to implement validatons on the resulting backup file generation in this module (I think this is not a test running on the actual backups taken on Drupal sites). I guess that would be a different and probably hard to implement feature.

    As first step a helper class could be implemented for such tests, for example to check the validity based on general metrics or static validations? I'm not aware, which techniques are best to check these backups. Maybe one could look into similar open source tools? Maybe the database engines offer some tools or something like that.

    Maybe most simple tests bring the most quick and largest WIN, like to example checking the backups contain valid SQL (and nothing else like trailing HTML or error message like reported in the previous issue).
    This issue can become extremely complex, but starting simple might be better.

  • I think that, for starters, it would be easiest to import a SQL file, create a backup, then check that the backup file is the same as the imported file? Then do the same with gzip enabled.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    This should not be a feature for users of the module, but CI tests for this module to create working backups as expected.
    Everything else should be a separate issue, please. As written above, I'm unsure, how hard it will be to test created backups automatically in user environments.

    Clarified the title and description.

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Thank you for creating this issue.

    Test coverage to confirm the backup works is 100% the way to go.

Production build 0.71.5 2024