(bug 43762) Mark slow unit test as @group medium
authorBrad Jorsch <bjorsch@wikimedia.org>
Fri, 18 Jan 2013 19:02:28 +0000 (14:02 -0500)
committerBrad Jorsch <bjorsch@wikimedia.org>
Fri, 18 Jan 2013 19:07:49 +0000 (14:07 -0500)
All tests based on APITestCase can be slow. I've also seen more than one
Jenkins failure due to GlobalTest::testMerge timing out.

Also, added a meta-test on APITestCase to make sure that all its
subclasses are marked with @group medium or @group large, to prevent new
tests from re-causing the bug.

Change-Id: I48630736a3d06574876fd1fa3d90899cfbc48012

tests/phpunit/includes/GlobalFunctions/GlobalTest.php
tests/phpunit/includes/api/ApiAccountCreationTest.php
tests/phpunit/includes/api/ApiBlockTest.php
tests/phpunit/includes/api/ApiParseTest.php
tests/phpunit/includes/api/ApiPurgeTest.php
tests/phpunit/includes/api/ApiQueryRevisionsTest.php
tests/phpunit/includes/api/ApiQueryTest.php
tests/phpunit/includes/api/ApiTest.php
tests/phpunit/includes/api/ApiTestCase.php
tests/phpunit/includes/api/ApiWatchTest.php
tests/phpunit/includes/api/format/ApiFormatPhpTest.php

index 0dc18a2..1a02cb8 100644 (file)
@@ -496,6 +496,7 @@ class GlobalTest extends MediaWikiTestCase {
         * @param String $expectedText: Text after merge has been completed
         *
         * @dataProvider provideMerge()
+        * @group medium
         */
        public function testMerge( $old, $mine, $yours, $expectedMergeResult, $expectedText ) {
                $this->checkHasDiff3();
index a764e9d..80f41e2 100644 (file)
@@ -3,6 +3,7 @@
 /**
  * @group Database
  * @group API
+ * @group medium
  */
 class ApiCreateAccountTest extends ApiTestCase {
        function setUp() {
index 52f1d28..dd4d598 100644 (file)
@@ -3,6 +3,7 @@
 /**
  * @group API
  * @group Database
+ * @group medium
  */
 class ApiBlockTest extends ApiTestCase {
 
index b5dabf0..93ff24a 100644 (file)
@@ -3,6 +3,7 @@
 /**
  * @group API
  * @group Database
+ * @group medium
  */
 class ApiParseTest extends ApiTestCase {
 
index d903714..3ab77fd 100644 (file)
@@ -3,6 +3,7 @@
 /**
  * @group API
  * @group Database
+ * @group medium
  */
 class ApiPurgeTest extends ApiTestCase {
 
index 28dcb97..19da81c 100644 (file)
@@ -3,6 +3,7 @@
 /**
  * @group API
  * @group Database
+ * @group medium
  */
 class ApiQueryRevisionsTest extends ApiTestCase {
 
index dbf02f7..1b1886e 100644 (file)
@@ -3,6 +3,7 @@
 /**
  * @group API
  * @group Database
+ * @group medium
  */
 class ApiQueryTest extends ApiTestCase {
 
index a1b941d..2f2f5f9 100644 (file)
@@ -3,6 +3,7 @@
 /**
  * @group API
  * @group Database
+ * @group medium
  */
 class ApiTest extends ApiTestCase {
 
index 7e054a4..fcd581a 100644 (file)
@@ -147,6 +147,17 @@ abstract class ApiTestCase extends MediaWikiLangTestCase {
                        'prop' => 'info' ), $session, false, $user->user );
                return $data;
        }
+
+       public function testApiTestGroup() {
+               $groups = PHPUnit_Util_Test::getGroups( get_class( $this ) );
+               $constraint = PHPUnit_Framework_Assert::logicalOr(
+                       $this->contains( 'medium' ),
+                       $this->contains( 'large' )
+               );
+               $this->assertThat( $groups, $constraint,
+                       'ApiTestCase::setUp can be slow, tests must be "medium" or "large"'
+               );
+       }
 }
 
 class UserWrapper {
index b7ae292..4fecec0 100644 (file)
@@ -3,6 +3,7 @@
 /**
  * @group API
  * @group Database
+ * @group medium
  * @todo This test suite is severly broken and need a full review
  */
 class ApiWatchTest extends ApiTestCase {
index 8209f59..d34e799 100644 (file)
@@ -3,6 +3,7 @@
 /**
  * @group API
  * @group Database
+ * @group medium
  */
 class ApiFormatPhpTest extends ApiFormatTestBase {