2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-14 15:20:29 +00:00

For issue :Add test case for 2665: postscript fails and status=booted (#2903)

* For issue :Add test case for 2665: postscript fails and status=booted

* Add postscripts failed testcase for issue:2665

* Add postscripts failed testcase for issue:2665

* delete 3 file for there have been renamed

* modify postscript failed according to yangsong's comments
This commit is contained in:
junxiawang
2017-05-05 17:08:38 +08:00
committed by yangsong
parent 798fa46c52
commit a0a8ea22a5
3 changed files with 152 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
start:reg_linux_diskfull_installation_flat_postscripts_failed
description:This case is for postscripts failed the status will return failed during diskfull installation.
attribute:$$CN-The operation object of diskfull installation.
os:Linux
cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi
cmd:MINIISO=NUll;if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64" ]];then mkdir /tmp/iso; mount -o loop $$MINIISO /tmp/iso ; mkdir -p /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot; cp /tmp/iso/install/initrd.gz /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot;umount /tmp/iso; rmdir /tmp/iso; fi
check:rc==0
cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN
check:rc==0
cmd:makedns -n
check:rc==0
cmd:makeconservercf
check:rc==0
cmd:cat /etc/conserver.cf | grep $$CN
check:output=~$$CN
cmd:sleep 20
cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]] && [[ "__GETNODEATTR($$CN,mgt)__" != "ipmi" ]]; then getmacs -D $$CN; fi
check:rc==0
cmd:chtab key=extntpservers site.value=""
check:rc==0
cmd:chtab key=ntpservers site.value="<xcatmaster>"
check:rc==0
cmd:makentp
check:rc==0
cmd:makedhcp -n
check:rc==0
cmd:makedhcp -a
check:rc==0
cmd:sleep 10
cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done
check:rc==0
cmd:copycds $$ISO
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/installation/setup_postscript_failed.sh
check:rc==0
cmd:chmod 777 /install/postscripts/test
check:rc==0
cmd:chdef $$CN -p postscripts=test
check:rc==0
cmd:lsdef -l $$CN
check:rc==0
cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute
check:rc==0
check:output=~Provision node\(s\)\: $$CN
cmd:sleep 300
cmd:a=0;while ! `lsdef -l $$CN|grep status|grep failed >/dev/null`; do sleep 20;((a++));if [ $a -gt 300 ];then break;fi done
cmd:ping $$CN -c 3
check:rc==0
check:output=~64 bytes from $$CN
cmd:lsdef -l $$CN | grep status
check:rc==0
check:output=~failed
cmd:xdsh $$CN date
check:rc==0
check:output=~\d\d:\d\d:\d\d
cmd:xdsh $$CN mount
check:rc==0
cmd:sleep 120
cmd:lsdef -l $$CN
cmd:ping $$CN -c 3
check:rc==0
check:output=~64 bytes from $$CN
cmd:xdsh $$CN "cat /var/log/xcat/xcat.log"
cmd: chdef -t node -o $$CN -m postscripts="test"; rm -rf /install/postscripts/test
end

View File

@@ -0,0 +1,77 @@
start:reg_linux_diskless_installation_flat_postscripts_failed
description:This case is for postscripts failed the status will return failed during diskless installation.
attribute:$$CN-The operation object of diskless installation.
os:Linux
cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN
check:rc==0
cmd:makedns -n
check:rc==0
cmd:makeconservercf $$CN
check:rc==0
cmd:cat /etc/conserver.cf | grep $$CN
check:output=~$$CN
cmd:sleep 20
cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]] && [[ "__GETNODEATTR($$CN,mgt)__" != "ipmi" ]]; then getmacs -D $$CN; fi
check:rc==0
cmd:makedhcp -n
check:rc==0
cmd:makedhcp -a
check:rc==0
cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done
check:rc==0
cmd:copycds $$ISO
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/installation/setup_postscript_failed.sh
check:rc==0
cmd:chmod 777 /install/postscripts/test
check:rc==0
cmd:chdef $$CN -p postscripts=test
check:rc==0
cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then mv $rootimgdir $rootimgdir.regbak -f;fi
check:rc==0
cmd:if [ ! -d /tmp/mountoutput ]; then mkdir -p /tmp/mountoutput; fi
cmd:mount |sort > /tmp/mountoutput/file.org
cmd:cat /tmp/mountoutput/file.org
cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute
check:rc==0
cmd:mount |sort > /tmp/mountoutput/file.new
cmd:cat /tmp/mountoutput/file.new
cmd:diff /tmp/mountoutput/file.org /tmp/mountoutput/file.new
check:rc==0
cmd:rm -rf /tmp/mountoutput
cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute
check:rc==0
cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute
check:rc==0
check:output=~Provision node\(s\)\: $$CN
cmd:sleep 900
cmd:a=0;while ! `lsdef -l $$CN|grep status|grep failed >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done
cmd:ping $$CN -c 3
check:rc==0
check:output=~64 bytes from $$CN
cmd:lsdef -l $$CN | grep status
check:rc==0
check:output=~failed
cmd:xdsh $$CN date
check:rc==0
check:output=~\d\d:\d\d:\d\d
cmd:xdsh $$CN mount
check:rc==0
check:output=~on / type tmpfs
cmd:sleep 120
cmd:ping $$CN -c 3
check:rc==0
check:output=~64 bytes from $$CN
cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi
check:rc==0
cmd:xdsh $$CN "cat /var/log/xcat/xcat.log"
cmd: chdef -t node -o $$CN -m postscripts="test"; rm -rf /install/postscripts/test
end

View File

@@ -0,0 +1,6 @@
#!/bin/bash
cat >> /install/postscripts/test <<EOF
#!/bin/bash
echo "test"
exit 1
EOF