Skip to content

Removing MYSQL_PWD variable from MauticMysqlTestCase #15067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: 5.2
Choose a base branch
from

Conversation

JonasLudwig1998
Copy link
Contributor

Q A
Bug fix? (use the a.b branch) ✔️
New feature/enhancement? (use the a.x branch)
Deprecations?
BC breaks? (use the c.x branch)
Automated tests included?
Related user documentation PR URL mautic/user-documentation#...
Related developer documentation PR URL mautic/developer-documentation-new#...
Issue(s) addressed Fixes #...

Description

Seems like with the most recent ddev version, functional tests are not working properly when trying to access the database. The following error will show up:
Exception: mysqldump --opt -h"${:db_host}" -P"${:db_port}" -u"${:db_user}" "${:db_name}" > "${:db_backup_file}" failed with status code 2 and last line of "mysqldump: Got error: 1045: "Access denied for user 'db'@'...' (using password: YES)" when trying to connect

Seems like the problem is occurs due to the MYSQL_PWD variable which isn't accepted anymore. I solved the problem by changing the variable to db_host.


📋 Steps to test this PR:

  1. Open this PR on Gitpod or pull down for testing locally (see docs on testing PRs here)
  2. Run an existing functions test (e.g. composer test -- --filter testManipulatorSetOnCampaignTriggerAction)
  3. See that it will run without an error

Copy link
Contributor

@shinde-rahul shinde-rahul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Quick note: when running the tests locally with DDEV (which defaults to MariaDB), the current mysql* command fails because MariaDB doesn’t support MYSQL_PWD. This results in an 'Access denied' error.

The changes work reliably across both MariaDB and MySQL, avoiding test failures in local environments.

Copy link

codecov bot commented Jun 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.70%. Comparing base (a67d47e) to head (565ce8e).
Report is 4 commits behind head on 5.2.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##                5.2   #15067   +/-   ##
=========================================
  Coverage     63.70%   63.70%           
- Complexity    34683    34684    +1     
=========================================
  Files          2274     2274           
  Lines        103770   103771    +1     
=========================================
+ Hits          66110    66111    +1     
  Misses        37660    37660           

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JonasLudwig1998
Copy link
Contributor Author

@shinde-rahul I had to do some further adjustments because there were problems in the ci workflow when running mautic with mariadb.

The new changes work. But I'm not sure if I really found the best solution. Are there any security issues that could come with the new changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants