Last modified: 2013-12-05 09:51:46 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T59976, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 57976 - API unit tests assume repeatable ordering of output
API unit tests assume repeatable ordering of output
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.23.0
All All
: Unprioritized minor (vote)
: ---
Assigned To: Nobody - You can work on this!
: easy
Depends on:
Blocks: postgres 39236
  Show dependency treegraph
 
Reported: 2013-12-04 12:45 UTC by Marcin Cieślak
Modified: 2013-12-05 09:51 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Marcin Cieślak 2013-12-04 12:45:08 UTC
When testing on PostgreSQL:

3) ApiQueryBasicTest::testGenerator
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'AQBT-All'
+'AQBT-Categories'

/usr/home/saper/test/mytest/tests/phpunit/includes/api/query/ApiQueryTestBase.php:143
/usr/home/saper/test/mytest/tests/phpunit/includes/api/query/ApiQueryTestBase.php:141
/usr/home/saper/test/mytest/tests/phpunit/includes/api/query/ApiQueryTestBase.php:141
/usr/home/saper/test/mytest/tests/phpunit/includes/api/query/ApiQueryTestBase.php:141
/usr/home/saper/test/mytest/tests/phpunit/includes/api/query/ApiQueryTestBase.php:105
/usr/home/saper/test/mytest/tests/phpunit/includes/api/query/ApiQueryTestBase.php:100
/usr/home/saper/test/mytest/tests/phpunit/includes/api/query/ApiQueryBasicTest.php:299
/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:119

Looks like that list of pages returned by API is okay, only the order is different:
Request: generator=links&titles=AQBT-Links&action=query

Expected:
Array
(
    [query] => Array
        (
            [pages] => Array
                (
                    [1] => Array
                        (
                            [pageid] => 1
                            [ns] => 0
                            [title] => AQBT-All
                        )

                    [2] => Array
                        (
                            [pageid] => 2
                            [ns] => 0
                            [title] => AQBT-Categories
                        )

                    [4] => Array
                        (
                            [pageid] => 4
                            [ns] => 0
                            [title] => AQBT-Templates
                        )

                )

        )

)

Result:
Array
(
    [query] => Array
        (
            [pages] => Array
                (
                    [109] => Array
                        (
                            [pageid] => 109
                            [ns] => 0
                            [title] => AQBT-Categories
                        )

                    [108] => Array
                        (
                            [pageid] => 108
                            [ns] => 0
                            [title] => AQBT-All
                        )

                    [111] => Array
                        (
                            [pageid] => 111
                            [ns] => 0
                            [title] => AQBT-Templates
                        )

                )

        )

)


Not sure if order of page titles returned by API should be guaranteed? Should we test for it?
Comment 1 Brad Jorsch 2013-12-04 17:03:56 UTC
I suspect that the rewrite of the assertResult function in Gerrit change #99156 may have fixed this too. Could you check that?
Comment 2 Marcin Cieślak 2013-12-05 09:40:11 UTC
Yes, gerrit charge 99156 made output of all seven tests of tests/phpunit/includes/api/query/ApiQueryBasicTest.php suspiciously green :)
Comment 3 Marcin Cieślak 2013-12-05 09:51:46 UTC
Thanks for quick action!

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links