Last modified: 2014-10-06 06:56:21 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T45266, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 43266 - Write and implement tests for Wikimedia's Apache configuration (redirects.conf, etc.)
Write and implement tests for Wikimedia's Apache configuration (redirects.con...
Status: NEW
Product: Wikimedia
Classification: Unclassified
Continuous integration (Other open bugs)
unspecified
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on: 45499
Blocks: 48407
  Show dependency treegraph
 
Reported: 2012-12-19 15:27 UTC by Antoine "hashar" Musso (WMF)
Modified: 2014-10-06 06:56 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Antoine "hashar" Musso (WMF) 2012-12-19 15:27:09 UTC
Whenever changing our Apaches configuration, we want to run integration tests to make sure nothing is going to broke.  The repo is operations/apaches-config.git

Jeff Green has written a test suite that is sitting somewhere on the cluster.

Tim Starling posted on https://gerrit.wikimedia.org/r/#/c/15720/ a way to test our Apache configurations:

I tested redirects.conf with apache itself:
redirect-test-server.sh:
#!/bin/bash
apache2 -d . \
    -f redirect-test.conf \
    -X
redirect-test.conf:
# vim: syn=apache
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
Listen 8080
ErrorLog /dev/stderr
PidFile apache2.pid
NameVirtualHost *
<VirtualHost *>
    ServerName default
    DocumentRoot /nonexistent
</VirtualHost>
Include redirects.conf
redirect-test.php
<?php
while (( $line = readline( '> ' ) ) !== false ) {
    $url = trim( $line );
    if ( !preg_match( '/^http:\/\//', $url ) ) {
        $url = 'http://' . $url;
    }
    $c = curl_init( $url );
    curl_setopt_array( $c, array(
        CURLOPT_HEADER => true,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_PROXY => 'localhost:8080',
    ) );
    $result = curl_exec( $c );
    $info = curl_getinfo( $c );
    if ( $info['http_code'] == 301 || $info['http_code'] == 302 ) {
        $m = false;
        preg_match( '/Location: (.*)\\n/', $result, $m );
        echo "-> {$m[1]}\n";
    } else {
        echo $info['http_code'] . "\n";
    }
    readline_add_history( $line );
}


We could use a vagrant machine to load the Apache conf and then run the above script.
Comment 1 Antoine "hashar" Musso (WMF) 2013-05-13 16:23:27 UTC
This is mostly waiting for Vagrant in Jenkins. Maybe that can be the first candidate.
Comment 2 Sam Reed (reedy) 2013-10-22 20:47:56 UTC
https://gerrit.wikimedia.org/r/#/c/15720 doesn't work...


FYI, I added a list of Main Page urls to all special wikis, and all english project homepages too at [operations/mediawiki-config.git] / tests / urls.txt
Comment 3 MZMcBride 2014-01-20 21:05:05 UTC
I assume this bug covers redirects.conf (<https://noc.wikimedia.org/conf/redirects.conf>)?

Let's do this!
Comment 4 Tim Landscheidt 2014-01-20 21:32:23 UTC
For the Toolserver redirects to come, I wrote Gerrit change #108467 if that's useful for this bug.
Comment 5 Tim Landscheidt 2014-01-20 23:44:26 UTC
BTW, this should be possible without Vagrant: Define a convention to determine two port numbers per Jenkins job, patch the Apache configuration like it is already in operations-apache-config.yaml to set up a http server on $PORT1 and a https server on $PORT2, start Apache, run the tests, stop Apache, release the locks/whatever for the ports.  The tests should be in the operations/apache-config itself so they can be updated in parallel to the configuration.
Comment 6 Tim Landscheidt 2014-01-21 17:08:58 UTC
Just found https://wiki.jenkins-ci.org/display/JENKINS/Port+Allocator+Plugin.  Antoine, could this be installed in Jenkins please?
Comment 7 Gerrit Notification Bot 2014-01-22 02:12:30 UTC
Change 108880 had a related patch set uploaded by Tim Landscheidt:
WIP: Add test suite

https://gerrit.wikimedia.org/r/108880
Comment 8 Antoine "hashar" Musso (WMF) 2014-05-06 15:47:49 UTC
Depend son bug 45499 - Jenkins should run tests in disposable sandboxes
Comment 9 Gerrit Notification Bot 2014-08-03 02:19:03 UTC
Change 108880 abandoned by Tim Landscheidt:
WIP: Add test suite

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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links