2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 17:23:08 +00:00

Merge pull request #5886 from hu-weihua/httpport

Looks good to me, I agree to merge.
This commit is contained in:
tingtli 2018-12-11 14:16:03 +08:00 committed by GitHub
commit 661c187c57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 99 additions and 5 deletions

View File

@ -0,0 +1,28 @@
setup_vm
genesis_work_with_non_default_http_80_port
change_http_listen_port_from_80_to_8898_in_mn
reg_linux_diskless_installation_flat
reg_linux_diskfull_installation_flat
updatenode_diskful_syncfiles
updatenode_diskful_syncfiles_rename
updatenode_diskful_syncfiles_dir
updatenode_syncfile_EXECUTE
updatenode_syncfile_EXECUTEALWAYS
updatenode_P_script1
updatenode_f_incompatible_flags
updatenode_k_incompatible_flags
updatenode_diskful_syncfiles_P_script1
updatenode_script3
updatenode_P_script1_script2
SN_setup_case
change_http_listen_port_from_80_to_8898_in_sn
reg_linux_diskfull_installation_hierarchy
updatenode_syncfile_APPEND
updatenode_syncfile_MERGE
updatenode_diskful_syncfiles_multi_files
updatenode_P_script2
reg_linux_diskless_installation_hierarchy
reg_linux_statelite_installation_hierarchy_by_ramdisk
change_http_listen_port_from_8898_to_80_in_sn
change_http_listen_port_from_8898_to_80_in_mn
clean_up_env

View File

@ -1,5 +1,5 @@
start:http_port_change
description:Add test cases for bug fix 2629, change http port and then generate genesis (mknb).
start:genesis_work_with_non_default_http_80_port
description: change http port from default 80 to 8898 and then make sure generate genesis (mknb) work.
label:mn_only,discovery
cmd:netstat -nlp|grep -E "apache2|httpd"
check:output =~ 80
@ -97,3 +97,65 @@ check:rc==0
cmd:dir="/tftpboot/pxelinux.cfg/p"; rm -rf $dir; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi
cmd:dir="/tftpboot/xcat/xnba/nets"; rm -rf $dir; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi
end
start:change_http_listen_port_from_80_to_8898_in_mn
description:This test case is used to simulate a http service which does not use default 80 port in mn. This is not a regular test case, just used to set up environment.
label:others,simulator
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
end
start:change_http_listen_port_from_8898_to_80_in_mn
description:This test case is used to restore environment which has been modified by test case change_http_listen_port_from_80_to_8898_in_mn. This is not a regular test case, just used to set up environment.
label:others,simulator
cmd:netstat -nlp|grep -E "apache2|httpd"
check:output =~ 8898
cmd:lsdef -t site -i httpport -c |awk -F"=" '{print $2}'
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
start:change_http_listen_port_from_80_to_8898_in_sn
description:This test case is used to simulate a http service which does not use default 80 port in sn. This is not a regular test case, just used to set up environment.
label:others,simulator
cmd:xdsh $$SN "netstat -nlp|grep -E 'apache2|httpd'"
check:output =~ 80
cmd:xdsh $$SN "lsdef -t site -i httpport -c |awk -F'=' '{print $2}'"
cmd:scp /opt/xcat/share/xcat/tools/autotest/testcase/httpport/change_http_port.sh $$SN:/tmp
cmd:xdsh $$SN "ls -l /tmp/ |grep change_http_port.sh"
cmd:xdsh $$SN "chmod +x /tmp/change_http_port.sh && /tmp/change_http_port.sh 80 8898"
cmd:xdsh $$SN "netstat -nlp|grep -E 'apache2|httpd' |grep 8898"
check:output =~ 8898
check:rc==0
end
start:change_http_listen_port_from_8898_to_80_in_sn
description:This test case is used to restore environment which has been modified by test case change_http_listen_port_from_80_to_8898_in_sn. This is not a regular test case, just used to set up environment.
label:others,simulator
cmd:xdsh $$SN "netstat -nlp|grep -E 'apache2|httpd'"
check:output =~ 8898
cmd:xdsh $$SN "lsdef -t site -i httpport -c |awk -F'=' '{print $2}'"
cmd:scp /opt/xcat/share/xcat/tools/autotest/testcase/httpport/change_http_port.sh $$SN:/tmp
cmd:xdsh $$SN "ls -l /tmp/ |grep change_http_port.sh"
cmd:xdsh $$SN "chmod +x /tmp/change_http_port.sh && /tmp/change_http_port.sh 8898 80"
cmd:xdsh $$SN "netstat -nlp|grep -E 'apache2|httpd' |grep 80"
check:output =~ 80
check:rc==0
end

View File

@ -11,8 +11,12 @@ echo "The original httpd port is $port in $config"
echo "start to change httpd listen port to $2"
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
echo "Restart http service"
service apache2 status > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
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
fi
service apache2 stop
sleep 1
service apache2 start
@ -21,4 +25,4 @@ else
sleep 1
service httpd start
fi
exit
exit $?