-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
[Issue] [TestFramework] Stopped marking transaction in integration tests as inactive although they're still active #39460
Comments
Hi @engcom-Hotel. Thank you for working on this issue.
|
Hi @engcom-Hotel, But the issue in #39463 makes it impossible to reproduce the error of this issue in the current 2.4-develop branch. To reproduce it, please comment out this line: magento2/dev/tests/integration/framework/Magento/TestFramework/Event/Transaction.php Line 115 in 9c48c55
Then you will be able to reproduce the issue and see the error message that I have quoted. Btw. there is a pull request to fix this issue. I have reported multiple issues, which have to do with the integration test framework, which may be confusing... sorry for that ;-) |
Hello @stollr, Thanks for the information! We have tried to reproduce the issue and it is reproducible for us. Please refer to the below screenshot for reference: Hence confirming the issue. Thanks |
✅ Jira issue https://jira.corp.adobe.com/browse/AC-13523 is successfully created for this GitHub issue. |
✅ Confirmed by @engcom-Hotel. Thank you for verifying the issue. |
This issue is automatically created based on existing pull request: #39429: [TestFramework] Stopped marking transaction in integration tests as inactive although they're still active
Description (*)
Before an integration test is started the testing framework begins a new database transaction so that all changes to the database can be reverted after the test is completed.
The testing framework also offers a way to easily load data fixtures during this transaction with the help of the
Magento\TestFramework\Fixture\DataFixture
attribute. But in case of faulty fixtures an exception or error can occur. Currently this will prevent theendTest
event from rolling back the transaction and so the tests fail with the error message:instead of showing the real reason of the error.
The reason why the transaction is not rolled back correctly is that the catch block in the Transaction event marks the transaction as 'inactive' (see here) so that it won't be rolled back at the end of the test (see here), although the transaction is still open.
This PR fixes this behaviour so that the transaction is rolled back after the test execution and the correct error messages is shown in the console output.
Manual testing scenarios (*)
Add an integration test to your own test suite that uses a data fixture with an invalid config. For example:
Now, run the test and you should get this output:
After applying this PR the output of phpunit shows the following:
This helps the developer to find the real issue. The previous message 'Some transactions have not been committed or rolled back' does not help.
Contribution checklist (*)
The text was updated successfully, but these errors were encountered: