diff --git a/xCAT-test/autotest/testcase/makehosts/1 b/xCAT-test/autotest/testcase/makehosts/1 new file mode 100644 index 000000000..b74dfa02a --- /dev/null +++ b/xCAT-test/autotest/testcase/makehosts/1 @@ -0,0 +1,4 @@ +127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 +::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 +127.5.5.5 test +9.114.34.61 hv16s6ap10.ppd.pok.ibm.com hv16s6ap10 diff --git a/xCAT-test/autotest/testcase/makehosts/cases0 b/xCAT-test/autotest/testcase/makehosts/cases0 new file mode 100644 index 000000000..86959a3ca --- /dev/null +++ b/xCAT-test/autotest/testcase/makehosts/cases0 @@ -0,0 +1,110 @@ +start:makehosts_h +description:makehosts -h +cmd:makehosts -h +check:rc==0 +check:output=~Usage +end + +start:makehosts_help +description:makehosts --help +cmd:makehosts --help +check:rc==0 +check:output=~Usage +end + +start:makehosts_null +description:makehosts +cmd:cp -f /etc/hosts /etc/hosts.xcatbak +cmd:chtab node=compute hosts.ip="|node(\d+)|1.2.3.(\$1+0)|" hosts.hostnames="|(.*)|(\$1).cluster.net|" +check:rc==0 +cmd:mkdef -t node -o node01,node02 groups="compute" +check:rc==0 +cmd:makehosts +check:rc==0 +cmd:cat /etc/hosts +check:output=~1.2.3.2 +check:output=~1.2.3.1 +check:output=~node01 +check:output=~node02 +cmd:chtab -d node=compute hosts +cmd:rmdef node01 +cmd:rmdef node02 +cmd:mv -f /etc/hosts.xcatbak /etc/hosts +end + +start:makehosts_l +cmd:cp -f /etc/hosts /etc/hosts.xcatbak +cmd:chtab node=compute hosts.ip="|node(\d+)|1.2.3.(\$1+0)|" hosts.hostnames="|(.*)|(\$1).cluster.net|" +check:rc==0 +cmd:chdef -t node -o node01,node02 groups="compute" +check:rc==0 +cmd:makehosts -l +check:rc==0 +cmd:cat /etc/hosts|awk '{print $2}' +check:output=~node01.cluster.net +check:output=~node02.cluster.net +cmd:chtab -d node=compute hosts +cmd:rmdef node01 +cmd:rmdef node02 +cmd:mv -f /etc/hosts.xcatbak /etc/hosts +end + +start:makehosts_d +cmd:cp -f /etc/hosts /etc/hosts.xcatbak +cmd:chtab node=compute hosts.ip="|node(\d+)|1.2.3.(\$1+0)|" hosts.hostnames="|(.*)|(\$1).cluster.net|" +check:rc==0 +cmd:chdef -t node -o node01 groups="compute" +check:rc==0 +cmd:makehosts node01 +check:rc==0 +cmd:cat /etc/hosts > /tmp/1 +cmd:makehosts -d node01 +check:rc==0 +cmd:cat /etc/hosts > /tmp/2 +cmd:diff /tmp/1 /tmp/2 +check:output=~node01.cluster.net +cmd:chtab -d node=compute hosts +cmd:rmdef node01 +cmd:mv -f /etc/hosts.xcatbak /etc/hosts +cmd:rm -f /tmp/1 /tmp/2 +end + +start:makehosts_n +cmd:cp -f /etc/hosts /etc/hosts.xcatbak +cmd:chtab node=compute hosts.ip="|node(\d+)|1.2.3.(\$1+0)|" hosts.hostnames="|(.*)|(\$1).cluster.net|" +check:rc==0 +cmd:chdef -t node -o node01 groups="compute" +check:rc==0 +cmd:makehosts -n +check:rc==0 +cmd:cat /etc/hosts |wc -l +check:rc==0 +check:output==2 +cmd:cat /etc/hosts +check:output=~node01.cluster.net +cmd:chtab -d node=compute hosts +cmd:rmdef node01 +cmd:mv -f /etc/hosts.xcatbak /etc/hosts +end + +start:makehosts_n_noderange +cmd:cp -f /etc/hosts /etc/hosts.xcatbak +cmd:chtab node=compute hosts.ip="|node(\d+)|1.2.3.(\$1+0)|" hosts.hostnames="|(.*)|(\$1).cluster.net|" +check:rc==0 +cmd:chdef -t node -o node01 groups="compute" +check:rc==0 +cmd:makehosts -n node01 +check:rc==0 +cmd:cat /etc/hosts |wc -l +check:rc==0 +check:output==2 +cmd:cat /etc/hosts +check:output=~node01.cluster.net +cmd:chtab -d node=compute hosts +cmd:rmdef node01 +cmd:mv -f /etc/hosts.xcatbak /etc/hosts +cmd:cat /etc/hosts| grep -v node01 > /tmp/1 +cmd:mv -f /tmp/1 > /etc/hosts +end + +