2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-26 13:10:35 +00:00

Merge pull request #1511 from caomengmeng/add_template_test_cases

Add template test cases
This commit is contained in:
junxiawang
2016-11-01 23:06:58 -04:00
committed by GitHub
4 changed files with 230 additions and 0 deletions

View File

@@ -222,3 +222,20 @@ cmd:chdef -t wrongtype -o testnode groups=all,aix
check:rc!=0
check:output=~not a valid
end
start:chdef_template
os:linux
description:try to change a template, a new node is created according to chdef.
cmd:result=`lsdef | grep switch-template`; if [[ $result =~ "switch-template" ]]; then echo $result; noderm switch-template; fi
cmd:chdef -t node -o switch-template groups=test
check:output=~1 object definitions have been created or modified
check:output=~New object definitions \'switch-template\' have been created
check:rc==0
cmd:lsdef switch-template
check:output=~Object name\: switch\-template
check:output=~groups\=test
check:rc==0
cmd:noderm switch-template
check:rc==0
end

View File

@@ -209,3 +209,42 @@ check:rc==0
cmd:lsdef testnode1
check:output=~Could not find
end
start:lsdef_template
os:linux
description:check xCAT supported template
cmd:lsdef --template
check:rc==0
check:output=~hmc\-template \(node\)
check:output=~ppc64le\-template \(node\)
check:output=~ppc64lekvmguest\-template \(node\)
check:output=~switch\-template \(node\)
check:output=~x86_64\-template \(node\)
check:output=~x86_64kvmguest\-template \(node\)
end
start:lsdef_template_switch_template
os:linux
description:check xCAT supported template for switch template
cmd:lsdef --template switch-template
check:rc==0
check:output=~Object name\: switch-template
check:output=~groups=switch
check:output=~nodetype=switch
check:output=~postbootscripts\=otherpkgs
check:output=~postscripts\=syslog\,remoteshell\,syncfiles
check:output=~usercomment\=the switch definition template
check:output=~postscripts\=syslog\,remoteshell\,syncfiles
check:output=~ip\=OPTIONAL\:the ip address of the switch
check:output=~mac\=OPTIONAL\:the MAC address of the switch
check:output=~switchtype\=OPTIONAL\:The type of switch
end
start:lsdef_template_with_invalid_name
os:linux
description:lsdef --template with invalid template name
cmd:result=`lsdef | grep test_with_invalid_name`; if [[ $result =~ "test_with_invalid_name" ]]; then noderm test_with_invalid_name; fi
cmd:lsdef --template "test_with_invalid_name"
check:rc==1
check:output=~Error: Could not find test_with_invalid_name in xCAT templates.
end

View File

