Hashar has uploaded a new change for review.

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

Change subject: tests: stop updating the search engine
......................................................................

tests: stop updating the search engine

While running the includes/api/ tests, I noticed in profiling that the
tests are doing almost a hundred of inserts followed by a hundred of
matching deletes.

For almost all tests, there is no need to update the search engine, that
is a waste of I/O and CPU cycles.

To speed up the test run, make phpunit.php setup phase to point to a
dummy search engine by setting:

 $wgSearchType = 'SearchEngineDummy';

Which is a noop class.

I left a comment as a hint for people willing to actually test search
engine operations:

    // To actually trigger updates to a search engine one will have
    // to set
    // the global such as:
    //
    //     $this->setMwGlobals( array(
    //         'wgSearchType' => $searchType
    //     ) );
    //
    // See tests/phpunit/includes/search/SearchEngineTest.php

Change-Id: Ic10e989e27fd3901ea215f544a0490baef57f0a4
---
M tests/phpunit/phpunit.php
1 file changed, 14 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/60/247560/1

diff --git a/tests/phpunit/phpunit.php b/tests/phpunit/phpunit.php
index cd06d88..d4a43c1 100755
--- a/tests/phpunit/phpunit.php
+++ b/tests/phpunit/phpunit.php
@@ -71,7 +71,7 @@
                parent::finalSetup();
 
                global $wgMainCacheType, $wgMessageCacheType, 
$wgParserCacheType, $wgMainWANCache;
-               global $wgLanguageConverterCacheType, $wgUseDatabaseMessages;
+               global $wgLanguageConverterCacheType, $wgUseDatabaseMessages, 
$wgSearchType;
                global $wgLocaltimezone, $wgLocalisationCacheConf;
                global $wgDevelopmentWarnings;
 
@@ -99,6 +99,19 @@
 
                $wgUseDatabaseMessages = false; # Set for future resets
 
+               // Do not bother updating search tables
+               //
+               // To actually trigger updates to a search engine one will have 
to set
+               // the global such as:
+               //
+               //     $this->setMwGlobals( array(
+               //         'wgSearchType' => $searchType
+               //     ) );
+               //
+               // See tests/phpunit/includes/search/SearchEngineTest.php
+               //
+               $wgSearchType = 'SearchEngineDummy';
+
                // Assume UTC for testing purposes
                $wgLocaltimezone = 'UTC';
 

-- 
To view, visit https://gerrit.wikimedia.org/r/247560
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic10e989e27fd3901ea215f544a0490baef57f0a4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to