[Db] Change to disconnect on initialise breaks tests where Db is used in _beforeSuite
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
Research direction
Start by inspecting the Db module's connection initialization and the helper code that runs SQL in _beforeSuite, using the shown reconnect configuration to reproduce the failure. Done means suite setup can execute its control-row SQL without a terminated connection when reconnect is enabled.
Written by the indexing model from the issue text.
Description
What are you trying to achieve?
A helper runs code to modify the database in _beforeSuite in order to add control rows before any tests are run.
What do you get instead?
The code crashes upon trying to run SQL as the connection has been terminated. This was new behaviour added by https://github.com/Codeception/Codeception/commit/5e2c999df9eae7ff4f802eb801940f87088f0fc7
Easiest fix would be to create a public method on Db to ensure that the connection is open before running code if config has reconnect. The quickest route would just be to make connect() public.
Details
- Codeception version: 2.2.11
- PHP Version: 7.0.19
- Operating System: Ubuntu 16.04 LTS
- Installation type: Composer
- List of installed packages (
composer show) not relevant - Suite configuration:
config:
Db:
dsn: 'mysql:host=localhost;dbname=XXXX;charset=utf8'
user: 'root'
password: ''
dump: 'tests/_data/schema.sql'
populate: true
cleanup: false
reconnect: true
- Dominant language
- PHP
- Stars
- 23
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Codeception/module-db
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
Codeception/module-db#87 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Codeception/module-db#85 ·
-
Make optional the auto-erase of the records, added by `haveInDatabase()`Possibly taken @iliayatsenko claimed this 723 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Codeception/module-db#68 · 1 comment ·
-
Fix a confusion between 'cleanup' and 'skip_cleanup_if_failed' configuration paramsPossibly taken @iliayatsenko claimed this 723 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Codeception/module-db#67 ·
-
inserting null on an autoincrement primary key prevents cleanupPossibly taken @jtopenpetition claimed this 1261 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 38/100
Codeception/module-db#58 ·
All issues in Codeception/module-db
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
taskforcesh/bullmq#5238 ·
Maintainers usually reply within 1 day
-
[Bug] v-change-database-password reports success but doesn't change the password when MySQL validate_password rejects itPossibly taken @bfs2021 claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Automattic/jetpack#55517 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
area/import type/enhancement when/later
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day