@@ -159,4 +159,168 @@ check:output=~not a valid
end
start:mkdef_template_switch_template_without_attribute
os:linux
description:create a node with swtich template without any attributes
cmd:result=`lsdef | grep auto_test_node_1`; if [[ $result =~ "auto_test_node_1" ]]; then echo $result; noderm auto_test_node_1; fi
cmd:mkdef -t node -o auto_test_node_1 --template switch-template
check:rc==0
check:output=~1 object definitions have been created or modified.
cmd:lsdef auto_test_node_1
check:rc==0
check:output=~Object name\: auto_test_node_1
check:output=~groups=switch
check:output=~nodetype=switch
check:output=~postbootscripts\=otherpkgs
check:output=~postscripts\=syslog\,remoteshell\,syncfiles
check:output=~usercomment\=the switch definition template
check:output=~postscripts\=syslog\,remoteshell\,syncfiles
check:output!=ip\=OPTIONAL\:the ip address of the switch
check:output!=mac\=OPTIONAL\:the MAC address of the switch
check:output!=switchtype\=
cmd:noderm auto_test_node_1
check:rc==0
end
start:mkdef_template_cec_template_without_remainder
os:linux
description:create a node with cec template once
cmd:result=`lsdef | grep auto_test_cec_node_1`; if [[ $result =~ "auto_test_cec_node_1" ]]; then echo $result; noderm auto_test_cec_node_1; fi
cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test mtm=test hcp=test
checkrc==0
check:output=~1 object definitions have been created or modified
cmd:lsdef auto_test_cec_node_1
check:output=~Object name\: auto\_test\_cec\_node\_1
check:output=~groups\=cec\,all
check:output=~hwtype\=cec
check:output=~mgt\=hmc
check:output=~nodetype\=ppc
check:output=~postbootscripts\=otherpkgs
check:output=~postscripts\=syslog\,remoteshell\,syncfiles
check:output=~usercomment\=the cec definition template
check:output=~hcp\=test
check:output=~mtm\=test
check:output=~serial\=test
cmd:noderm auto_test_cec_node_1
check:rc==0
end
start:mkdef_template_invalid_template
os:linux
description:create a node with invalid template
cmd:result=`lsdef | grep auto_test_node`; if [[ $result =~ "auto_test_node" ]]; then echo $result; noderm auto_test_node; fi
cmd:result=`lsdef | grep auto_test_invalid_template`; if [[ $result =~ "auto_test_invalid_template" ]]; then echo $result; noderm auto_test_invalid_template; fi
cmd:lsdef --template auto_test_invalid_template
check:rc==1
check:output=~Error\: Could not find auto\_test\_invalid\_template in xCAT templates
cmd:mkdef -t node -o auto_test_node --template auto_test_invalid_template
checkrc==1
check:output=~Error\: Could not find the template object named \'auto\_test\_invalid\_template\' of type \'node\'
end
start:mkdef_node_with_a_node_template
os:linux
description:create a node with a node template, using cec template to create node at beginning
cmd:result=`lsdef | grep auto_test_cec_node_1`; if [[ $result =~ "auto_test_cec_node_1" ]]; then echo $result; noderm auto_test_cec_node_1; fi
cmd:result=`lsdef | grep auto_test_cec_node_2`; if [[ $result =~ "auto_test_cec_node_2" ]]; then echo $result; noderm auto_test_cec_node_2; fi
cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test mtm=test hcp=test groups=test_template
checkrc==0
check:output=~1 object definitions have been created or modified
check:output=~created
cmd:mkdef -t node -o auto_test_cec_node_2 --template auto_test_cec_node_1 serial=test2 mtm=test2 hcp=test2
checkrc==0
check:output=~1 object definitions have been created or modified
cmd:lsdef auto_test_cec_node_2
check:output=~Object name\: auto\_test\_cec\_node\_2
check:output=~groups\=test\_template
check:output!=groups\=cec\,all
check:output=~hwtype\=cec
check:output=~mgt\=hmc
check:output=~nodetype\=ppc
check:output=~postbootscripts\=otherpkgs
check:output=~postscripts\=syslog\,remoteshell\,syncfiles
check:output=~usercomment\=the cec definition template
check:output=~hcp\=test2
check:output=~mtm\=test2
check:output=~serial\=test2
cmd:noderm auto_test_cec_node_1
check:rc==0
cmd:noderm auto_test_cec_node_2
check:rc==0
end
start:mkdef_template_cec_template_step_by_step
os:linux
description:create a node with cec template step by step
cmd:result=`lsdef | grep auto_test_cec_node_1`; if [[ $result =~ "auto_test_cec_node_1" ]]; then echo $result; noderm auto_test_cec_node_1; fi
cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template
check:rc==1
check:output=~Error\: The attribute \"serial\" must be specified!
cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test
check:rc==1
check:output=~Error\: The attribute \"mtm\" must be specified!
cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test mtm=test
check:rc==1
check:output=~Error\: The attribute \"hcp\" must be specified!
cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test mtm=test hcp=test
checkrc==0
check:output=~1 object definitions have been created or modified
cmd:lsdef auto_test_cec_node_1
check:output=~Object name\: auto\_test\_cec\_node\_1
check:output=~groups\=cec\,all
check:output=~hwtype\=cec
check:output=~mgt\=hmc
check:output=~nodetype\=ppc
check:output=~postbootscripts\=otherpkgs
check:output=~postscripts\=syslog\,remoteshell\,syncfiles
check:output=~usercomment\=the cec definition template
check:output=~hcp\=test
check:output=~mtm\=test
check:output=~serial\=test
cmd:noderm auto_test_cec_node_1
check:rc==0
end
start:check_mkdef_node_with_template_priority
os:linux
description:create node named cec-template with cec template at beginning, the node is priority high than tempalate to create a new node
cmd:result=`lsdef | grep cec-template`; if [[ $result =~ "cec-template" ]]; then echo $result; noderm cec-template; fi
cmd:result=`lsdef | grep auto_test_cec_node`; if [[ $result =~ "auto_test_cec_node" ]]; then echo $result; noderm auto_test_cec_node; fi
cmd:mkdef -t node -o cec-template --template cec-template serial=test mtm=test hcp=test groups=test_template_priority
checkrc==0
check:output=~1 object definitions have been created or modified
cmd:mkdef -t node -o auto_test_cec_node --template cec-template serial=test2 mtm=test2 hcp=test2
checkrc==0
check:output=~1 object definitions have been created or modified
cmd:lsdef auto_test_cec_node
check:output=~Object name\: auto\_test\_cec\_node
check:output=~groups\=test\_template\_priority
check:output!=groups\=cec\,all
check:output=~hwtype\=cec
check:output=~mgt\=hmc
check:output=~nodetype\=ppc
check:output=~postbootscripts\=otherpkgs
check:output=~postscripts\=syslog\,remoteshell\,syncfiles
check:output=~usercomment\=the cec definition template
check:output=~hcp\=test2
check:output=~mtm\=test2
check:output=~serial\=test2
cmd:noderm cec-template
checkrc==0
cmd:noderm auto_test_cec_node
checkrc==0
end
start:mkdef_template_diskless_osimage_rootimgdir
os:linux
description:check rootimgdir warning message after make new osimage with mkdef --template
cmd:mkdef -t osimage -o test-osimage_with_template --template __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute
check:rc==0
output=~1 object definitions have been created or modified
cmd:xcatprobe osimagecheck
check:output=~Identical root image directory
check:output=~test-osimage
check:output=~__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute
cmd:rmdef -t osimage -o test-osimage_with_template
check:rc==0
end

View File

@@ -128,3 +128,13 @@ cmd:rmdef -t wrongtype -o testnode
check:rc!=0
check:output=~not a valid
end
start:rmdef_template
os:linux
description:try to delete a template, then error messages appear
cmd:result=`lsdef | grep switch-template`; if [[ $result =~ "switch-template" ]]; then echo $result; noderm switch-template; fi
cmd:rmdef switch-template
checkrc==1
check:output=~Error\: Could not find an object named \'switch-template\' of type \'node\'
check:output=~No objects have been removed from the xCAT database.
end