** Changed in: mahara
Status: New => Triaged
** Changed in: mahara
Importance: Undecided => Low
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: mahara-contributors
https://bugs.launchpad.net/bugs/2004512
Title:
phpunit is not uninstalling the previous db successfully
Status in Mahara:
Triaged
Bug description:
When running `make phpunit` multiple times it fails on the "Installing
Mahara" step. This looks to be because "Uninstalling site database"
is not actually doing the complete job.
Robert has noted:
I suspect its the same error/issue with behat as well - I believe it is due
to the fact that the uninstall uses the info in the install.xml files but not
all db logic is in those files via uninstall_from_xmldb_file()
- see htdocs/testing/classes/util.php drop_database()
there is some special case stuff in drop_database() so might need more of
that for certain tables.
The current workaround is to have a good db snapshot from before
running phpunit and restore it between runs.
This is what I get on subsequent runs:
gold@shipnet:~/Mahara/codereview ((b686cb1588...)) $ make phpunit
php htdocs/admin/cli/install.php --adminpassword=Kupuh1pa!
[email protected]
Xdebug: [Step Debug] Could not connect to debugging client. Tried:
localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(
Mahara is already installed.
Running phpunit tests...
Xdebug: [Step Debug] Could not connect to debugging client. Tried:
localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(
[INF] 09 (lib/phpunit.php:83) Stale test tables found, and drop option is
set. Dropping them before running tests
Uninstalling site database...
Done
[INF] 09 (lib/phpunit.php:85) Done
[INF] 09 (lib/phpunit.php:95) Installing Mahara
[INF] 09 (lib/phpunit.php:112) Installing core
[INF] 09 (lib/upgrade.php:1342) Enabled 3 HTML filters.
[INF] 09 (lib/phpunit.php:112) Installing firstcoredata
[INF] 09 (lib/phpunit.php:112) Installing artefact.comment
[INF] 09 (lib/phpunit.php:112) Installing artefact.file
.
.
.
[snip]
.
.
.
[INF] 09 (lib/phpunit.php:112) Installing blocktype.myfriends
[INF] 09 (lib/phpunit.php:112) Installing blocktype.annotation/annotation
PHP Fatal error: Uncaught SQLException: Failed to get a recordset: postgres9
error: [-5: ERROR: duplicate key value violates unique constraint
"tst_blocinst_nam_pk"
DETAIL: Key (name)=(annotation) already exists.] in EXECUTE("INSERT INTO
"tst_blocktype_installed" ("name", "version", "release", "artefactplugin")
VALUES (?, ?, ?, ?)")Command was: INSERT INTO "tst_blocktype_installed"
("name", "version", "release", "artefactplugin") VALUES (?, ?, ?, ?) and values
was
(name:annotation,version:2014122100,release:1.0.0,artefactplugin:annotation) in
/home/gold/Mahara/codereview/htdocs/lib/dml.php:1236
Stack trace:
#0 /home/gold/Mahara/codereview/htdocs/lib/upgrade.php(482): insert_record()
#1 /home/gold/Mahara/codereview/htdocs/lib/phpunit.php(126): upgrade_plugin()
#2 /home/gold/Mahara/codereview/htdocs/lib/tests/phpunit/bootstrap.php(34):
UnitTestBootstrap->install_mahara()
#3
/home/gold/Mahara/codereview/external/vendor/phpunit/phpunit/src/Util/FileLoader.php(66):
include_once('/home/gold/Maha...')
#4 /home/gold/Mahara/coderevi in
/home/gold/Mahara/codereview/htdocs/lib/dml.php on line 1236
Fatal error: Uncaught SQLException: Failed to get a recordset: postgres9
error: [-5: ERROR: duplicate key value violates unique constraint
"tst_blocinst_nam_pk"
DETAIL: Key (name)=(annotation) already exists.] in EXECUTE("INSERT INTO
"tst_blocktype_installed" ("name", "version", "release", "artefactplugin")
VALUES (?, ?, ?, ?)")Command was: INSERT INTO "tst_blocktype_installed"
("name", "version", "release", "artefactplugin") VALUES (?, ?, ?, ?) and values
was
(name:annotation,version:2014122100,release:1.0.0,artefactplugin:annotation) in
/home/gold/Mahara/codereview/htdocs/lib/dml.php:1236
Stack trace:
#0 /home/gold/Mahara/codereview/htdocs/lib/upgrade.php(482): insert_record()
#1 /home/gold/Mahara/codereview/htdocs/lib/phpunit.php(126): upgrade_plugin()
#2 /home/gold/Mahara/codereview/htdocs/lib/tests/phpunit/bootstrap.php(34):
UnitTestBootstrap->install_mahara()
#3
/home/gold/Mahara/codereview/external/vendor/phpunit/phpunit/src/Util/FileLoader.php(66):
include_once('/home/gold/Maha...')
#4 /home/gold/Mahara/coderevi in
/home/gold/Mahara/codereview/htdocs/lib/dml.php on line 1236
make: *** [Makefile:200: phpunit] Error 255
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/2004512/+subscriptions
_______________________________________________
Mailing list: https://launchpad.net/~mahara-contributors
Post to : [email protected]
Unsubscribe : https://launchpad.net/~mahara-contributors
More help : https://help.launchpad.net/ListHelp