phpunit database teardown is incomplete
Bug #1515794 reported by
Aaron Wells
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Fix Released
|
Low
|
Jean-Philippe Gaudreau | ||
15.10 |
Fix Released
|
Low
|
Unassigned |
Bug Description
As noticed in Bug 1515473.
If you run the Mahara phpunit tests twice against the same database (by doing "make phpunit") you get errors on the second run. Phpunit attempts to tear down the test database and re-create it, but it misses some items and errors out when it tries to recreate them, because they already exist. This happens in Postgres or MySQL.
I'm guessing it's because there are some database entities that we create through direct execution of DDL statements rather than through XMLDB and install.xml files. Probably the teardown uses the install.xml files to remove everything, misses the directly-created things, and then the subsequent installer tries to re-create them.
Changed in mahara: | |
status: | Confirmed → In Progress |
Changed in mahara: | |
status: | In Progress → Fix Committed |
status: | Fix Committed → In Progress |
Changed in mahara: | |
status: | In Progress → Fix Committed |
milestone: | none → 16.04.0 |
Changed in mahara: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
MySQL:
[INF] ce (lib/phpunit. php:159) Installing blocktype. blog/taggedpost s taggedposts_ tags' already exists] in adodb_throw(CREATE TABLE tst_blocktype_ taggedposts_ tags ( taggedposts_ tags ( taggedposts_ tags ( www/mahara/ htdocs/ lib/ddl. php:754 www/mahara/ htdocs/ lib/upgrade. php(429) : install_ from_xmldb_ file('/ home/aaronw/ ww...') www/mahara/ htdocs/ lib/phpunit. php(173) : upgrade_ plugin( Object( stdClass) ) www/mahara/ htdocs/ lib/tests/ phpunit/ bootstrap. php(34) : UnitTestBootstr ap->install_ mahara( ) www/mahara/ external/ vendor/ phpunit/ phpunit/ PHPUnit/ Util/Fileloader .php(92) : include_ once('/ home/aaronw/ ww...') www/mahara/ external/ vendor/ phpunit/ phpunit/ PHPUnit/ Util/Fileloader .php(76) : PHPUnit_ Util_Fileloader ::load( '/home/ aaronw/ ww...') www/mahara/ external/ vendor/ phpunit/ phpunit/ PHPUnit/ TextUI/ Command. php(778) : PHPUnit_ Util_Fileloader ::checkAndLoad( '/home/ aaronw/ ww...') www/mahara/ external/ vendor/ phpunit/ phpunit/ PHPUnit/ TextUI/ Command. php(606) : PHPUnit_ TextUI_ Command- >handleBootstra p('/home/ aaro in /home/aaronw/ www/mahara/ htdocs/ lib/ddl. php on line 754
[DBG] ce (lib/dml.php:150) mysqli error: [1050: Table 'tst_blocktype_
[DBG] ce (lib/dml.php:150) id BIGINT(10) NOT NULL auto_increment,
[DBG] ce (lib/dml.php:150) block_instance BIGINT(10) NOT NULL,
[DBG] ce (lib/dml.php:150) tag VARCHAR(128) NOT NULL,
[DBG] ce (lib/dml.php:150) tagtype BIGINT(10) NOT NULL,
[DBG] ce (lib/dml.php:150) CONSTRAINT PRIMARY KEY (id)
[DBG] ce (lib/dml.php:150) )ENGINE=innodb, )
[DBG] ce (lib/dml.php:150) Command was: CREATE TABLE tst_blocktype_
[DBG] ce (lib/dml.php:150) id BIGINT(10) NOT NULL auto_increment,
[DBG] ce (lib/dml.php:150) block_instance BIGINT(10) NOT NULL,
[DBG] ce (lib/dml.php:150) tag VARCHAR(128) NOT NULL,
[DBG] ce (lib/dml.php:150) tagtype BIGINT(10) NOT NULL,
[DBG] ce (lib/dml.php:150) CONSTRAINT PRIMARY KEY (id)
[DBG] ce (lib/dml.php:150) )ENGINE=innodb
[DBG] ce (lib/ddl.php:753) Array
[DBG] ce (lib/ddl.php:753) (
[DBG] ce (lib/ddl.php:753) [0] => CREATE TABLE tst_blocktype_
[DBG] ce (lib/ddl.php:753) id BIGINT(10) NOT NULL auto_increment,
[DBG] ce (lib/ddl.php:753) block_instance BIGINT(10) NOT NULL,
[DBG] ce (lib/ddl.php:753) tag VARCHAR(128) NOT NULL,
[DBG] ce (lib/ddl.php:753) tagtype BIGINT(10) NOT NULL,
[DBG] ce (lib/ddl.php:753) CONSTRAINT PRIMARY KEY (id)
[DBG] ce (lib/ddl.php:753) )ENGINE=innodb
[DBG] ce (lib/ddl.php:753) )
[DBG] ce (lib/ddl.php:753)
PHP Fatal error: Uncaught exception 'SQLException' with message 'Failed to install (check logs for xmldb errors)' in /home/aaronw/
Stack trace:
#0 /home/aaronw/
#1 /home/aaronw/
#2 /home/aaronw/
#3 /home/aaronw/
#4 /home/aaronw/
#5 /home/aaronw/
#6 /home/aaronw/
Fatal error: Uncaught exception 'SQLException' with message 'Failed to install (check logs for xmldb errors)' in /home/aaronw/ www/mahara/ htdocs/ lib/ddl. php:754 www/mahara/ htdocs/ lib/upgrade. php(429) : install_ from_xmldb_ file('/ home/aaronw/ ww...') www/mahara/ htdocs/ lib/phpunit. php(173) : upgrade_ plugin( Object( stdClass) ) www/mahara/ htdocs/ lib/tests/ phpunit/ bootstrap. php(34) : UnitTestBootstr ap->install_ mahara( ) www/mahara/ external. ..
Stack trace:
#0 /home/aaronw/
#1 /home/aaronw/
#2 /home/aaronw/
#3 /home/aaronw/