https://bugzilla.wikimedia.org/show_bug.cgi?id=43266

       Web browser: ---
            Bug ID: 43266
           Summary: Test for the Apache configuration
           Product: Wikimedia
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: Unprioritized
         Component: Testing Infrastructure
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified
   Mobile Platform: ---

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to