Page MenuHomePhabricator

CheckUser test failures when using postgres DB
Closed, ResolvedPublic1 Estimated Story Points

Description

Some of the CheckUser extension tests fail when using a postgres DB. The failing tests are from https://integration.wikimedia.org/ci/job/quibble-vendor-postgres-php74-noselenium/2/console and are listed below:

17:09:54 1) MediaWiki\CheckUser\Tests\Integration\CheckUser\Pagers\CheckUserGetIPsPagerTest::testGetCountForIPActionsPerTableWithStartOffset
17:09:54 Wikimedia\Rdbms\DBQueryError: Error 22008: ERROR:  timestamp out of range: "20230405060709"
17:09:54 LINE 1: ...((cuc_only_for_read_old = 0 AND (cuc_timestamp >= '202304050...
17:09:54                                                              ^
17:09:54 
17:09:54 Function: MediaWiki\CheckUser\CheckUser\Pagers\CheckUserGetIPsPager::getCountForIPActionsPerTable
17:09:54 Query: EXPLAIN SELECT  *  FROM "unittest_cu_changes"    WHERE ((cuc_only_for_read_old = 0 AND (cuc_timestamp >= '20230405060709' AND cuc_ip_hex = '7F000001')))  
17:09:54 
17:09:54 
17:09:54 /workspace/src/includes/libs/rdbms/database/Database.php:1203
17:09:54 /workspace/src/includes/libs/rdbms/database/Database.php:1187
17:09:54 /workspace/src/includes/libs/rdbms/database/Database.php:1161
17:09:54 /workspace/src/includes/libs/rdbms/database/Database.php:652
17:09:54 /workspace/src/includes/libs/rdbms/database/Database.php:1350
17:09:54 /workspace/src/includes/libs/rdbms/database/DatabasePostgres.php:305
17:09:54 /workspace/src/includes/libs/rdbms/database/DBConnRef.php:119
17:09:54 /workspace/src/includes/libs/rdbms/database/DBConnRef.php:375
17:09:54 /workspace/src/includes/libs/rdbms/querybuilder/SelectQueryBuilder.php:804
17:09:54 /workspace/src/extensions/CheckUser/src/CheckUser/Pagers/CheckUserGetIPsPager.php:207
17:09:54 /workspace/src/vendor/wikimedia/testing-access-wrapper/src/TestingAccessWrapper.php:114
17:09:54 /workspace/src/extensions/CheckUser/tests/phpunit/integration/CheckUser/Pagers/CheckUserGetIPsPagerTest.php:183
17:09:54 phpvfscomposer:///workspace/src/vendor/phpunit/phpunit/phpunit:106
....
17:09:54 There were 11 failures:
17:09:54 
17:09:54 1) MediaWiki\CheckUser\Tests\Integration\Services\CheckUserInsertTest::testInsertIntoCuChangesTable with data set "Default values on empty row" (array(), array('cuc_ip', 'cuc_ip_hex', 'cuc_xff', 'cuc_xff_hex', 'cuc_page_id', 'cuc_namespace', 'cuc_minor', 'cuc_title', 'cuc_actiontext', 'cuc_this_oldid', 'cuc_last_oldid', 'cuc_type', 'cuc_agent', 'cuc_timestamp'), array('127.0.0.1', '7F000001', '', null, 0, 0, 0, '', '', 0, 0, 3, '', '20240506070809'))
17:09:54 row #1 mismatches
17:09:54 Failed asserting that two arrays are equal.
17:09:54 --- Expected
17:09:54 +++ Actual
17:09:54 @@ @@
17:09:54      1 => '7F000001'
17:09:54      2 => ''
17:09:54      3 => null
17:09:54 -    4 => 0
17:09:54 -    5 => 0
17:09:54 -    6 => 0
17:09:54 +    4 => '0'
17:09:54 +    5 => '0'
17:09:54 +    6 => '0'
17:09:54      7 => ''
17:09:54      8 => ''
17:09:54 -    9 => 0
17:09:54 -    10 => 0
17:09:54 -    11 => 3
17:09:54 +    9 => '0'
17:09:54 +    10 => '0'
17:09:54 +    11 => '3'
17:09:54      12 => ''
17:09:54 -    13 => '20240506070809'
17:09:54 +    13 => '2024-05-06 07:08:09+00'
17:09:54  )
17:09:54 
17:09:54 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:2304
17:09:54 /workspace/src/extensions/CheckUser/tests/phpunit/integration/Services/CheckUserInsertTest.php:43
17:09:54 phpvfscomposer:///workspace/src/vendor/phpunit/phpunit/phpunit:106
17:09:54 
17:09:54 2) MediaWiki\CheckUser\Tests\Integration\Services\CheckUserInsertTest::testInsertIntoCuPrivateEventTable with data set "Default values on empty row" (array(), array('cupe_ip', 'cupe_ip_hex', 'cupe_xff', 'cupe_xff_hex', 'cupe_page', 'cupe_namespace', 'cupe_log_type', 'cupe_log_action', 'cupe_title', 'cupe_params', 'cupe_agent', 'cupe_timestamp'), array('127.0.0.1', '7F000001', '', null, 0, 0, 'checkuser-private-event', '', '', 'a:0:{}', '', '20240506070809'))
17:09:54 row #1 mismatches
17:09:54 Failed asserting that two arrays are equal.
17:09:54 --- Expected
17:09:54 +++ Actual
17:09:54 @@ @@
17:09:54      1 => '7F000001'
17:09:54      2 => ''
17:09:54      3 => null
17:09:54 -    4 => 0
17:09:54 -    5 => 0
17:09:54 +    4 => '0'
17:09:54 +    5 => '0'
17:09:54      6 => 'checkuser-private-event'
17:09:54      7 => ''
17:09:54      8 => ''
17:09:54      9 => 'a:0:{}'
17:09:54      10 => ''
17:09:54 -    11 => '20240506070809'
17:09:54 +    11 => '2024-05-06 07:08:09+00'
17:09:54  )
17:09:54 
17:09:54 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:2304
17:09:54 /workspace/src/extensions/CheckUser/tests/phpunit/integration/Services/CheckUserInsertTest.php:75
17:09:54 phpvfscomposer:///workspace/src/vendor/phpunit/phpunit/phpunit:106
17:09:54 
17:09:54 3) MediaWiki\CheckUser\Tests\Integration\Services\CheckUserInsertTest::testInsertIntoCuLogEventTable with data set "Default values" (array('cule_ip', 'cule_ip_hex', 'cule_xff', 'cule_xff_hex', 'cule_agent', 'cule_timestamp'), array('127.0.0.1', '7F000001', '', null, '', '20240506070809'))
17:09:54 row #1 mismatches
17:09:54 Failed asserting that two arrays are equal.
17:09:54 --- Expected
17:09:54 +++ Actual
17:09:54 @@ @@
17:09:54      2 => ''
17:09:54      3 => null
17:09:54      4 => ''
17:09:54 -    5 => '20240506070809'
17:09:54 +    5 => '2024-05-06 07:08:09+00'
17:09:54  )
17:09:54 
17:09:54 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:2304
17:09:54 /workspace/src/extensions/CheckUser/tests/phpunit/integration/Services/CheckUserInsertTest.php:114
17:09:54 phpvfscomposer:///workspace/src/vendor/phpunit/phpunit/phpunit:106

Event Timeline

Change #1017885 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/CheckUser@master] Fix tests to use correct timestamp format when on postgres DB

https://gerrit.wikimedia.org/r/1017885

Change #1017885 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Fix tests to use correct timestamp format when on postgres DB

https://gerrit.wikimedia.org/r/1017885