mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-31 10:06:39 +00:00
add http port change case, do task 339
This commit is contained in:
parent
6d9a912cf7
commit
68ffc340dd
29
xCAT-test/autotest/testcase/httpport/cases0
Normal file
29
xCAT-test/autotest/testcase/httpport/cases0
Normal file
@ -0,0 +1,29 @@
|
||||
start:http_port_change
|
||||
description:Add test cases for bug fix 2629, change http port and then generate genesis (mknb).
|
||||
label:others
|
||||
cmd:netstat -nlp|grep -E "apache2|httpd"
|
||||
check:output =~ 80
|
||||
cmd:lsdef -t site -i httpport -c |awk -F"=" '{print $2}'
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/httpport/change_http_port.sh 80 8898
|
||||
cmd:netstat -nlp|grep -E "apache2|httpd"
|
||||
check:output =~ 8898
|
||||
check:rc==0
|
||||
cmd:chdef -t site httpport=8898
|
||||
check:rc==0
|
||||
cmd:lsdef -t site -i httpport -c
|
||||
check:output =~ 8898
|
||||
check:rc==0
|
||||
cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64le" ]]; then arch=ppc64; else arch=__GETNODEATTR($$CN,arch)__;fi; mknb $arch
|
||||
check:rc==0
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/httpport/check_wget_files.sh /tftpboot/pxelinux.cfg/p/
|
||||
check:rc==0
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/httpport/change_http_port.sh 8898 80
|
||||
cmd:netstat -nlp|grep -E "apache2|httpd"
|
||||
check:output =~ 80
|
||||
check:rc==0
|
||||
cmd:chdef -t site httpport=80
|
||||
check:rc==0
|
||||
cmd:lsdef -t site -i httpport -c
|
||||
check:output =~ 80
|
||||
check:rc==0
|
||||
end
|
24
xCAT-test/autotest/testcase/httpport/change_http_port.sh
Executable file
24
xCAT-test/autotest/testcase/httpport/change_http_port.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
if [ -f "/etc/httpd/conf/httpd.conf" ]; then
|
||||
config="/etc/httpd/conf/httpd.conf"
|
||||
elif [ -f "/etc/apache2/ports.conf" ]; then
|
||||
config="/etc/apache2/ports.conf"
|
||||
elif [ -f "/etc/apache2/listen.conf" ]; then
|
||||
config="/etc/apache2/listen.conf"
|
||||
fi
|
||||
port=`awk -F' ' '/^[Ll]isten / {print $2}' $config`
|
||||
echo "The original httpd port is $port in $config"
|
||||
|
||||
echo "start to change httpd listen port to 8898"
|
||||
sed -i "s/^Listen $1/Listen $2/g" $config
|
||||
if [ -f "/etc/apache2/sites-enabled/000-default.conf" ]; then
|
||||
sed -i "s/VirtualHost \*:$1/VirtualHost \*:$2/g" /etc/apache2/sites-enabled/000-default.conf
|
||||
service apache2 stop
|
||||
sleep 1
|
||||
service apache2 start
|
||||
else
|
||||
service httpd stop
|
||||
sleep 1
|
||||
service httpd start
|
||||
fi
|
||||
exit
|
25
xCAT-test/autotest/testcase/httpport/check_wget_files.sh
Executable file
25
xCAT-test/autotest/testcase/httpport/check_wget_files.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
# get all filename in specified path
|
||||
path=$1
|
||||
files=$(ls $path)
|
||||
for filename in $files
|
||||
do
|
||||
echo "The file is $filename"
|
||||
grep 8898 $path$filename
|
||||
if [ $? != 0 ];then
|
||||
echo "port 8898 does not exist"
|
||||
exit 1;
|
||||
fi
|
||||
links=$(grep 8898 $path$filename|awk -F " " '{print $2}')
|
||||
for link in $links
|
||||
do
|
||||
wget $link
|
||||
if [ $? != 0 ];then
|
||||
echo "wget failed"
|
||||
exit 1;
|
||||
else
|
||||
echo "wget $link succeed"
|
||||
fi
|
||||
done
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user