diff --git a/tests/p_mod_wsgi/0-install_mod_wsgi.sh b/tests/p_mod_wsgi/0-install_mod_wsgi.sh index 1713b67..c1f5a6b 100755 --- a/tests/p_mod_wsgi/0-install_mod_wsgi.sh +++ b/tests/p_mod_wsgi/0-install_mod_wsgi.sh @@ -1,12 +1,15 @@ #!/bin/bash # Author: Athmane Madjoudj -if [ $centos_ver -ge 6 ] -then - t_InstallPackage mod_wsgi - service httpd restart -else - echo "Skipped on CentOS 5" -fi +t_Log "Running $0 - installing mod_wsgi" +if [[ $centos_ver -lt 6 ]]; then + t_Log "mod_wsgi doesn't exist before CentOS 6 -> SKIP" + exit 0 +fi +if [[ $centos_ver -ge 8 ]]; then + t_InstallPackage python3-mod_wsgi +else + t_InstallPackage mod_wsgi +fi diff --git a/tests/p_mod_wsgi/10-mod_wsgi_test.sh b/tests/p_mod_wsgi/10-mod_wsgi_test.sh new file mode 100755 index 0000000..8dfd53b --- /dev/null +++ b/tests/p_mod_wsgi/10-mod_wsgi_test.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +t_Log "Running $0 - Apache httpd mod_wsgi is functional" + +if [[ $centos_ver -lt 6 ]]; then + t_Log "mod_wsgi doesn't exist before CentOS 6 -> SKIP" + exit 0 +fi + +cat > /etc/httpd/conf.d/tfapp.conf << EOF +WSGIScriptAlias /tfapp /var/www/html/tfapp.wsgi +EOF + +cat > /var/www/html/tfapp.wsgi << EOF +def application(environ, start_response): + status = '200 OK' + output = 't_functional_mod_wsgi_test'.encode() + response_headers = [ + ('Content-type', 'text/plain'), + ('Content-Length', str(len(output))) + ] + start_response(status, response_headers) + return [output] +EOF + +if [[ $centos_ver -ge 7 ]]; then + systemctl restart httpd +else + service httpd restart +fi + +curl -s http://localhost/tfapp | grep -q 't_functional_mod_wsgi_test' +t_CheckExitStatus $? + +if [[ $centos_ver -ge 7 ]]; then + systemctl stop httpd +else + service httpd stop +fi + +rm /etc/httpd/conf.d/tfapp.conf /var/www/html/tfapp.wsgi diff --git a/tests/p_mod_wsgi/mod_wsgi_test.sh b/tests/p_mod_wsgi/mod_wsgi_test.sh deleted file mode 100755 index 7dc7587..0000000 --- a/tests/p_mod_wsgi/mod_wsgi_test.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -t_Log "Running $0 - Apache httpd mod_wsgi is functional" -if [ $centos_ver -ge 6 ] -then - while [ `ps fax | grep 'sbin/httpd' | grep -v grep | wc -l` -gt 0 ]; do - #t_ServiceControl httpd stop - killall -s KILL httpd - sleep 1 - done - - cat > /etc/httpd/conf.d/tf_app.conf < /var/www/html/tf_app.wsgi <