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

update case for task 189,xcat-inventory osimage support environment variables(export part) (#5314)

* update case for task 189,xcat-inventory osimage support environment variables(export part)

* update case according to yaml file format change

* update import file for json format

* put stanza file and compare the stanza file
This commit is contained in:
tingtli
2018-07-04 15:32:24 +08:00
committed by yangsong
parent cae4061743
commit c8519de26d
4 changed files with 148 additions and 0 deletions

View File

@@ -78,3 +78,45 @@ check:rc==0
cmd:xdsh $$CN "rpm -qa |grep -w dhcp"
check:rc==0
end
start:export_osimage_with_environments
description:this case is to verify if osimage export could support environment variables.
os:Linux
label:others,xcat_inventory
cmd:lsdef -t osimage -o test.environments.osimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test.environments.osimage -z >/tmp/test.environments.osimage_image.stanza ;rmdef -t osimage -o test.environments.osimage;fi
check:rc==0
cmd:dir="/tmp/export";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi; mkdir -p $dir
cmd:export GITREPO="/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo";export SWDIR="/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/swdir";xcat-inventory import -f /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.yaml
check:output=~Importing object: test.environments.osimage
check:output=~Inventory import successfully!
check:rc==0
cmd:lsdef -t osimage -o test.environments.osimage -z >> /tmp/export/test.environments.osimage.yaml.stanza
check:rc==0
cmd:diff -y /tmp/export/test.environments.osimage.yaml.stanza /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.stanza
check:rc==0
cmd:xcat-inventory export -t osimage -o test.environments.osimage -f /tmp/export/test.environments.osimage.yaml --format yaml
check:rc==0
check:output=~The inventory data has been dumped to /tmp/export/test.environments.osimage.yaml
cmd:diff -y /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.yaml /tmp/export/test.environments.osimage.yaml --ignore-blank-lines -I "^#"
check:rc==0
cmd:rmdef -t osimage -o test.environments.osimage
check:rc==0
cmd:export GITREPO="/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo";export SWDIR="/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/swdir";xcat-inventory import -f /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.json
check:output=~Importing object: test.environments.osimage
check:output=~Inventory import successfully!
check:rc==0
cmd:lsdef -t osimage -o test.environments.osimage -z >> /tmp/export/test.environments.osimage.json.stanza
check:rc==0
cmd:diff -y /tmp/export/test.environments.osimage.json.stanza /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.stanza
check:rc==0
cmd:xcat-inventory export -t osimage -o test.environments.osimage -f /tmp/export/test.environments.osimage.json
check:rc==0
cmd:diff -y /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.json /tmp/export/test.environments.osimage.json --ignore-blank-lines -I "^#"
check:rc==0
cmd:dir="/tmp/export"; rm -rf $dir; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi
cmd: rmdef -t osimage -o test.environments.osimage
check:rc==0
cmd: if [ -e /tmp/test.environments.osimage.stanza ]; then cat /tmp/test.environments.osimage.stanza |mkdef -z;fi
end

View File

@@ -0,0 +1,21 @@
# <xCAT data object stanza file>
test.environments.osimage:
objtype=osimage
environvar=GITREPO=/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo,SWDIR=/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/swdir
imagetype=linux
osarch=ppc64le
osdistroname=rhels7.5-alternate-ppc64le
osname=Linux
osvers=rhels7.5-alternate
otherpkgdir=/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/swdir/otherpkgdir/
otherpkglist=/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo/otherpkglist/test1.otherpkglist,/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo/otherpkglist/test2.otherpkglist,
permission=755
pkgdir=/install/rhels7.5-alternate/ppc64le,/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/swdir/pkgdir/
pkglist=/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.pkglist,/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo/pkglist/test1.pkglist,/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo/pkglist/test2.pkglist
postinstall=/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.postinstall,/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo/postinstall/test1.postinstall
profile=compute
provmethod=netboot
rootimgdir=/install/custom/test.environments.osimage
synclists=/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo/syncfiles/synclist
usercomment=rhels7.5,test_environment_variables

View File

@@ -0,0 +1,50 @@
{
"osimage": {
"test.environments.osimage": {
"basic_attributes": {
"arch": "ppc64le",
"distribution": "rhels7.5-alternate",
"osdistro": "rhels7.5-alternate-ppc64le",
"osname": "Linux"
},
"deprecated": {
"comments": "rhels7.5,test_environment_variables"
},
"filestosync": [
"{{GITREPO}}/syncfiles/synclist"
],
"genimgoptions": {
"permission": "755",
"postinstall": [
"/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.postinstall",
"{{GITREPO}}/postinstall/test1.postinstall"
],
"rootimgdir": "/install/custom/test.environments.osimage"
},
"imagetype": "linux",
"package_selection": {
"otherpkgdir": [
"{{SWDIR}}/otherpkgdir/"
],
"otherpkglist": [
"{{GITREPO}}/otherpkglist/test1.otherpkglist",
"{{GITREPO}}/otherpkglist/test2.otherpkglist",
""
],
"pkgdir": [
"/install/rhels7.5-alternate/ppc64le",
"{{SWDIR}}/pkgdir/"
],
"pkglist": [
"/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.pkglist",
"{{GITREPO}}/pkglist/test1.pkglist",
"{{GITREPO}}/pkglist/test2.pkglist"
]
},
"provision_mode": "netboot",
"role": "compute"
}
},
"schema_version": "1.0"
}
#Version 2.14.2 (git commit 09f0772835afdc0f962c9e7fe8cef862e9505ad7, built Tue Jun 19 01:58:56 EDT 2018)

View File

@@ -0,0 +1,35 @@
osimage:
test.environments.osimage:
basic_attributes:
arch: ppc64le
distribution: rhels7.5-alternate
osdistro: rhels7.5-alternate-ppc64le
osname: Linux
deprecated:
comments: rhels7.5,test_environment_variables
filestosync:
- '{{GITREPO}}/syncfiles/synclist'
genimgoptions:
permission: '755'
postinstall:
- /opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.postinstall
- '{{GITREPO}}/postinstall/test1.postinstall'
rootimgdir: /install/custom/test.environments.osimage
imagetype: linux
package_selection:
otherpkgdir:
- '{{SWDIR}}/otherpkgdir/'
otherpkglist:
- '{{GITREPO}}/otherpkglist/test1.otherpkglist'
- '{{GITREPO}}/otherpkglist/test2.otherpkglist'
- ''
pkgdir:
- /install/rhels7.5-alternate/ppc64le
- '{{SWDIR}}/pkgdir/'
pkglist:
- /opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.pkglist
- '{{GITREPO}}/pkglist/test1.pkglist'
- '{{GITREPO}}/pkglist/test2.pkglist'
provision_mode: netboot
role: compute
schema_version: '1.0'