jenkins-bot has submitted this change and it was merged.

Change subject: Insert test page into DB not to violate constraint
......................................................................


Insert test page into DB not to violate constraint

Page with id 0 does not exist at the time transaction
is committed to the database.

Unit tests with table constraints enabled
fail with:

1) RevisionStorageTest::testUserWasLastToEdit with data set #0 (3, true)
DBQueryError: A database error has occurred. Did you forget to run
maintenance/update.php after upgrading?  See:
https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script
Query: INSERT INTO "unittest_revision"
(rev_id,rev_page,rev_text_id /* more fields */ )
VALUES ('461','0','460' /* more fields */
Function: Revision::insertOn
Error: 23503 ERROR:  insert or update on table "unittest_revision"
violates foreign key constraint "ut_revision_rev_page_fkey"
DETAIL:  Key (rev_page)=(0) is not present in table "unittest_page".

/usr/home/saper/test/mytest/includes/db/Database.php:1111
/usr/home/saper/test/mytest/includes/db/DatabasePostgres.php:511
/usr/home/saper/test/mytest/includes/db/Database.php:1077
/usr/home/saper/test/mytest/includes/db/DatabasePostgres.php:871
/usr/home/saper/test/mytest/includes/Revision.php:1422
/usr/home/saper/test/mytest/tests/phpunit/includes/RevisionStorageTest.php:488
/usr/home/saper/test/mytest/tests/phpunit/MediaWikiTestCase.php:123
/usr/home/saper/test/mytest/tests/phpunit/MediaWikiPHPUnitCommand.php:80
/usr/home/saper/test/mytest/tests/phpunit/MediaWikiPHPUnitCommand.php:64
/usr/home/saper/test/mytest/tests/phpunit/phpunit.php:115

Change-Id: I653a8bccdaa748a9bea453cd1dbf609a30e1ff6f
---
M tests/phpunit/includes/RevisionStorageTest.php
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  IAlex: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/phpunit/includes/RevisionStorageTest.php 
b/tests/phpunit/includes/RevisionStorageTest.php
index 7e275a5..cd2a23a 100644
--- a/tests/phpunit/includes/RevisionStorageTest.php
+++ b/tests/phpunit/includes/RevisionStorageTest.php
@@ -474,6 +474,7 @@
                // create revisions -----------------------------
                $page = WikiPage::factory( Title::newFromText(
                        'RevisionStorageTest_testUserWasLastToEdit', $ns ) );
+               $page->insertOn( $dbw );
 
                # zero
                $revisions[0] = new Revision( array(

-- 
To view, visit https://gerrit.wikimedia.org/r/100154
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I653a8bccdaa748a9bea453cd1dbf609a30e1ff6f
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: saper <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: IAlex <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-Reviewer: saper <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to