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

add case for task 164,exporting the files referred in #INCLUDE:# in pkglist, otherpkglist, etc.. for xcat-inventory (#5282)

* add case for task 164,exporting the files referred in #INCLUDE:# in pkglist, otherpkglist, etc.. for xcat-inventory

* update according to comments

* correct the export and import result directories,and remove unwantd files

* update label for this case
This commit is contained in:
tingtli 2018-06-15 17:48:27 +08:00 committed by yangsong
parent c49e41da99
commit fde918f751
22 changed files with 97 additions and 0 deletions

View File

@ -0,0 +1,42 @@
start:export_import_osimage_with_INCLUDE_in_file
description:This case is used to test xcat-inventory export and import one linux osimage definition which has INCLUDE in the attribute's specified files. The attributes are pkglist, otherpkglist,exlist,synclists,template,postinstall and partitionfile.
label:xcat-inventory
cmd:dir="/tmp/imagedata/";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi; mkdir -p $dir
check:rc==0
cmd:dir="/tmp/imagedata/export";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi; mkdir -p $dir
check:rc==0
cmd:cp -rf /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage /tmp/imagedata
check:rc==0
cmd:lsdef -t osimage -o test_osimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_osimage -z >/tmp/imagedata/test_osimage.org.stanza ;rmdef -t osimage -o test_osimage;fi
check:rc==0
cmd:cat /tmp/imagedata/test_osimage/test_osimage.stanza |mkdef -z
check:rc==0
cmd:rm -rf /tmp/imagedata/test_osimage/test_osimage.stanza
cmd:lsdef -t osimage -o test_osimage
check:rc==0
cmd:xcat-inventory export -t osimage -o test_osimage -d /tmp/imagedata/export
check:output=~The osimage objects has been exported to directory /tmp/imagedata/export
cmd:ls -lFR /tmp/imagedata/export
cmd:diff -r /tmp/imagedata/test_osimage /tmp/imagedata/export/test_osimage/tmp/imagedata/test_osimage/
check:output=~Only in /tmp/imagedata/test_osimage: file7
cmd:diff -y /etc/hosts /tmp/imagedata/export/test_osimage/etc/hosts
check:rc==0
cmd:ls -l /tmp/imagedata/export/test_osimage/tmp/imagedata/test_osimage/file7
check:rc!=0
cmd: rmdef -t osimage -o test_osimage
check:rc==0
cmd:rm -rf /tmp/imagedata/test_osimage
cmd:xcat-inventory import -t osimage -d /tmp/imagedata/export
check:rc==0
check:output=~Importing object: test_osimage
check:output=~Inventory import successfully!
check:output=~The object test_osimage has been imported
cmd:lsdef -t osimage -o test_osimage
check:rc==0
cmd:diff -r /tmp/imagedata/export/test_osimage/tmp/imagedata/test_osimage/ /tmp/imagedata/test_osimage
check:rc==0
cmd: rmdef -t osimage -o test_osimage
check:rc==0
cmd:dir="/tmp/imagedata"; rm -rf $dir; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi
cmd: if [ -e /tmp/imagedata/test_osimage.org.stanza ]; then cat /tmp/imagedata/test_osimage.org.stanza |mkdef -z;fi
end

View File

@ -0,0 +1,2 @@
#Test file for exlist
#INCLUDE: /tmp/imagedata/test_osimage/file1.1#

View File

@ -0,0 +1,2 @@
###Test file without INCLUDE
AAA

View File

@ -0,0 +1,2 @@
###Test file with one INCLUDE in the file
AAA

View File

@ -0,0 +1,2 @@
###Test file with one INCLUDE in the file
BBB

View File

@ -0,0 +1,2 @@
###Test file with one INCLUDE in the file
CCC

View File

@ -0,0 +1,2 @@
###Test file with serverl INCLUDE in the file
#INCLUDE:/tmp/imagedata/test_osimage/file3.2#

View File

@ -0,0 +1,2 @@
###Test file with serverl INCLUDE in the file
#INCLUDE:/tmp/imagedata/test_osimage/file3.3#

View File

@ -0,0 +1,2 @@
###Test file with serverl INCLUDE in the file
AAA

View File

@ -0,0 +1,2 @@
#Test file for INCLUDE nesting file
#INCLUDE:/tmp/imagedata/test_osimage/file4.2#

View File

@ -0,0 +1,2 @@
#Test file for INCLUDE nesting file
#INCLUDE:/tmp/imagedata/test_osimage/file4.3#

View File

@ -0,0 +1,2 @@
#Test file for INCLUDE nesting file
#INCLUDE:/tmp/imagedata/test_osimage/file4.1#

View File

@ -0,0 +1,2 @@
#Test file for INCLUDE nesting file
#INCLUDE:/etc/hosts#

View File

@ -0,0 +1,2 @@
#Test file for INCLUDE nesting file
AAA

View File

@ -0,0 +1,2 @@
#Test file for INCLUDE nesting file
AAA

View File

@ -0,0 +1,4 @@
#Test file for otherpkglist
#INCLUDE: /tmp/imagedata/test_osimage/file2.1#
#INCLUDE: /tmp/imagedata/test_osimage/file2.2#
#INCLUDE: /tmp/imagedata/test_osimage/file2.3#

View File

@ -0,0 +1,2 @@
#Test file for otherpkglist
#INCLUDE: /tmp/imagedata/test_osimage/file3.1#

View File

@ -0,0 +1,2 @@
#Test file for otherpkglist
#INCLUDE: /tmp/imagedata/test_osimage/file4.1#

View File

@ -0,0 +1,2 @@
#Test file for otherpkglist
#INCLUDE: /tmp/imagedata/test_osimage/file5#

View File

@ -0,0 +1,2 @@
#Test file for synclists
#INCLUDE: ./file6#

View File

@ -0,0 +1,2 @@
#Test file for template
#INCLUDE: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file7#

View File

@ -0,0 +1,13 @@
# <xCAT data object stanza file>
test_osimage:
objtype=osimage
exlist=/tmp/imagedata/test_osimage/exlist
imagetype=linux
otherpkglist=/tmp/imagedata/test_osimage/otherpkglist
partitionfile=/tmp/imagedata/test_osimage/partitionfile
pkglist=/tmp/imagedata/test_osimage/pkglist
postinstall=/tmp/imagedata/test_osimage/postinstall
provmethod=install
synclists=/tmp/imagedata/test_osimage/synclists
template=/tmp/imagedata/test_osimage/template.tmpl