From 803854f26143f7e719f00fc6a876efac8f4e5269 Mon Sep 17 00:00:00 2001 From: Fabian Arrotin Date: Apr 27 2020 18:22:45 +0000 Subject: Merge pull request #56 from carlwgeorge/mod_wsgi_38-tweaks Correctly skip mod_wsgi tests as needed --- diff --git a/tests/p_mod_wsgi/10-test_mod_wsgi.sh b/tests/p_mod_wsgi/10-test_mod_wsgi.sh index 8dfd53b..f0c5c19 100755 --- a/tests/p_mod_wsgi/10-test_mod_wsgi.sh +++ b/tests/p_mod_wsgi/10-test_mod_wsgi.sh @@ -2,8 +2,8 @@ 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" +if [[ $centos_ver -lt 6 || $centos_ver -gt 7 ]]; then + t_Log "mod_wsgi not available before CentOS 6 or after CentOS 7 -> SKIP" exit 0 fi diff --git a/tests/p_python3-mod_wsgi/10-test_python3-mod_wsgi.sh b/tests/p_python3-mod_wsgi/10-test_python3-mod_wsgi.sh deleted file mode 120000 index f0c7f89..0000000 --- a/tests/p_python3-mod_wsgi/10-test_python3-mod_wsgi.sh +++ /dev/null @@ -1 +0,0 @@ -../p_mod_wsgi/10-test_mod_wsgi.sh \ No newline at end of file diff --git a/tests/p_python3-mod_wsgi/10-test_python3-mod_wsgi.sh b/tests/p_python3-mod_wsgi/10-test_python3-mod_wsgi.sh new file mode 100755 index 0000000..20a9b3e --- /dev/null +++ b/tests/p_python3-mod_wsgi/10-test_python3-mod_wsgi.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +t_Log "Running $0 - Apache httpd python3-mod_wsgi is functional" + +if [[ $centos_ver -lt 8 ]]; then + t_Log "python3-mod_wsgi doesn't exist before CentOS 8 -> 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 + +systemctl restart httpd + +curl -s http://localhost/tfapp | grep -q 't_functional_mod_wsgi_test' +t_CheckExitStatus $? + +systemctl stop httpd + +rm /etc/httpd/conf.d/tfapp.conf /var/www/html/tfapp.wsgi diff --git a/tests/p_python38-mod_wsgi/10-test_python38-mod_wsgi.sh b/tests/p_python38-mod_wsgi/10-test_python38-mod_wsgi.sh deleted file mode 120000 index f0c7f89..0000000 --- a/tests/p_python38-mod_wsgi/10-test_python38-mod_wsgi.sh +++ /dev/null @@ -1 +0,0 @@ -../p_mod_wsgi/10-test_mod_wsgi.sh \ No newline at end of file diff --git a/tests/p_python38-mod_wsgi/10-test_python38-mod_wsgi.sh b/tests/p_python38-mod_wsgi/10-test_python38-mod_wsgi.sh new file mode 100755 index 0000000..56001ae --- /dev/null +++ b/tests/p_python38-mod_wsgi/10-test_python38-mod_wsgi.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +t_Log "Running $0 - Apache httpd python38-mod_wsgi is functional" + +if [[ $centos_ver -lt 8 ]]; then + t_Log "python38-mod_wsgi doesn't exist before CentOS 8 -> 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 + +systemctl restart httpd + +curl -s http://localhost/tfapp | grep -q 't_functional_mod_wsgi_test' +t_CheckExitStatus $? + +systemctl stop httpd + +rm /etc/httpd/conf.d/tfapp.conf /var/www/html/tfapp.wsgi