8000 Tear down active transactions in functional test cases by deeky666 · Pull Request #2638 · doctrine/dbal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Tear down active transactions in functional test cases #2638

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

Merged
merged 1 commit into from
Feb 7, 2017

Conversation

deeky666
Copy link
Member
@deeky666 deeky666 commented Feb 6, 2017

I recently discovered a hard to debug issue where I was writing functional tests and suddenly the testsuite was hanging. After hours of debugging I found out that a previous test, involving transactions, failed inside a transaction and was affecting all subsequent tests as the transaction was marked as "rollback only" and still active. As we are mainly using a shared connection for performance reasons, this can get quite nasty.
I added a tearDown method to the base functional test case that checks, whether a transaction is active and rolls it back if that is the case.

@@ -40,6 +40,13 @@ protected function setUp()
$this->_conn->getConfiguration()->setSQLLogger($this->_sqlLoggerStack);
}

protected function tearDown()
{
if ($this->_conn->isTransactionActive()) {
Copy link
Member

Choose a reason for hiding this comment

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

What happens if we have nested transactions?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed 👍

@deeky666 deeky666 force-pushed the tear-down-active-transactions branch from e64551f to 4f1f176 Compare February 6, 2017 19:01
@Ocramius Ocramius self-assigned this Feb 7, 2017
@Ocramius Ocramius modified the milestones: 2.6, 2.5.12 Feb 7, 2017
@Ocramius Ocramius merged commit 16be549 into doctrine:master Feb 7, 2017
Ocramius added a commit that referenced this pull request Feb 7, 2017
@Ocramius
Copy link
Member
Ocramius commented Feb 7, 2017

Backported to 2.5 via eb0a49c

👍

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0