Page MenuHomePhabricator

Flaky unit test "TemplateCategoriesTest::testTemplateCategories"
Open, LowPublic

Description

This test has been failing intermittently for the past few weeks.

https://integration.wikimedia.org/ci/job/mediawiki-phpunit-php55-trusty/4720/console

00:06:06.242 There was 1 failure:
00:06:06.242 
00:06:06.242 1) TemplateCategoriesTest::testTemplateCategories
00:06:06.242 Verify that the page is no longer in the category after template deletion
00:06:06.242 Failed asserting that two arrays are equal.
00:06:06.243 --- Expected
00:06:06.243 +++ Actual
00:06:06.243 @@ @@
00:06:06.243  Array (
00:06:06.243 +    'Category:Solved_bugs_2' => 'Categorized from template'
00:06:06.243  )
00:06:06.243 
00:06:06.243 /home/jenkins/workspace/mediawiki-phpunit-php55-trusty/src/tests/phpunit/includes/TemplateCategoriesTest.php:93
00:06:06.243 /home/jenkins/workspace/mediawiki-phpunit-php55-trusty/src/tests/phpunit/MediaWikiTestCase.php:402
00:06:06.243 /home/jenkins/workspace/mediawiki-phpunit-php55-trusty/src/maintenance/doMaintenance.php:111

The test suite itself has not been modified in years, so it's likely an indirect problem caused by a behaviour change in JobQueue, which it uses. The problem is basically that it makes an edit, and observes that a page becomes a member of a certain category. Since this logic is deferred through jobs, it needs to force a job queue run, which doesn't seem to work consistently.

https://github.com/wikimedia/mediawiki/blob/master/tests/phpunit/includes/TemplateCategoriesTest.php

		$title = Title::newFromText( "Categorized from template" );
		$page = WikiPage::factory( $title );
		$page->doEditContent( .. );

		$template = WikiPage::factory( Title::newFromText( 'Template:Categorising template' ) );
		$template->doEditContent( .. );

		// Run the job queue
		JobQueueGroup::destroySingletons();
		$jobs = new RunJobs;
		$jobs->loadParamsAndArgs( null, [ 'quiet' => true ], null );
		$jobs->execute();

		// Make sure page is in the category
		$this->assertEquals(
			[ .. ],
			$title->getParentCategories()
		);

@aaron Any ideas perhaps?

Event Timeline

Krinkle created this task.May 11 2017, 9:06 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 11 2017, 9:06 PM

Change 354669 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] Disable broken TemplateCategoriesTest unit test

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

Change 354669 merged by jenkins-bot:
[mediawiki/core@master] Disable broken TemplateCategoriesTest unit test

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

Krinkle moved this task from Inbox to PHPUnit on the MediaWiki-Core-Testing board.Jul 7 2017, 5:01 AM
mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:10 PM
Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptAug 28 2019, 11:10 PM
Krinkle changed the subtype of this task from "Production Error" to "Task".