2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2024-11-21 09:02:00 +00:00
3 Test Design of xcat inventory osimage environment variables export part
tingtli edited this page 2018-07-05 10:15:17 +08:00

Introduction

This document provides an overview of test environment variables in osimage definition files. This test plan is intended for the use of xCAT FVT team.

The test is against xCAT version 2.14.2. The build of xCAT will be picked up from the xcat.org

The xcat inventory osimage design is under https://github.com/xcat2/xcat-inventory/pull/45

Affected attributes

The follow attributes in xcat osimage inventory file might include other files by #INCLUDE:xxxxx# :

package_selection. pkglist
package_selection. otherpkglist
filestosync
genimgoptions.postinstall

According to the attributes in osimage inventory file. The attributes in osimage definition could be tested

   pkglist
   otherpkglist
   synclists   
   postinstall

Test steps

  1. create a yaml file
cat test.osimage.environments.yaml
osimage:
  test.osimage.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'
  1. under /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/, create a directory to hold all the files for GITREPO and SWDIR
environment/:
total 8
drwxr-xr-x 6 root root 4096 Jun 12 03:31 gitrepo/
drwxr-xr-x 4 root root 4096 Jun 12 03:39 swdir/

environment/gitrepo:
total 16
drwxr-xr-x 2 root root 4096 Jun 12 03:31 otherpkglist/
drwxr-xr-x 2 root root 4096 Jun 12 03:32 pkglist/
drwxr-xr-x 2 root root 4096 Jun 12 03:29 postinstall/
drwxr-xr-x 2 root root 4096 Jun 12 03:30 syncfiles/

environment/gitrepo/otherpkglist:
total 0
-rw-r--r-- 1 root root 0 Jun 12 03:31 test1.otherpkglist
-rw-r--r-- 1 root root 0 Jun 12 03:30 test2.otherpkglist

environment/gitrepo/pkglist:
total 0
-rw-r--r-- 1 root root 0 Jun 12 03:32 test1.pkglist
-rw-r--r-- 1 root root 0 Jun 12 03:32 test2.pkglist

environment/gitrepo/postinstall:
total 0
-rw-r--r-- 1 root root 0 Jun 12 03:29 test1.postinstall
-rw-r--r-- 1 root root 0 Jun 12 03:29 test2.postinstall

environment/gitrepo/syncfiles:
total 0
-rw-r--r-- 1 root root 0 Jun 12 03:13 synclist

environment/swdir:
total 8
drwxr-xr-x 2 root root 4096 Jun 12 03:39 otherpkgdir/
drwxr-xr-x 2 root root 4096 Jun 12 03:39 pkgdir/

environment/swdir/otherpkgdir:
total 0

environment/swdir/pkgdir:
total 0

  1. create correct files for synclist, otherpkglist, pkglist and postinstall

  2. Place the packages under correct directory under ohterpkgdir, pkgdir

  3. run import to get the osimage definition.

[root@c910f03c05k21 rhels]# 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
  1. run following command
[root@c910f03c05k21 rhels]# xcat-inventory export  -t osimage -o test.environments.osimage -f /tmp/export/test.environments.osimage.yaml --format yaml
  1. compare if the 2 yaml files are the same file.
[root@c910f03c05k21 rhels]#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 "^#"