Add proxy setup for travis tests
authorgggeek <giunta.gaetano@gmail.com>
Thu, 19 Mar 2015 23:38:53 +0000 (23:38 +0000)
committergggeek <giunta.gaetano@gmail.com>
Thu, 19 Mar 2015 23:38:53 +0000 (23:38 +0000)
.travis.yml
tests/ci/travis/install_nginx.sh [new file with mode: 0644]
tests/ci/travis/nginx.conf [new file with mode: 0644]

index a41255c..8f125db 100644 (file)
@@ -20,12 +20,13 @@ before_script:
   - if [ $TRAVIS_PHP_VERSION != "hhvm" -a $TRAVIS_PHP_VERSION != "7.0" ]; then phpenv config-rm xdebug.ini; fi
 
   # We set up an Apache instance inside the Travis VM and test it.
-  - sh -c "if [ '$TRAVIS_PHP_VERSION' != 'hhvm' ]; then ./tests/ci/travis/install_apache.sh; fi"
-  - sh -c "if [ '$TRAVIS_PHP_VERSION' = 'hhvm' ]; then ./tests/ci/travis/install_apache_hhvm.sh; fi"
+  - if [ '$TRAVIS_PHP_VERSION' != 'hhvm' ]; then ./tests/ci/travis/install_apache.sh; fi
+  - if [ '$TRAVIS_PHP_VERSION' = 'hhvm' ]; then ./tests/ci/travis/install_apache_hhvm.sh; fi
+  - ./tests/ci/travis/install_nginx.sh
 
 script:
   # to have code coverage: --coverage-clover=coverage.clover
-  phpunit tests LOCALSERVER=localhost URI=/demo/server/server.php HTTPSSERVER=gggeek.ssl.altervista.org HTTPSURI=/sw/xmlrpc/demo/server/server.php NOPROXY=1 DEBUG=1
+  phpunit tests LOCALSERVER=localhost URI=/demo/server/server.php HTTPSSERVER=gggeek.ssl.altervista.org HTTPSURI=/sw/xmlrpc/demo/server/server.php PROXY=localhost:8080 DEBUG=1
 
 #after_script:
 #  # upload code-coverage to Scrutinizer
diff --git a/tests/ci/travis/install_nginx.sh b/tests/ci/travis/install_nginx.sh
new file mode 100644 (file)
index 0000000..c64ac20
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+# enable nginx (to serve as proxy)
+
+apt-get install nginx
+sudo cp -f tests/ci/nginx.conf /etc/nginx/nginx.conf
+sudo service nginx restart
diff --git a/tests/ci/travis/nginx.conf b/tests/ci/travis/nginx.conf
new file mode 100644 (file)
index 0000000..7b63ccf
--- /dev/null
@@ -0,0 +1,21 @@
+worker_processes 1;
+
+events {
+    worker_connections 1024;
+}
+
+http {
+    #include mime.types;
+    #default_type application/octet-stream;
+    gzip on;
+
+    server {
+        listen 8080;
+        location / {
+            proxy_pass http://localhost;
+            proxy_set_header Host $host;
+            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+            proxy_redirect off;
+        }
+    }
+}
\ No newline at end of file