2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 09:36:41 +00:00

Add one test case for xcat-inventory export option -f (#5244)

This commit is contained in:
Weihua Hu 2018-05-24 16:15:45 +08:00 committed by yangsong
parent dd15abe6e5
commit 21c6c3a907

View File

@ -53,13 +53,47 @@ check:output!~Traceback (most recent call last):
check:rc!=0
end
#start:xcat_inventory_export_option_f_invalid_file
#description:This case is used to test xcat-inventory export subcommand to handle invalid file for option f
#cmd:xcat-inventory export -f aaa
#check:output=~The specified path does not exist
#check:output !~Traceback
#check:rc!=0
#end
start:xcat_inventory_export_option_f
description:This case is used to test xcat-inventory export subcommand to handle option f
cmd:dir="/tmp/xcat_inventory_export_option_f";echo ${dir}".old";if [ -d "${dir}" ];then mv ${dir} ${dir}".old"; fi; mkdir -p $dir
check:rc==0
cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/xcat_inventory_export_option_f/bogusnode.stanza ;rmdef bogusnode;fi
check:rc==0
cmd:mkdef -t node -o bogusnode groups=bogusgroup
check:rc==0
cmd:xcat-inventory export --format=yaml -t node -o bogusnode | tee /tmp/xcat_inventory_export_option_f/export_yaml_without_f
check:rc==0
cmd:xcat-inventory export --format=yaml -t node -o bogusnode -f /tmp/xcat_inventory_export_option_f/export_yaml_with_f
check:rc==0
check:output !~Traceback
cmd:diff /tmp/xcat_inventory_export_option_f/export_yaml_without_f /tmp/xcat_inventory_export_option_f/export_yaml_with_f
check:rc==0
cmd:xcat-inventory export -t node -o bogusnode | tee /tmp/xcat_inventory_export_option_f/export_json_without_f
check:rc==0
cmd:xcat-inventory export -t node -o bogusnode --path /tmp/xcat_inventory_export_option_f/export_json_with_f
check:rc==0
cmd:diff /tmp/xcat_inventory_export_option_f/export_json_without_f /tmp/xcat_inventory_export_option_f/export_json_with_f
check:rc==0
cmd:xcat-inventory export -t node -o bogusnode -f
check:rc!=0
check:output ~=usage
check:output ~= error: argument -f/--path: expected one argument
cmd:xcat-inventory export -t node -o bogusnode --path
check:rc!=0
eck:output ~=usage
check:output ~= error: argument -f/--path: expected one argument
cmd:mkdir /tmp/xcat_inventory_export_option_f/testdir
check:rc==0
cmd:xcat-inventory export -t node -o bogusnode -f /tmp/xcat_inventory_export_option_f/testdir
check:rc!=0
check:output ~= Error: the specified file /tmp/xcat_inventory_export_option_f/testdir already exists, is not a file!
cmd:rmdef bogusnode
check:rc==0
cmd:if [[ -e /tmp/xcat_inventory_export_option_f/bogusnode.stanza ]]; then cat /tmp/xcat_inventory_export_option_f/bogusnode.stanza | mkdef -z;fi
check:rc==0
cmd:dir="/tmp/xcat_inventory_export_option_f"; rm -rf $dir; if [ -d ${dir}".old" ];then mv ${dir}".old" $dir; fi
check:rc==0
end
start:xcat_inventory_import_option_f_invalid_file
description:This case is used to test xcat-inventory import subcommand to handle invalid file for option f