2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-07-11 07:11:30 +00:00
Files
xcat-core/xCAT-test/autotest/testcase/makentp/cases0

124 lines
3.9 KiB
Plaintext

start:makentp_v
description:makentp -v
label:others,ntp
cmd:makentp -v
check:rc==0
check:output=~Version
end
start:makentp_h
description:makentp -h
label:others,ntp
cmd:makentp -h
check:rc==0
check:output=~Usage: makentp
end
start:makentp_extntpserver_null
description:test makentp with default value. extntpserver is set to blank
label:others,ntp
cmd:lsdef -t site -o clustersite -i extntpservers -c >/tmp/extntpserver
check:rc==0
cmd:chtab key=extntpservers site.value=""
check:rc==0
cmd:makentp
check:rc==0
check:output=~configuring management node: $$MN
cmd:makentp -V
check:rc==0
check:output=~configuring management node: $$MN
check:output=~checking if nptd is installed
check:output=~backing up the ntp configuration file /etc/ntp.conf
check:output=~stopping ntpserver
check:output=~starting ntpserver
check:output=~enabling ntpserver
cmd:extntpserver=`cat /tmp/ntpserver | awk -F = '{print \$2}'`;chtab key=extntpservers site.value=$extntpserver
check:rc==0
cmd:rm -rf /tmp/extntpserver
cmd:makentp
check:rc==0
end
start:makentp_extntpserver_value
description:test makentp with extntpserver is set to a specific value
label:others,ntp
cmd:lsdef -t site -o clustersite -i extntpservers -c >/tmp/extntpserver
check:rc==0
cmd:chtab key=extntpservers site.value="$$extntpserversip"
check:rc==0
cmd:date +"%Y" > /tmp/currentyear
check:rc==0
cmd:date -s 20000101
check:rc==0
cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhel" ]];then clock -w;else hwclock -w ; fi
check:rc==0
cmd:makentp
check:rc==0
cmd:curryear=`cat /tmp/currentyear`;date | grep $curryear
check:rc==0
check:output=~\d
cmd:curryear=`cat /tmp/currentyear`;if [[ "__GETNODEATTR($$CN,os)__" =~ "rhel" ]];then clock | grep $curryear;else hwclock | grep $curryear ; fi
check:rc==0
check:output=~\d
cmd:extntpserver=`cat /tmp/extntpserver | awk -F = '{print \$2}'`;chtab key=extntpservers site.value=$extntpserver
check:rc==0
cmd:rm -rf /tmp/extntpserver
check:rc==0
cmd:rm -f /tmp/currentyear
check:rc==0
end
start:updatenode_computenode_P_setupntp
description:using updatenode -P to setup ntp on compute node
label:others,ntp
cmd:xdsh $$CN date -s 20000101
check:rc==0
cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhel" ]];then xdsh $$CN clock -w;else xdsh $$CN hwclock -w ; fi
cmd:lsdef -t node -o $$CN -i postscripts -c > /tmp/postscripts
check:rc==0
cmd:chdef $$CN postscripts=setupntp
cmd:lsdef -t site -o clustersite -i ntpservers -c >/tmp/ntpservers
cmd:chtab key=ntpservers site.value=""
cmd:makentp
check:rc==0
check:output=~configuring management node: $$MN
cmd:updatenode $$CN -P setupntp
check:rc==0
check:output=~Running of postscripts has completed
check:output=~Running postscript: setupntp
check:output=~setupntp exited with code 0
cmd:sleep 120
cmd:xdsh $$CN date
check:output=~$$DATE
cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhel" ]];then clock ;else hwclock ; fi
check:rc==0
check:output=~$$DATE
cmd:ntpserver=`cat /tmp/ntpserver | awk -F = '{print \$2}'`;chtab key=ntpservers site.value=$ntpserver
check:rc==0
cmd:rm -rf /tmp/ntpserve
cmd:postscript=`cat /tmp/postscript | awk -F = '{print \$2}'`;chdef -t node -o $$CN postscripts=$postscript
check:rc==0
cmd:rm -rf /tmp/postscript
end
start:makentp_initialize
description:start ntp service on management node and synchronize time with external ntp server
label:others,ntp
cmd:chtab key=extntpservers site.value="$$extntpserversip"
check:rc==0
cmd:makentp -V
check:rc==0
check:output=~configuring management node: $$MN
check:output=~checking if nptd is installed
check:output=~backing up the ntp configuration file /etc/ntp.conf
check:output=~ntp servers are: $$extntpserversip
check:output=~stopping ntpserver
check:output=~starting ntpserver
check:output=~enabling ntpserver
cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu" ]] || [[ "__GETNODEATTR($$CN,os)__" = "sles11.4" ]];then service ntp status;else service ntpd status; fi
check:rc==0
cmd:a=0;until ntpq -n -c peers | tail -n +2 | grep -q '^*'; do sleep 30;((a++));if [ $a -gt 30 ];then exit 1;fi done
check:rc==0
end