mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-06-08 14:30:08 +00:00
Merge pull request #5243 from immarvin/ontest
add test cases for xcat-inventory import -d for osimage inventory directory
This commit is contained in:
commit
dd15abe6e5
xCAT-test/autotest/testcase/xcat-inventory
cases.osimage.import_from_osimage_dir
templates/cluster_invdir
@ -0,0 +1,125 @@
|
||||
start:export_import_an_osimage_directory
|
||||
description: import an osimage diretory with `xcat-inventroy import -d <osimage directory>`
|
||||
#backup any existing test_myimage
|
||||
cmd:mkdir -p /tmp/export_import_an_osimage_directory/backup
|
||||
check:rc==0
|
||||
cmd:lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage -z >/tmp/export_import_an_osimage_directory/backup/test_myimage.stanza;fi
|
||||
|
||||
#remove any existing test_myimage
|
||||
cmd:rmdef -t osimage -o test_myimage
|
||||
cmd: lsdef -t osimage -o test_myimage
|
||||
check:rc!=0
|
||||
cmd:dir="/tmp/test_myimage";if [ -d "${dir}" ];then mv ${dir} ${dir}".old"; fi
|
||||
|
||||
#import test_myimage
|
||||
cmd: xcat-inventory import -d /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage
|
||||
check:rc==0
|
||||
|
||||
#check whether the osimage definition is created
|
||||
cmd: lsdef -t osimage -o test_myimage -z |tee /tmp/export_import_an_osimage_directory/test_myimage.stanza
|
||||
check:rc==0
|
||||
cmd: diff /tmp/export_import_an_osimage_directory/test_myimage.stanza /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/test_myimage.stanza
|
||||
check: rc==0
|
||||
#check whether the customized osimage files are imported
|
||||
cmd: diff -r /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/ /tmp/test_myimage/
|
||||
check:rc==0
|
||||
|
||||
#cleanup
|
||||
cmd:rmdef -t osimage -o test_myimage
|
||||
cmd:dir="/tmp/test_myimage"; rm -rf $dir; if [ -d ${dir}".old" ];then mv ${dir}".old" $dir; fi
|
||||
|
||||
#restore the original test_myimage if any
|
||||
cmd: if [ -e '/tmp/export_import_an_osimage_directory/backup/test_myimage.stanza' ]; then cat /tmp/export_import_an_osimage_directory/backup/test_myimage.stanza|mkdef -z;fi
|
||||
cmd: rm -rf /tmp/export_import_an_osimage_directory
|
||||
end
|
||||
|
||||
|
||||
#################################################################################
|
||||
|
||||
start:export_import_multiple_osimages_from_osimage_directory
|
||||
description: import multiple osimage diretories with `xcat-inventroy import -d <osimage directory>`
|
||||
#backup any existing test_myimage,test_myimage2
|
||||
cmd:mkdir -p /tmp/export_import_multiple_osimages_from_osimage_directory/backup
|
||||
check:rc==0
|
||||
cmd:lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage -z >/tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage.stanza;fi
|
||||
cmd:lsdef -t osimage -o test_myimage2 >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage2 -z >/tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage2.stanza;fi
|
||||
|
||||
#remove any existing test_myimage,test_myimage2
|
||||
cmd:rmdef -t osimage -o test_myimage,test_myimage2
|
||||
cmd: lsdef -t osimage -o test_myimage
|
||||
check:rc!=0
|
||||
cmd: lsdef -t osimage -o test_myimage2
|
||||
check:rc!=0
|
||||
cmd:dir="/tmp/test_myimage";if [ -d "${dir}" ];then mv ${dir} ${dir}".old"; fi
|
||||
cmd:dir="/tmp/test_myimage2";if [ -d "${dir}" ];then mv ${dir} ${dir}".old"; fi
|
||||
|
||||
#import osimages
|
||||
cmd: xcat-inventory import -d /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/
|
||||
check:rc==0
|
||||
|
||||
#check whether the osimage definition is created
|
||||
cmd: lsdef -t osimage -o test_myimage -z | tee /tmp/export_import_multiple_osimages_from_osimage_directory/test_myimage.stanza
|
||||
check:rc==0
|
||||
cmd: lsdef -t osimage -o test_myimage2 -z | tee /tmp/export_import_multiple_osimages_from_osimage_directory/test_myimage2.stanza
|
||||
check:rc==0
|
||||
cmd: diff /tmp/export_import_multiple_osimages_from_osimage_directory/test_myimage.stanza /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/test_myimage.stanza
|
||||
check: rc==0
|
||||
cmd: diff /tmp/export_import_multiple_osimages_from_osimage_directory/test_myimage2.stanza /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/test_myimage2.stanza
|
||||
check: rc==0
|
||||
#check whether the customized osimage files are imported
|
||||
cmd: diff -r /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/ /tmp/test_myimage/
|
||||
check:rc==0
|
||||
cmd: diff -r /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/ /tmp/test_myimage2/
|
||||
check:rc==0
|
||||
|
||||
#cleanup
|
||||
cmd:rmdef -t osimage -o test_myimage
|
||||
cmd:dir="/tmp/test_myimage"; rm -rf $dir; if [ -d ${dir}".old" ];then mv ${dir}".old" $dir; fi
|
||||
|
||||
cmd:rmdef -t osimage -o test_myimage2
|
||||
cmd:dir="/tmp/test_myimage2"; rm -rf $dir; if [ -d ${dir}".old" ];then mv ${dir}".old" $dir; fi
|
||||
|
||||
#restore the original osimages if any
|
||||
cmd: if [ -e '/tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage.stanza' ]; then cat /tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage.stanza|mkdef -z;fi
|
||||
|
||||
cmd: if [ -e '/tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage2.stanza' ]; then cat /tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage2.stanza|mkdef -z; fi
|
||||
|
||||
cmd: rm -rf /tmp/export_import_multiple_osimages_from_osimage_directory
|
||||
end
|
||||
|
||||
################################################3
|
||||
|
||||
start:export_import_specified_from_osimage_directory
|
||||
description: import specified osimage from osimage diretory with `xcat-inventroy import -d <osimage directory> -t osimage -o`
|
||||
#backup any existing test_myimage
|
||||
cmd:mkdir -p /tmp/export_import_specified_from_osimage_directory/backup
|
||||
check:rc==0
|
||||
cmd:lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage -z >/tmp/export_import_specified_from_osimage_directory/backup/test_myimage.stanza;fi
|
||||
|
||||
#remove any existing test_myimage
|
||||
cmd:rmdef -t osimage -o test_myimage
|
||||
cmd: lsdef -t osimage -o test_myimage
|
||||
check:rc!=0
|
||||
cmd:dir="/tmp/test_myimage";if [ -d "${dir}" ];then mv ${dir} ${dir}".old"; fi
|
||||
|
||||
#import test_myimage
|
||||
cmd: xcat-inventory import -d /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/ -t osimage -o test_myimage
|
||||
check:rc==0
|
||||
|
||||
#check whether the osimage definition is created
|
||||
cmd: lsdef -t osimage -o test_myimage -z |tee /tmp/export_import_specified_from_osimage_directory/test_myimage.stanza
|
||||
check:rc==0
|
||||
cmd: diff /tmp/export_import_specified_from_osimage_directory/test_myimage.stanza /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/test_myimage.stanza
|
||||
check: rc==0
|
||||
#check whether the customized osimage files are imported
|
||||
cmd: diff -r /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/ /tmp/test_myimage/
|
||||
check:rc==0
|
||||
|
||||
#cleanup
|
||||
cmd:rmdef -t osimage -o test_myimage
|
||||
cmd:dir="/tmp/test_myimage"; rm -rf $dir; if [ -d ${dir}".old" ];then mv ${dir}".old" $dir; fi
|
||||
|
||||
#restore the original test_myimage if any
|
||||
cmd: if [ -e '/tmp/export_import_specified_from_osimage_directory/backup/test_myimage.stanza' ]; then cat /tmp/export_import_specified_from_osimage_directory/backup/test_myimage.stanza|mkdef -z;fi
|
||||
cmd: rm -rf /tmp/export_import_specified_from_osimage_directory
|
||||
end
|
@ -0,0 +1 @@
|
||||
|
21
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/definition.json
Normal file
21
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/definition.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"osimage": {
|
||||
"test_myimage": {
|
||||
"diskpartitionspec": "/tmp/test_myimage/partitionfile",
|
||||
"filestosync": "/tmp/test_myimage/synclists",
|
||||
"genimgoptions": {
|
||||
"exlist": "/tmp/test_myimage/exlist",
|
||||
"postinstall": "/tmp/test_myimage/postinstall"
|
||||
},
|
||||
"imagetype": "linux",
|
||||
"package_selection": {
|
||||
"otherpkglist": "/tmp/test_myimage/otherpkglist",
|
||||
"pkglist": "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist"
|
||||
},
|
||||
"provision_mode": "install",
|
||||
"template": "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl"
|
||||
}
|
||||
},
|
||||
"schema_version": "1.0"
|
||||
}
|
||||
#Version 2.14.1 (git commit ac941fd2501e8a581bfcc4c79b9301f6ec37ab93, built Mon May 21 06:15:46 EDT 2018)
|
13
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/test_myimage.stanza
Normal file
13
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/test_myimage.stanza
Normal file
@ -0,0 +1,13 @@
|
||||
# <xCAT data object stanza file>
|
||||
|
||||
test_myimage:
|
||||
objtype=osimage
|
||||
exlist=/tmp/test_myimage/exlist
|
||||
imagetype=linux
|
||||
otherpkglist=/tmp/test_myimage/otherpkglist
|
||||
partitionfile=/tmp/test_myimage/partitionfile
|
||||
pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist
|
||||
postinstall=/tmp/test_myimage/postinstall
|
||||
provmethod=install
|
||||
synclists=/tmp/test_myimage/synclists
|
||||
template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl
|
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/exlist
Normal file
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/exlist
Normal file
@ -0,0 +1 @@
|
||||
exlist
|
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/otherpkglist
Normal file
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/otherpkglist
Normal file
@ -0,0 +1 @@
|
||||
otherpkglist
|
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/partitionfile
Normal file
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/partitionfile
Normal file
@ -0,0 +1 @@
|
||||
partitionfile
|
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/postinstall
Normal file
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/postinstall
Normal file
@ -0,0 +1 @@
|
||||
postinstall
|
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/synclists
Normal file
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/synclists
Normal file
@ -0,0 +1 @@
|
||||
synclists
|
21
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/definition.json
Normal file
21
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/definition.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"osimage": {
|
||||
"test_myimage2": {
|
||||
"diskpartitionspec": "/tmp/test_myimage2/partitionfile",
|
||||
"filestosync": "/tmp/test_myimage2/synclists",
|
||||
"genimgoptions": {
|
||||
"exlist": "/tmp/test_myimage2/exlist",
|
||||
"postinstall": "/tmp/test_myimage2/postinstall"
|
||||
},
|
||||
"imagetype": "linux",
|
||||
"package_selection": {
|
||||
"otherpkglist": "/tmp/test_myimage2/otherpkglist",
|
||||
"pkglist": "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist"
|
||||
},
|
||||
"provision_mode": "install",
|
||||
"template": "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl"
|
||||
}
|
||||
},
|
||||
"schema_version": "1.0"
|
||||
}
|
||||
#Version 2.14.1 (git commit ac941fd2501e8a581bfcc4c79b9301f6ec37ab93, built Mon May 21 06:15:46 EDT 2018)
|
13
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/test_myimage2.stanza
Normal file
13
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/test_myimage2.stanza
Normal file
@ -0,0 +1,13 @@
|
||||
# <xCAT data object stanza file>
|
||||
|
||||
test_myimage2:
|
||||
objtype=osimage
|
||||
exlist=/tmp/test_myimage2/exlist
|
||||
imagetype=linux
|
||||
otherpkglist=/tmp/test_myimage2/otherpkglist
|
||||
partitionfile=/tmp/test_myimage2/partitionfile
|
||||
pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist
|
||||
postinstall=/tmp/test_myimage2/postinstall
|
||||
provmethod=install
|
||||
synclists=/tmp/test_myimage2/synclists
|
||||
template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl
|
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/exlist
Normal file
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/exlist
Normal file
@ -0,0 +1 @@
|
||||
exlist
|
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/otherpkglist
Normal file
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/otherpkglist
Normal file
@ -0,0 +1 @@
|
||||
otherpkglist
|
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/partitionfile
Normal file
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/partitionfile
Normal file
@ -0,0 +1 @@
|
||||
partitionfile
|
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/postinstall
Normal file
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/postinstall
Normal file
@ -0,0 +1 @@
|
||||
postinstall
|
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/synclists
Normal file
1
xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/synclists
Normal file
@ -0,0 +1 @@
|
||||
synclists
|
Loading…
x
Reference in New Issue
Block a user