Tim Starling has uploaded a new change for review.

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


Change subject: Add a script for fast integration testing during scap
......................................................................

Add a script for fast integration testing during scap

Change-Id: I9c4099cf4d3d38feecdbb6ac4fd4f154cb962868
---
A sanityCheck.php
1 file changed, 47 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikimediaMaintenance 
refs/changes/18/71318/1

diff --git a/sanityCheck.php b/sanityCheck.php
new file mode 100644
index 0000000..e6bd436
--- /dev/null
+++ b/sanityCheck.php
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Pre-deployment sanity check. 
+ *
+ * A quick integration test to be done during scap: execute a parser cache hit.
+ */
+
+// Use WikimediaCommandLine.inc instead of WikimediaMaintenance so that the 
code
+// can be parsed after the autoloader is started, so that we can have 
+// SanityCheckRequest in the same file as the execution code.
+require_once( __DIR__ . '/WikimediaCommandLine.inc' );
+
+class SanityCheckRequest extends FauxRequest {
+       var $title;
+
+       function __construct() {
+               $this->title = Title::newMainPage();
+
+               parent::__construct( array(
+                       'title' => $this->title->getPrefixedDBkey()
+               ) );
+       }
+
+       function getRequestURL() {
+               return $this->title->getFullURL( '', false, PROTO_CANONICAL );
+       }
+}
+
+function doSanityCheck() {
+       $req = new SanityCheckRequest;
+       $context = new RequestContext;
+       $context->setRequest( $req );
+       $main = new MediaWiki( $context );
+       ob_start();
+       $main->run();
+       $result = ob_get_contents();
+       ob_end_clean();
+
+       if ( strpos( $result, '<!-- Served by' ) !== false ) {
+               exit( 0 );
+       } else {
+               echo "sanityCheck.php failed string match test\n";
+               exit( 1 );
+       }
+}
+
+doSanityCheck();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9c4099cf4d3d38feecdbb6ac4fd4f154cb962868
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaMaintenance
Gerrit-Branch: master
Gerrit-Owner: Tim Starling <[email protected]>

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

Reply via email to