Tests pass when individually run, but fail when the run as a suite
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- mysql, php
- Ambito
- database, testing-qa
Direzione di ricerca
Inizia da tests/test_database/NotePersistenceGetOneEntryTest.php, in particolare da testGetEntries alla riga 326, e riproduci il fallimento eseguendo i test come suite e singolarmente. Confronta il comportamento di module-db populate, cleanup, reconnect e populator tra un’esecuzione e l’altra. Il lavoro è completato quando la suite passa e il test continua a passare anche se eseguito da solo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I have a problem when running unit tests using module-db
My tests pass when the are run individually, when I run them as a suite only the first test passes, but other tests fail.
My configurations are as follow:
- Db:
dsn: 'mysql:host=localhost;dbname=test'
user: 'root'
password: ''
dump: 'tests/_data/database/empty_db.sql'
populate: true # run populator before all tests
cleanup: true # run populator before each test
reconnect: true
populator: 'mysql -u $user -h $host $dbname < $dump'
skip_cleanup_if_failed: true,
initial_queries:
- 'CREATE DATABASE IF NOT EXISTS test;'
- 'USE test;'
and the output that I see on the screen is just normal:
[Connecting To Db] {"config":{"populate":true,"cleanup":false,"reconnect":true,"waitlock":0,"dump":"tests/_data/database/empty_db.sql","populator":"mysql -u $user -h $host $dbname < $dump","skip_cleanup_if_failed":true,"dsn":"mysql:host=localhost;dbname=test","user":"root","password":""},"options":[]}
[Db] Connected to default test
[Db] Executing Populator: `mysql -u root -h localhost test < tests/_data/database/empty_db.sql`
[Db] Populator Finished.
[Db] Disconnected from default
[Connecting To Db] {"config":{"populate":true,"cleanup":false,"reconnect":true,"waitlock":0,"dump":"tests/_data/database/empty_db.sql","populator":"mysql -u $user -h $host $dbname < $dump","skip_cleanup_if_failed":true,"dsn":"mysql:host=localhost;dbname=test","user":"root","password":""},"options":[]}
[Db] Connected to default test
[Query] INSERT INTO `logbook` (`USER_CODE`, `LOGTIME`, `LOGTEXT`, `LOC_CODE`) VALUES (?, ?, ?, ?)
[Parameters] ["fsahli-notoken","2022-06-21 17:19:13","Test note asasas 2010","M009"]
[Query] INSERT INTO `logbook` (`USER_CODE`, `LOGTIME`, `LOGTEXT`, `LOC_CODE`) VALUES (?, ?, ?, ?)
[Parameters] ["fsahli-notoken","2022-06-21 17:08:38","Test note asasas 2001","M009"]
[Query] INSERT INTO `logbook` (`USER_CODE`, `LOGTIME`, `LOGTEXT`, `LOC_CODE`) VALUES (?, ?, ?, ?)
[Parameters] ["fsahli-notoken","2022-06-21 17:08:13","Test note asasas 2","M009"]
[Query] INSERT INTO `logbook` (`USER_CODE`, `LOGTIME`, `LOGTEXT`, `LOC_CODE`) VALUES (?, ?, ?, ?)
[Parameters] ["fsahli-notoken","2022-06-21 16:29:44","Test note asasas 1","M009"]
[Query] INSERT INTO `users` (`id`, `USER_CODE`, `radiususer`, `active`, `deleted`, `LEVEL_CODE`, `user_password`, `USER_NAME`, `USER_EMAIL`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
[Parameters] ["109","fsahli-notoken","iavasco:[email protected]",1,0,0,"pass","F. Sahli (Inter Act)","[email protected]"]
[Query] INSERT INTO `location` (`LOC_CODE`, `display_code`, `DEPT_CODE`, `LOC_ZONE`, `LOC_ADDRESS`, `LOC_POSTAL`, `LOC_CITY`, `LOC_COUNTRY`, `LOC_ACTIVE`, `LOC_DESC`, `LOC_TYPE`, `LOC_XPOS`, `LOC_YPOS`, `LAST_CHANGE`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
[Parameters] ["M009","M009","M009","10","","","","",1,"Koning Stadhouderlaan","MK_1AN_GPRS",0,0,"2014-02-27 08:53:40"]
[Query] INSERT INTO `location` (`LOC_CODE`, `display_code`, `DEPT_CODE`, `LOC_ZONE`, `LOC_POSTAL`, `LOC_ACTIVE`, `LOC_DESC`, `LOC_TYPE`, `LOC_XPOS`, `LOC_YPOS`, `LAST_CHANGE`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
[Parameters] ["P644","P644","P633","6","7381BL",1,"Hooiland 32","POWERLINE_PM",199649.5785,465711.177,"2014-02-27 08:53:40"]
[Query] INSERT INTO `location` (`LOC_CODE`, `display_code`, `DEPT_CODE`, `LOC_ZONE`, `LOC_POSTAL`, `LOC_ACTIVE`, `LOC_DESC`, `LOC_TYPE`, `LOC_XPOS`, `LOC_YPOS`, `LAST_CHANGE`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
[Parameters] ["P643","P643","P633","6","7381BL",1,"Hooiland 29","POWERLINE_PM",199819.791,465691.7586,"2014-02-27 08:53:40"]
[Query] INSERT INTO `department` (`DEPT_CODE`, `DEPT_DESC`, `LAST_CHANGE`) VALUES (?, ?, ?)
[Parameters] ["M009","Koning Stadhouderlaan","2014-02-27 08:53:40"]
[Query] INSERT INTO `department` (`DEPT_CODE`, `DEPT_DESC`) VALUES (?, ?)
[Parameters] ["P644","Hooiland 32"]
[Query] SELECT count(*) FROM `logbook`
[Query] SELECT count(*) FROM `users`
[Query] SELECT count(*) FROM `location`
[Query] SELECT count(*) FROM `department`
[Query] SELECT count(*) FROM `logbook` WHERE `USER_CODE` = ?
[Parameters] ["fsahli-notoken"]
+ NotePersistenceGetOneEntryTest: Get one entry (14.28s)
+ NotePersistenceTest: Test__construct (0.00s)
[Connecting To Db] {"config":{"populate":true,"cleanup":false,"reconnect":true,"waitlock":0,"dump":"tests/_data/database/empty_db.sql","populator":"mysql -u $user -h $host $dbname < $dump","skip_cleanup_if_failed":true,"dsn":"mysql:host=localhost;dbname=test","user":"root","password":""},"options":[]}
[Db] Connected to default test
[Db] Executing Populator: `mysql -u root -h localhost test < tests/_data/database/empty_db.sql`
[Db] Populator Finished.
[Db] Disconnected from default
[Connecting To Db] {"config":{"populate":true,"cleanup":false,"reconnect":true,"waitlock":0,"dump":"tests/_data/database/empty_db.sql","populator":"mysql -u $user -h $host $dbname < $dump","skip_cleanup_if_failed":true,"dsn":"mysql:host=localhost;dbname=test","user":"root","password":""},"options":[]}
[Db] Connected to default test
[Query] INSERT INTO `logbook` (`USER_CODE`, `LOGTIME`, `LOGTEXT`, `LOC_CODE`) VALUES (?, ?, ?, ?)
[Parameters] ["fsahli-notoken","2022-06-21 17:19:13","Test note asasas 2010","M009"]
[Query] INSERT INTO `logbook` (`USER_CODE`, `LOGTIME`, `LOGTEXT`, `LOC_CODE`) VALUES (?, ?, ?, ?)
[Parameters] ["fsahli-notoken","2022-06-21 17:08:38","Test note asasas 2001","M009"]
[Query] INSERT INTO `logbook` (`USER_CODE`, `LOGTIME`, `LOGTEXT`, `LOC_CODE`) VALUES (?, ?, ?, ?)
[Parameters] ["fsahli-notoken","2022-06-21 17:08:13","Test note asasas 2","M009"]
[Query] INSERT INTO `logbook` (`USER_CODE`, `LOGTIME`, `LOGTEXT`, `LOC_CODE`) VALUES (?, ?, ?, ?)
[Parameters] ["fsahli-notoken","2022-06-21 16:29:44","Test note asasas 1","M009"]
[Query] INSERT INTO `users` (`id`, `USER_CODE`, `radiususer`, `active`, `deleted`, `LEVEL_CODE`, `user_password`, `USER_NAME`, `USER_EMAIL`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
[Parameters] ["109","fsahli-notoken","iavasco:[email protected]",1,0,0,"pass","F. Sahli (Inter Act)","[email protected]"]
[Query] INSERT INTO `location` (`LOC_CODE`, `display_code`, `DEPT_CODE`, `LOC_ZONE`, `LOC_ADDRESS`, `LOC_POSTAL`, `LOC_CITY`, `LOC_COUNTRY`, `LOC_ACTIVE`, `LOC_DESC`, `LOC_TYPE`, `LOC_XPOS`, `LOC_YPOS`, `LAST_CHANGE`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
[Parameters] ["M009","M009","M009","10","","","","",1,"Koning Stadhouderlaan","MK_1AN_GPRS",0,0,"2014-02-27 08:53:40"]
[Query] INSERT INTO `location` (`LOC_CODE`, `display_code`, `DEPT_CODE`, `LOC_ZONE`, `LOC_POSTAL`, `LOC_ACTIVE`, `LOC_DESC`, `LOC_TYPE`, `LOC_XPOS`, `LOC_YPOS`, `LAST_CHANGE`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
[Parameters] ["P644","P644","P633","6","7381BL",1,"Hooiland 32","POWERLINE_PM",199649.5785,465711.177,"2014-02-27 08:53:40"]
[Query] INSERT INTO `location` (`LOC_CODE`, `display_code`, `DEPT_CODE`, `LOC_ZONE`, `LOC_POSTAL`, `LOC_ACTIVE`, `LOC_DESC`, `LOC_TYPE`, `LOC_XPOS`, `LOC_YPOS`, `LAST_CHANGE`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
[Parameters] ["P643","P643","P633","6","7381BL",1,"Hooiland 29","POWERLINE_PM",199819.791,465691.7586,"2014-02-27 08:53:40"]
[Query] INSERT INTO `department` (`DEPT_CODE`, `DEPT_DESC`, `LAST_CHANGE`) VALUES (?, ?, ?)
[Parameters] ["M009","Koning Stadhouderlaan","2014-02-27 08:53:40"]
[Query] INSERT INTO `department` (`DEPT_CODE`, `DEPT_DESC`) VALUES (?, ?)
[Parameters] ["P644","Hooiland 32"]
[Query] SELECT count(*) FROM `logbook`
[Query] SELECT count(*) FROM `users`
[Query] SELECT count(*) FROM `location`
[Query] SELECT count(*) FROM `department`
x NotePersistenceGetOneEntryTest: Get entries (15.06s)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Time: 00:29.374, Memory: 12.00 MB
There was 1 failure:
---------
1) NotePersistenceGetOneEntryTest: Get entries
Test tests\test_database\NotePersistenceGetOneEntryTest.php:testGetEntries
Failed asserting that actual size 0 matches expected size 4.
D:\laragon\www\tcn\vendor\phpunit\phpunit\src\Framework\Constraint\Constraint.php:121
D:\laragon\www\tcn\vendor\phpunit\phpunit\src\Framework\Constraint\Constraint.php:55
D:\laragon\www\tcn\vendor\phpunit\phpunit\src\Framework\Assert.php:2344
D:\laragon\www\tcn\vendor\phpunit\phpunit\src\Framework\Assert.php:286
D:\laragon\www\tcn\tests\test_database\NotePersistenceGetOneEntryTest.php:326
D:\laragon\www\tcn\vendor\phpunit\phpunit\src\Framework\TestCase.php:1526
D:\laragon\www\tcn\vendor\phpunit\phpunit\src\Framework\TestCase.php:1132
D:\laragon\www\tcn\vendor\phpunit\phpunit\src\Framework\TestResult.php:722
D:\laragon\www\tcn\vendor\phpunit\phpunit\src\Framework\TestCase.php:884
D:\laragon\www\tcn\vendor\phpunit\phpunit\src\Framework\TestSuite.php:677
D:\laragon\www\tcn\vendor\codeception\phpunit-wrapper\src\Runner.php:117
D:\laragon\www\tcn\vendor\codeception\codeception\src\Codeception\SuiteManager.php:161
D:\laragon\www\tcn\vendor\codeception\codeception\src\Codeception\Codecept.php:208
D:\laragon\www\tcn\vendor\codeception\codeception\src\Codeception\Codecept.php:162
D:\laragon\www\tcn\vendor\codeception\codeception\src\Codeception\Command\Run.php:609
D:\laragon\www\tcn\vendor\codeception\codeception\src\Codeception\Command\Run.php:442
D:\laragon\www\tcn\vendor\symfony\console\Command\Command.php:298
D:\laragon\www\tcn\vendor\symfony\console\Application.php:1024
D:\laragon\www\tcn\vendor\symfony\console\Application.php:299
D:\laragon\www\tcn\vendor\symfony\console\Application.php:171
D:\laragon\www\tcn\vendor\codeception\codeception\src\Codeception\Application.php:117
D:\laragon\www\tcn\vendor\codeception\codeception\app.php:46
D:\laragon\www\tcn\vendor\codeception\codeception\app.php:47
D:\laragon\www\tcn\vendor\codeception\codeception\codecept:6
D:\laragon\www\tcn\vendor\bin\codecept:112
FAILURES!
Tests: 3, Assertions: 23, Failures: 1.
[Db] Disconnected from default
[Db] Disconnected from default
can you please check and let me know
Best regards,
Firas
- Lingua principale
- PHP
- Stelle
- 23
- Fork
- 31
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Codeception/module-db
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
Codeception/module-db#87 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
Codeception/module-db#85 ·
-
Make optional the auto-erase of the records, added by `haveInDatabase()`Forse già presa @iliayatsenko l’ha presa 723 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Codeception/module-db#68 · 1 commento ·
-
Fix a confusion between 'cleanup' and 'skip_cleanup_if_failed' configuration paramsForse già presa @iliayatsenko l’ha presa 723 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Codeception/module-db#67 ·
-
inserting null on an autoincrement primary key prevents cleanupForse già presa @jtopenpetition l’ha presa 1261 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
Codeception/module-db#58 ·
Tutte le issue di Codeception/module-db
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
taskforcesh/bullmq#5238 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] v-change-database-password reports success but doesn't change the password when MySQL validate_password rejects itForse già presa @bfs2021 l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Automattic/jetpack#55517 ·
I maintainer di solito rispondono entro 1 giorno
-
Address edit modal: what the customer types before the fields load is reset to the saved valueApertaMajor
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
PrestaShop/ps_onepagecheckout#245 ·
I maintainer di solito rispondono entro 1 giorno
-
wpvc
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
10up/ElasticPress#4420 ·
I maintainer di solito rispondono entro 1 giorno