From 3611f424a52dd628d5570a727604c428387a5524 Mon Sep 17 00:00:00 2001 From: Fabian Arrotin Date: Apr 27 2020 14:58:03 +0000 Subject: Merge pull request #55 from carlwgeorge/mod_wsgi_38 Add python38-mod_wsgi test --- diff --git a/tests/p_mod_wsgi/0-install_mod_wsgi.sh b/tests/p_mod_wsgi/0-install_mod_wsgi.sh index c1f5a6b..e9d1038 100755 --- a/tests/p_mod_wsgi/0-install_mod_wsgi.sh +++ b/tests/p_mod_wsgi/0-install_mod_wsgi.sh @@ -3,13 +3,9 @@ t_Log "Running $0 - installing mod_wsgi" -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 -if [[ $centos_ver -ge 8 ]]; then - t_InstallPackage python3-mod_wsgi -else - t_InstallPackage mod_wsgi -fi +t_InstallPackage mod_wsgi diff --git a/tests/p_mod_wsgi/10-mod_wsgi_test.sh b/tests/p_mod_wsgi/10-mod_wsgi_test.sh deleted file mode 100755 index 8dfd53b..0000000 --- a/tests/p_mod_wsgi/10-mod_wsgi_test.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/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/10-test_mod_wsgi.sh b/tests/p_mod_wsgi/10-test_mod_wsgi.sh new file mode 100755 index 0000000..8dfd53b --- /dev/null +++ b/tests/p_mod_wsgi/10-test_mod_wsgi.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/20-remove_mod_wsgi.sh b/tests/p_mod_wsgi/20-remove_mod_wsgi.sh new file mode 100755 index 0000000..690b3ac --- /dev/null +++ b/tests/p_mod_wsgi/20-remove_mod_wsgi.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +t_Log "Running $0 - removing mod_wsgi" + +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 + +t_RemovePackage mod_wsgi diff --git a/tests/p_python3-mod_wsgi/0-install_python3-mod_wsgi.sh b/tests/p_python3-mod_wsgi/0-install_python3-mod_wsgi.sh new file mode 100755 index 0000000..30f15c8 --- /dev/null +++ b/tests/p_python3-mod_wsgi/0-install_python3-mod_wsgi.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +t_Log "Running $0 - installing python3-mod_wsgi" + +if [[ $centos_ver -lt 8 ]]; then + t_Log "python3-mod_wsgi doesn't exist before CentOS 8 -> SKIP" + exit 0 +fi + +t_InstallPackage python3-mod_wsgi 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 120000 index 0000000..f0c7f89 --- /dev/null +++ b/tests/p_python3-mod_wsgi/10-test_python3-mod_wsgi.sh @@ -0,0 +1 @@ +../p_mod_wsgi/10-test_mod_wsgi.sh \ No newline at end of file diff --git a/tests/p_python3-mod_wsgi/20-remove_python3-mod_wsgi.sh b/tests/p_python3-mod_wsgi/20-remove_python3-mod_wsgi.sh new file mode 100755 index 0000000..975dfa0 --- /dev/null +++ b/tests/p_python3-mod_wsgi/20-remove_python3-mod_wsgi.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +t_Log "Running $0 - removing python3-mod_wsgi" + +if [[ $centos_ver -lt 8 ]]; then + t_Log "python3-mod_wsgi doesn't exist before CentOS 8 -> SKIP" + exit 0 +fi + +t_RemovePackage python3-mod_wsgi diff --git a/tests/p_python38-mod_wsgi/0-install_python38-mod_wsgi.sh b/tests/p_python38-mod_wsgi/0-install_python38-mod_wsgi.sh new file mode 100755 index 0000000..6cce426 --- /dev/null +++ b/tests/p_python38-mod_wsgi/0-install_python38-mod_wsgi.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +t_Log "Running $0 - installing python38-mod_wsgi" + +if [[ $centos_ver -lt 8 ]]; then + t_Log "python38-mod_wsgi doesn't exist before CentOS 8 -> SKIP" + exit 0 +fi + +t_InstallPackage python38-mod_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 new file mode 120000 index 0000000..f0c7f89 --- /dev/null +++ b/tests/p_python38-mod_wsgi/10-test_python38-mod_wsgi.sh @@ -0,0 +1 @@ +../p_mod_wsgi/10-test_mod_wsgi.sh \ No newline at end of file diff --git a/tests/p_python38-mod_wsgi/20-remove_python38-mod_wsgi.sh b/tests/p_python38-mod_wsgi/20-remove_python38-mod_wsgi.sh new file mode 100755 index 0000000..2c598f7 --- /dev/null +++ b/tests/p_python38-mod_wsgi/20-remove_python38-mod_wsgi.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +t_Log "Running $0 - removing python38-mod_wsgi" + +if [[ $centos_ver -lt 8 ]]; then + t_Log "python38-mod_wsgi doesn't exist before CentOS 8 -> SKIP" + exit 0 +fi + +t_RemovePackage python38-mod_wsgi