Skip to content
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

Avoid too many DB connections error in tests #13032

Merged
merged 1 commit into from Jun 5, 2018

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Jun 5, 2018

Currently, we always create a new DB connection after each test. If a class holds a reference to it say eg

public function __construct(){
    $this->db = Db::get();
}

Then eventually all tests will fail with the error Zend_Db_Adapter_Exception: SQLSTATE[08004] [1040] Too many connections.

Tried using Db::destroyDatabaseObject();Db::createDatabaseObject() instead but it didn't work.

Will need to see if tests succeed.

Currently, we always create a new DB connection after each test. If a class holds a reference to it say eg

```php
public function __construct(){
    $this->db = Db::get();
}
```

Then eventually all tests will fail with the error `Zend_Db_Adapter_Exception: SQLSTATE[08004] [1040] Too many connections`.

Tried using `Db::destroyDatabaseObject();Db::createDatabaseObject()` instead but it didn't work.
@tsteur tsteur added the Needs Review PRs that need a code review label Jun 5, 2018
@tsteur tsteur added this to the 3.6.0 milestone Jun 5, 2018
@tsteur tsteur merged commit 947b6b8 into 3.x-dev Jun 5, 2018
@tsteur tsteur deleted the testsavoidtoomanyconnections branch June 5, 2018 02:27
@tsteur tsteur added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Jun 5, 2018
InfinityVoid pushed a commit to InfinityVoid/matomo that referenced this pull request Oct 11, 2018
Currently, we always create a new DB connection after each test. If a class holds a reference to it say eg

```php
public function __construct(){
    $this->db = Db::get();
}
```

Then eventually all tests will fail with the error `Zend_Db_Adapter_Exception: SQLSTATE[08004] [1040] Too many connections`.

Tried using `Db::destroyDatabaseObject();Db::createDatabaseObject()` instead but it didn't work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant