magento2: Integration tests failing during Magento setup
Preconditions (*)
- Fresh Magento 2.4.3 installation
- PHP 7.3 or PHP 7.4
- Composer version 2.1.5 (also tried with the highest composer 1 version
- no RabbitMQ
Steps to reproduce (*)
- Basically I follow the steps in this doc https://devdocs.magento.com/guides/v2.4/test/integration/integration_test_execution.html
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-editionbin/magento module:enable --allupdate the configuration indev/tests/integration/etc/install-config-mysql.php` (no RabbitMQ configuration)mysql -e "DROP DATABASE IF EXISTS magento_integration_tests"mysql -e "CREATE DATABASE magento_integration_tests"cd dev/tests/integration && php ../../../vendor/bin/phpunit
Expected result (*)
- Magento test instance should be configured in dev/tests/integration/tmp/sandbox-{hash} dir
- Tests defined in
dev/tests/integration/phpunit.xml.distshould start running
Actual result (*)
- When running magento installation command, this command fails during the step “Disabling Maintenance Mode” with an error
In ResourceConnection.php line 148:
[DomainException]
Connection "default" is not defined
Log file is attached below
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”. log.txt
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 7
- Comments: 32 (19 by maintainers)
Reproduced on 2.4.5
@ihor-sviziev Is anyone at Adobe working on that issue. It’s currently blocking the deployment of several (also commerce) projects, because our build pipelines are broken. That’s a core issue which should be prioritized by the core team.
I can confirm that this issue exists. I just updated to magento 2.4.3 and then tried to run integration tests. I get the exact same error as @sergeynezbritskiy stated in the issue.
The same bug also appears when trying to install magento with the file
app/etc/config.phppresent. To reproduce try the following:app/etc/env.phpbin/magento setup:install ...againI think that these errors are related as the setup process for integration tests tries to install magento with an env.php and config.php present, so I think both errors are fixable at once.
Should I still create an extra issue for it or not, what do you think @ihor-sviziev?
Any updates on this issue? I can reproduce it in a pipeline on Magento 2.4.4.
i too can confirm, that the PR #33803 fixes the issue.
New information. If we delete the
app/etc/config.phpin the pipeline, the installation finishes without a failure. But that’s not a solution.Here’s one for Magento 2.4.5 which I’ve created earlier today, it’s based on https://github.com/magento/magento2/pull/33803 but had to fix some merge conflicts, so hopefully those were solved correctly, but it seems to work on our end at least.
PR-33803-Framework.txt
For a reason I do not have time to investigate for, I have removed the package
magento/composer-root-update-pluginfrom my integration tests pipeline and it works now:Maybe it will help someone!
This problem has indeed returned in 2.4.7-beta1, but also in 2.4.6-p2 (which is now available in pre-release and will be available from the 8th of August for everyone).
I’ve opened a new issue for this: https://github.com/magento/magento2/issues/37805
✅ Jira issue https://jira.corp.magento.com/browse/AC-1405 is successfully created for this GitHub issue.
We can confirm that the PR #33803 fixes the issue. We added the code changes a patch in our project. The pipeline is then “green”.
We have that issue if the config.php is checked in and if we run that in the CI pipeline.
php bin/magento setup:install --cleanup-database --db-host=localhost --db-user=root --db-password=root --db-name=magentoOn the local machine we can run the command twice. The second run fixes the (maybe cache) issue. In the CI it’s not the idea to run the installation process twice.
No need to create a separate issue. I reopened this one
@hostep your patch is very useful. Thank you
The current pull request here does not work on 2.4.3 currently since the load() function differs between 2.4.3 and 2.4.4;
Reproduced on 2.4.5-p1.
The patch provided by @hostep works.
Additional information regarding this issue:
disabled, the tests are running fine, so currently as a workaround I wrapped this command in try/catch in my Jenkinsfiles and run tests second time in catch