jenkins-bot has submitted this change and it was merged.

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(-)

Approvals:
  Tim Starling: Looks good to me, approved
  jenkins-bot: Verified



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: merged
Gerrit-Change-Id: I9c4099cf4d3d38feecdbb6ac4fd4f154cb962868
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/WikimediaMaintenance
Gerrit-Branch: master
Gerrit-Owner: Tim Starling <tstarl...@wikimedia.org>
Gerrit-Reviewer: Tim Starling <tstarl...@wikimedia.org>
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