Page MenuHomePhabricator

BlueSpiceFoundation: BSApiInterwikiStoreTest > NOT NULL constraint failed: unittest_interwiki.iw_api (sqlite issue?)
Closed, ResolvedPublic

Description

On a dummy change for BlueSpiceSkin ( https://gerrit.wikimedia.org/r/c/mediawiki/skins/BlueSpiceSkin/+/323201 ), commenting check experimental runs a Quibble job that fails with:

Wikimedia\Rdbms\DBQueryError from line 1443 of includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading? 
Query: INSERT  INTO unittest_interwiki (iw_prefix,iw_url,iw_local) VALUES ('Dummy','http://wiki.dummy.org/$1','1')
Function: Wikimedia\Rdbms\DatabaseSqlite::insert/single-row
Error: 19 NOT NULL constraint failed: unittest_interwiki.iw_api

Backtrace:
#0 includes/libs/rdbms/database/Database.php(1413): Wikimedia\Rdbms\Database->makeQueryException(string, integer, string, string)
#1 includes/libs/rdbms/database/Database.php(1186): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#2 includes/libs/rdbms/database/Database.php(2010): Wikimedia\Rdbms\Database->query(string, string)
#3 includes/libs/rdbms/database/DatabaseSqlite.php(647): Wikimedia\Rdbms\Database->insert(string, array, string, string)
#4 extensions/BlueSpiceFoundation/tests/phpunit/Api/BSApiInterwikiStoreTest.php(46): Wikimedia\Rdbms\DatabaseSqlite->insert(string, array)
#5 extensions/BlueSpiceFoundation/tests/phpunit/BSApiExtJSStoreTestBase.php(30): BlueSpice\Tests\Api\BSApiInterwikiStoreTest->createStoreFixtureData()
#6 tests/phpunit/MediaWikiTestCase.php(462): BlueSpice\Tests\BSApiExtJSStoreTestBase->addDBDataOnce()
#7 vendor/phpunit/phpunit/src/Framework/TestSuite.php(755): MediaWikiTestCase->run(PHPUnit\Framework\TestResult)
#8 vendor/phpunit/phpunit/src/Framework/TestSuite.php(755): PHPUnit\Framework\TestSuite->run(PHPUnit\Framework\TestResult)
#9 vendor/phpunit/phpunit/src/Framework/TestSuite.php(755): PHPUnit\Framework\TestSuite->run(PHPUnit\Framework\TestResult)
#10 vendor/phpunit/phpunit/src/Framework/TestSuite.php(755): PHPUnit\Framework\TestSuite->run(PHPUnit\Framework\TestResult)
#11 vendor/phpunit/phpunit/src/TextUI/TestRunner.php(546): PHPUnit\Framework\TestSuite->run(PHPUnit\Framework\TestResult)
#12 vendor/phpunit/phpunit/src/TextUI/Command.php(195): PHPUnit\TextUI\TestRunner->doRun(PHPUnit\Framework\TestSuite, array, boolean)
#13 vendor/phpunit/phpunit/src/TextUI/Command.php(148): PHPUnit\TextUI\Command->run(array, boolean)
#14 tests/phpunit/phpunit.php(134): PHPUnit\TextUI\Command::main()
#15 maintenance/doMaintenance.php(94): PHPUnitMaintClass->execute()
#16 tests/phpunit/phpunit.php(173): require(string)
#17 {main}

The insert statement does:

FieldValue
iw_prefix'Dummy'
iw_url'http://wiki.dummy.org/$1'
iw_local'1'

And the schema in mediawiki/core shows that none of the interwiki table fields accepts null values:

maintenance/tables.sql
CREATE TABLE /*_*/interwiki (
  -- The interwiki prefix, (e.g. "Meatball", or the language prefix "de")
  iw_prefix varchar(32) NOT NULL,

  -- The URL of the wiki, with "$1" as a placeholder for an article name.
  -- Any spaces in the name will be transformed to underscores before
  -- insertion.
  iw_url blob NOT NULL,

  -- The URL of the file api.php
  iw_api blob NOT NULL,

  -- The name of the database (for a connection to be established with LBFactory::getMainLB( 'wikiid' ))
  iw_wikiid varchar(64) NOT NULL,

  -- A boolean value indicating whether the wiki is in this project
  -- (used, for example, to detect redirect loops)
  iw_local bool NOT NULL,

  -- Boolean value indicating whether interwiki transclusions are allowed.
  iw_trans tinyint NOT NULL default 0
) /*$wgDBTableOptions*/;

Note the job used SQLite. I thought the issue could be due MariaDB set with sql_mode = 'TRADITIONAL' ( T119371 ) which causes an error when previously it was just a warning.

Details

Related Gerrit Patches:
mediawiki/extensions/BlueSpiceFoundation : masterFix unit test for quibble

Event Timeline

hashar renamed this task from BlueSpiceSkin: NOT NULL constraint failed: unittest_interwiki.iw_api to BlueSpiceSkin: NOT NULL constraint failed: unittest_interwiki.iw_api (sqlite issue?).Jun 21 2018, 2:02 PM
hashar triaged this task as Normal priority.
hashar created this task.
hashar updated the task description. (Show Details)
hashar renamed this task from BlueSpiceSkin: NOT NULL constraint failed: unittest_interwiki.iw_api (sqlite issue?) to BlueSpiceFoundation: BSApiInterwikiStoreTest > NOT NULL constraint failed: unittest_interwiki.iw_api (sqlite issue?).Jun 21 2018, 2:09 PM
hashar added a project: SQLite.

So that is an issue in BlueSpiceFoundation test tests/phpunit/Api/BSApiInterwikiStoreTest.php. It passes fine with MariaDB/Mysql but fails on SQLite

Change 441392 had a related patch set uploaded (by Robert Vogel; owner: Robert Vogel):
[mediawiki/extensions/BlueSpiceFoundation@master] Fix unit test for quibble

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

The test jobs are using mysql, to trigger the one using sqlite one just have to comment check experimental in Gerrit. I did so on https://gerrit.wikimedia.org/r/c/mediawiki/extensions/BlueSpiceFoundation/+/441392 , we will see whether the job pass :]

Though, if there is no interest with SQLite we can just remove those jenkins jobs. If there is any interest we can add the sqlite job in addition of the mysql one.

I've merged the change.

I'd prefer to also have SQLite tested. We do want to support that.

Osnard closed this task as Resolved.Jun 25 2018, 6:18 AM

Change 441392 merged by jenkins-bot:
[mediawiki/extensions/BlueSpiceFoundation@master] Fix unit test for quibble

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

Vvjjkkii renamed this task from BlueSpiceFoundation: BSApiInterwikiStoreTest > NOT NULL constraint failed: unittest_interwiki.iw_api (sqlite issue?) to 0iaaaaaaaa.Jul 1 2018, 1:02 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii removed Osnard as the assignee of this task.
Vvjjkkii raised the priority of this task from Normal to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed subscribers: gerritbot, Aklapper.
CommunityTechBot renamed this task from 0iaaaaaaaa to BlueSpiceFoundation: BSApiInterwikiStoreTest > NOT NULL constraint failed: unittest_interwiki.iw_api (sqlite issue?).Jul 2 2018, 11:25 AM
CommunityTechBot closed this task as Resolved.
CommunityTechBot assigned this task to Osnard.
CommunityTechBot lowered the priority of this task from High to Normal.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added subscribers: gerritbot, Aklapper.