re-import sources as agreed with the maintainer

This commit is contained in:
Adam Samalik 2023-07-10 09:21:56 +02:00
parent fedff1d634
commit 72cfbc575a
4 changed files with 222 additions and 1 deletions

54
.gitignore vendored
View File

@ -1,2 +1,54 @@
SOURCES/haproxy-1.8.27.tar.gz *~
haproxy-1.4.8.tar.gz
/haproxy-1.4.11.tar.gz
/haproxy-1.4.15.tar.gz
/haproxy-1.4.18.tar.gz
/haproxy-1.4.19.tar.gz
/haproxy-1.4.20.tar.gz
/haproxy-1.4.22.tar.gz
/haproxy-1.4.23.tar.gz
/haproxy-1.4.24.tar.gz
/haproxy-1.4.25.tar.gz
/haproxy-1.5.0.tar.gz
/haproxy-1.5.1.tar.gz
/haproxy-1.5.2.tar.gz
/haproxy-1.5.3.tar.gz
/haproxy-1.5.4.tar.gz
/haproxy-1.5.5.tar.gz
/haproxy-1.5.6.tar.gz
/haproxy-1.5.7.tar.gz
/haproxy-1.5.8.tar.gz
/haproxy-1.5.9.tar.gz
/haproxy-1.5.10.tar.gz
/haproxy-1.5.11.tar.gz
/haproxy-1.5.12.tar.gz
/haproxy-1.5.13.tar.gz
/haproxy-1.5.14.tar.gz
/haproxy-1.6.0.tar.gz
/haproxy-1.6.1.tar.gz
/haproxy-1.6.2.tar.gz
/haproxy-1.6.3.tar.gz
/haproxy-1.6.5.tar.gz
/haproxy-1.6.6.tar.gz
/haproxy-1.6.7.tar.gz
/haproxy-1.6.9.tar.gz
/haproxy-1.6.10.tar.gz
/haproxy-1.7.0.tar.gz
/haproxy-1.7.1.tar.gz
/haproxy-1.7.2.tar.gz
/haproxy-1.7.3.tar.gz
/haproxy-1.7.8.tar.gz
/haproxy-1.7.9.tar.gz
/haproxy-1.8.1.tar.gz
/haproxy-1.8.2.tar.gz
/haproxy-1.8.3.tar.gz
/haproxy-1.8.4.tar.gz
/haproxy-1.8.5.tar.gz
/haproxy-1.8.6.tar.gz
/haproxy-1.8.7.tar.gz
/haproxy-1.8.8.tar.gz
/haproxy-1.8.12.tar.gz
/haproxy-1.8.14.tar.gz
/haproxy-1.8.15.tar.gz
/haproxy-1.8.23.tar.gz
/haproxy-1.8.27.tar.gz /haproxy-1.8.27.tar.gz

16
tests/haproxy.cfg.in Normal file
View File

@ -0,0 +1,16 @@
global
daemon
maxconn 1024
user haproxy
group haproxy
defaults
mode http
timeout connect 2s
timeout client 10s
timeout server 10s
listen test
bind *:81
server $VHOST1_NAME $VHOST1_ADDR:$VHOST1_PORT check
server $VHOST2_NAME $VHOST2_ADDR:$VHOST2_PORT check

140
tests/run_tests.sh Executable file
View File

@ -0,0 +1,140 @@
#!/bin/sh
export VHOST1_NAME="vhost1"
export VHOST1_ADDR="192.168.100.101"
export VHOST1_PORT="80"
export VHOST2_NAME="vhost2"
export VHOST2_ADDR="192.168.100.102"
export VHOST2_PORT="80"
mkdir -p /var/www/html/${VHOST1_NAME}
mkdir -p /var/www/html/${VHOST2_NAME}
echo ${VHOST1_NAME} > /var/www/html/${VHOST1_NAME}/index.html
echo ${VHOST2_NAME} > /var/www/html/${VHOST2_NAME}/index.html
cat >/etc/httpd/conf.d/vhost.conf <<EOF
<VirtualHost ${VHOST1_ADDR}:${VHOST1_PORT}>
DocumentRoot /var/www/html/${VHOST1_NAME}
</VirtualHost>
<VirtualHost ${VHOST2_ADDR}:${VHOST2_PORT}>
DocumentRoot /var/www/html/${VHOST2_NAME}
</VirtualHost>
EOF
echo -ne "[debug]: adding ${VHOST1_ADDR} ... "
ip addr add ${VHOST1_ADDR} dev lo
if [ $? -ne 0 ] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
echo -ne "[debug]: adding ${VHOST1_ADDR} ... "
ip addr add ${VHOST2_ADDR} dev lo
if [ $? -ne 0 ] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
echo -ne "[debug]: starting httpd service ... "
systemctl start httpd
if [ $? -ne 0 ] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
echo -ne "[debug]: checking httpd active ... "
systemctl -q is-active httpd
if [ $? -ne 0 ] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
VHOST1_VARS='${VHOST1_NAME}:${VHOST1_ADDR}:${VHOST1_PORT}'
VHOST2_VARS='${VHOST2_NAME}:${VHOST2_ADDR}:${VHOST2_PORT}'
echo -ne "[debug]: setting up config file .... "
envsubst "${VHOST1_VARS},${VHOST2_VARS}" < ./haproxy.cfg.in > /etc/haproxy/haproxy.cfg
if [ $? -ne 0 ] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
echo -ne "[debug]: configuring selinux policy ... "
setsebool haproxy_connect_any 1
if [ $? -ne 0 ] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
echo -ne "[debug]: starting haproxy service ... "
systemctl start haproxy
if [ $? -ne 0 ] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
echo -ne "[debug]: checking haproxy active ... "
systemctl -q is-active haproxy
if [ $? -ne 0 ] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
echo -ne "[debug]: fetching URL via haproxy ... "
if [[ $( curl -s http://127.0.0.1:81 ) != ${VHOST1_NAME} ]] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
echo -ne "[debug]: fetching URL via haproxy ... "
if [[ $( curl -s http://127.0.0.1:81 ) != ${VHOST2_NAME} ]] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
echo -ne "[debug]: stopping haproxy service ... "
systemctl stop haproxy
if [ $? -ne 0 ] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
echo -ne "[debug]: checking haproxy inactive ... "
systemctl -q is-active haproxy
if [ $? -ne 3 ] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
systemctl stop httpd
ip addr del ${VHOST1_ADDR}/32 dev lo
ip addr del ${VHOST2_ADDR}/32 dev lo
exit 0

13
tests/tests.yml Normal file
View File

@ -0,0 +1,13 @@
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
tests:
- simple:
dir: .
run: ./run_tests.sh
required_packages:
- curl
- gettext
- httpd