Tobias Gritschacher has submitted this change and it was merged.

Change subject: Experimental config switcher for WMF Jenkins jobs
......................................................................


Experimental config switcher for WMF Jenkins jobs

Wikibase would need a client and a server job that would let tweak the
default configuration settings.  I have created two Jenkins jobs that
launch the full PHPUnit file and named:

- mwext-Wikibase-client-tests
- mwext-Wikibase-server-tests

Jenkins provide the job name as the JOB_NAME environnement variable. One
can thus detect which job is being run and tweak the PHPUnit setting.
For the client job, we insert a `--exclude-group WikidataClient`.

This also includes an evil hack to populate the sites table since
there are some tests that require this.

Change-Id: Ide41a0b9003a9627f5a86c0514cc61d684b5e6aa
---
M Wikibase.php
1 file changed, 34 insertions(+), 3 deletions(-)

Approvals:
  Tobias Gritschacher: Verified; Looks good to me, approved



diff --git a/Wikibase.php b/Wikibase.php
index 1313a9f..e94a767 100644
--- a/Wikibase.php
+++ b/Wikibase.php
@@ -15,7 +15,6 @@
  * @licence GNU GPL v2+
  * @author Jeroen De Dauw < jeroended...@gmail.com >
  */
-
 define( 'WB_EXPERIMENTAL_FEATURES', true );
 
 require_once __DIR__ . '/Query/ExampleSettings.php';
@@ -24,7 +23,39 @@
 require_once __DIR__ . '/lib/WikibaseLib.php';
 require_once __DIR__ . '/repo/Wikibase.php';
 require_once __DIR__ . '/Query/WikibaseQuery.php';
-//require_once __DIR__ . '/client/WikibaseClient.php';
 
-//require_once __DIR__ . '/client/ExampleSettings.php';
 require_once __DIR__ . '/repo/ExampleSettings.php';
+
+// Temporary hack that populates the sites table since there are some tests 
that require this to have happened
+require_once __DIR__ . '/lib/maintenance/populateSitesTable.php';
+$wgExtensionFunctions[] = function() {
+       $evilStuff = new PopulateSitesTable();
+       $evilStuff->execute();
+};
+
+# Let JenkinsAdapt our test suite when run under Jenkins
+$jenkins_job_name = getenv( 'JOB_NAME' );
+if( PHP_SAPI === 'cli' && $jenkins_job_name !== false ) {
+
+       switch( $jenkins_job_name) {
+
+       case 'mwext-Wikibase-client-tests':
+       break;
+
+       case 'mwext-Wikibase-repo-tests':
+               # Pretends we asked PHPUnit to exclude WikidataClient group,
+               # this is done by inserting an --exclude-group option just 
after the
+               # command line.
+               $_SERVER['argv'] = array_merge(
+                       $_SERVER['argv'],
+                       array(
+                               '--group', 
'Diff,Ask,DataValueExtensions,Wikibase',
+                               '--exclude-group', 'WikibaseClient',
+                       )
+               );
+
+       break;
+       }
+}
+// Avoid polluting the global namespace
+unset( $jenkins_job_name, $cmd );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ide41a0b9003a9627f5a86c0514cc61d684b5e6aa
Gerrit-PatchSet: 19
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Hashar <has...@free.fr>
Gerrit-Reviewer: Hashar <has...@free.fr>
Gerrit-Reviewer: Jeroen De Dauw <jeroended...@gmail.com>
Gerrit-Reviewer: Tobias Gritschacher <tobias.gritschac...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to