Page MenuHomePhabricator

WikiPageTest::testDoDeleteArticle fails on PostgreSQL
Closed, ResolvedPublic

Description

WikiPageTest::testDoDeleteArticle, introduced gerrit change 6415, fails:

$ /usr/home/saper/bin/runphpunit.sh /usr/home/saper/public_html/pg/w/tests/phpunit/includes/WikiPageTest.php
PHPUnit 3.6.10 by Sebastian Bergmann.

Configuration read from /usr/home/saper/public_html/pg/w/tests/phpunit/suite.xml

..F................................................

Time: 4 seconds, Memory: 47.75Mb

There was 1 failure:

1) WikiPageTest::testDoDeleteArticle
pagelinks should contain no more links from the page
Failed asserting that 1 matches expected 0.

/usr/home/saper/public_html/pg/w/tests/phpunit/includes/WikiPageTest.php:142
/usr/home/saper/public_html/pg/w/tests/phpunit/MediaWikiTestCase.php:75
/usr/home/saper/public_html/pg/w/tests/phpunit/MediaWikiPHPUnitCommand.php:45
/usr/home/saper/public_html/pg/w/tests/phpunit/phpunit.php:103

FAILURES!
Tests: 51, Assertions: 90, Failures: 1.

See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=57724

Details

Reference
bz36759

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:28 AM
bzimport set Reference to bz36759.
bzimport added a subscriber: Unknown Object (MLST).

Looks like the deletion did not clean up pageslinks ? :-D

Isn't Page::doDeleteArticle() supposed to do the cleanup?

Are you running a master/slave setup? The pagelinks check is made against DB_SLAVE which might still be behind.

That certainly looks like a bug in the core software.

(In reply to comment #0)

WikiPageTest::testDoDeleteArticle, introduced Gerrit change #6415, fails:

Don't kill the messenger :)

If the test is correct but fails on some code, that means we found a bug in the code... Good thing we have the test, no?

I suggest to change the bug's description to read "doDeleteArticle() broken for PostGres".

This may be a transaction isolation problem... but then, that can just as well happen in production and needs to be addressed, no?

(In reply to comment #1)

Looks like the deletion did not clean up pageslinks ? :-D

Isn't Page::doDeleteArticle() supposed to do the cleanup?

Are you running a master/slave setup? The pagelinks check is made against
DB_SLAVE which might still be behind.

No, it's just a single machine running unit tests from the commandline.

(In reply to comment #2)

(In reply to comment #0)

WikiPageTest::testDoDeleteArticle, introduced Gerrit change #6415, fails:

Don't kill the messenger :)

Congratulations for making the effort to write unit tests for the most basic functionality of MediaWiki... I realized today that no unit test we've had before invoked Database::insertSelect method for example...

I suggest to change the bug's description to read "doDeleteArticle() broken for
PostGres".

Well it is not broken.. Doing steps from your test step-by-step in "maintenance/eval.php" does not cause any problem (and pagelinks are correctly empty after delete as this is done automatically via the database trigger).

I suppose this is the problem with the unit test setup we have - we copy tables but we don't copy indexes and we don't copy constraints and triggers.

minitest=# \d pagelinks

Table "mediawiki.pagelinks"
ColumnTypeModifiers
pl_fromintegernot null
pl_namespacesmallintnot null
pl_titletextnot null
Indexes:
    "pagelink_unique" UNIQUE, btree (pl_from, pl_namespace, pl_title)
    "pagelinks_title" btree (pl_title)
Foreign-key constraints:
    "pagelinks_pl_from_fkey" FOREIGN KEY (pl_from) REFERENCES page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED

minitest=# \d unittest_pagelinks
Table "mediawiki.unittest_pagelinks"

ColumnTypeModifiers
pl_fromintegernot null
pl_namespacesmallintnot null
pl_titletextnot null

minitest=#

Thanks Marcin! Lets focus on fixing bug 37702 so that should fix this one at the sametime.

I'm removing the milestone 1.20.0 as this only affects developers running the test suite and shouldn't block a release.

saper set Security to None.
Krinkle removed subscribers: Unknown Object (MLST), Krinkle.
Jdforrester-WMF subscribed.

Migrating from the old tracking task to a tag for PostgreSQL-related tasks.

Legoktm subscribed.

This test no longer fails on PostgreSQL, it must have been fixed at some point.