Last modified: 2014-10-06 06:56:21 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.
This is mostly waiting for Vagrant in Jenkins. Maybe that can be the first candidate.
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
I assume this bug covers redirects.conf (<https://noc.wikimedia.org/conf/redirects.conf>)? Let's do this!
For the Toolserver redirects to come, I wrote Gerrit change #108467 if that's useful for this bug.
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.
Just found https://wiki.jenkins-ci.org/display/JENKINS/Port+Allocator+Plugin. Antoine, could this be installed in Jenkins please?
Change 108880 had a related patch set uploaded by Tim Landscheidt: WIP: Add test suite https://gerrit.wikimedia.org/r/108880
Depend son bug 45499 - Jenkins should run tests in disposable sandboxes
Change 108880 abandoned by Tim Landscheidt: WIP: Add test suite https://gerrit.wikimedia.org/r/108880