bstinson / centos / t_functional

Forked from centos/t_functional 4 years ago
Clone

Blame tests/p_httpd/httpd_vhost.sh

Karanbir Singh 0b5bb2
#!/bin/sh
Karanbir Singh 0b5bb2
# Author: Athmane Madjoudj <athmanem@gmail.com>
Karanbir Singh 0b5bb2
Karanbir Singh 2dd0be
t_Log "Running $0 - httpd virtual host test."
Karanbir Singh 2dd0be
Karanbir Singh 0b5bb2
echo "127.0.0.1   test" >>  /etc/hosts
Karanbir Singh 0b5bb2
cat > /etc/httpd/conf.d/vhost-test.conf <
Karanbir Singh 0b5bb2
NameVirtualHost *:80
Karanbir Singh 0b5bb2
Karanbir Singh 0b5bb2
<VirtualHost *:80>
Karanbir Singh 0b5bb2
 ServerAdmin webmaster@test
Karanbir Singh 0b5bb2
 DocumentRoot /var/www/vhosts/test/
Karanbir Singh 0b5bb2
 ServerName test
Karanbir Singh 0b5bb2
</VirtualHost>
Karanbir Singh 0b5bb2
EOF
Karanbir Singh 0b5bb2
Karanbir Singh 0b5bb2
mkdir -p /var/www/vhosts/test/
Karanbir Singh 0b5bb2
echo "Virtual Host Test Page" > /var/www/vhosts/test/index.html
Steve Barnes 464547
t_ServiceControl httpd reload
Steve Barnes 464547
echo -e "GET / HTTP/1.0\r\n" | nc test 80 | grep 'Virtual Host Test Page'
Karanbir Singh 2dd0be
Karanbir Singh 2dd0be
t_CheckExitStatus $?
Karanbir Singh 2dd0be
Karanbir Singh 2dd0be
# SteveCB: remove vhost-test.conf to prevent later tests 
Karanbir Singh 2dd0be
# that assume DocumentRoot is /var/www/html from failing
Karanbir Singh 2dd0be
rm /etc/httpd/conf.d/vhost-test.conf
Steve Barnes 464547
t_ServiceControl httpd reload
Steve Barnes 724d58