Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add kickstart tests for an NFS instrepo and addon repos.
These tests requires an NFS-accessible mirror of the Fedora tree as well as two specially constructed repositories to test the behavior of the repo command. The contents of the repositories are described in the comments in the kickstart files. Four new environment variables are used to configure the servers and paths.
- Loading branch information
Showing
5 changed files
with
299 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
nfs --server=NFS-SERVER --dir=NFS-PATH | ||
|
||
# The addon repos are setup with the following packages: | ||
# NFS: | ||
# - testpkg-nfs-core, to be installed with @core | ||
# - testpkg-nfs-addon, to be installed because we ask for it | ||
# - testpkg-share1, contains a file /usr/share/testpkg-2/nfs. To be installed by excluding | ||
# the HTTP version. | ||
# - testpkg-share2, contains a file /usr/share/testpkg-3/nfs. To be excluded via cost | ||
# HTTP: | ||
# - testpkg-http-core, to be installed with @core | ||
# - testpkg-http-addon, to be installed because we ask for it | ||
# - testpkg-share1, contains a file /usr/share/testpkg-2/http. To be excluded via excludepkgs. | ||
# - testpkg-share2, contains a file /usr/share/testpkg-3/http. To be included via cost. | ||
repo --name=kstest-nfs --baseurl=NFS-ADDON-REPO --cost=50 --install | ||
repo --name=kstest-http --baseurl=HTTP-ADDON-REPO --cost=25 --excludepkgs=testpkg-share2 --install | ||
|
||
install | ||
network --bootproto=dhcp | ||
|
||
bootloader --timeout=1 | ||
zerombr | ||
clearpart --all | ||
part --fstype=ext4 --size=4400 / | ||
part --fstype=ext4 --size=500 /boot | ||
part --fstype=swap --size=500 swap | ||
|
||
keyboard us | ||
lang en | ||
timezone America/New_York | ||
rootpw qweqwe | ||
shutdown | ||
|
||
%packages | ||
testpkg-nfs-addon | ||
testpkg-http-addon | ||
testpkg-share1 | ||
testpkg-share2 | ||
%end | ||
|
||
%post | ||
status=0 | ||
# Check that all the packages were installed | ||
for pkg in testpkg-nfs-core testpkg-nfs-addon testpkg-http-core testpkg-http-addon \ | ||
testpkg-share1 testpkg-share2 ; do | ||
if ! rpm -q $pkg ; then | ||
echo "*** package $pkg was not installed" >> /root/RESULT | ||
status=1 | ||
fi | ||
done | ||
if [[ "${status}" -eq 0 ]]; then | ||
# Check that the right packages were installed | ||
if [[ -e /usr/share/testpkg-1/http ]]; then | ||
echo "*** wrong version of testpkg-share1 was installed" >> /root/RESULT | ||
status=1 | ||
fi | ||
if [[ -e /usr/share/testpkg-2/nfs ]]; then | ||
echo "*** wrong version of testpkg-share2 was installed" >> /root/RESULT | ||
status=1 | ||
fi | ||
# Double check that the correct marker files are in place | ||
if [[ -e /usr/share/testpkg-1/nfs ]]; then | ||
echo "*** unable to find marker for testpkg-share1" >> /root/RESULT | ||
status=1 | ||
fi | ||
if [[ -e /usr/share/testpkg-2/http ]]; then | ||
echo "*** unable to find marker for testpkg-share2" >> /root/RESULT | ||
status=1 | ||
fi | ||
fi | ||
if [[ "${status}" -eq 0 ]]; then | ||
echo SUCCESS > /root/RESULT | ||
fi | ||
%end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# | ||
# Copyright (C) 2015 Red Hat, Inc. | ||
# | ||
# This copyrighted material is made available to anyone wishing to use, | ||
# modify, copy, or redistribute it subject to the terms and conditions of | ||
# the GNU General Public License v.2, or (at your option) any later version. | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY expressed or implied, including the implied warranties of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
# Public License for more details. You should have received a copy of the | ||
# GNU General Public License along with this program; if not, write to the | ||
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the | ||
# source code or documentation are not subject to the GNU General Public | ||
# License and may only be used or replicated with the express permission of | ||
# Red Hat, Inc. | ||
# | ||
# Red Hat Author(s): David Shea <dshea@redhat.com> | ||
|
||
kernel_args() { | ||
echo vnc inst.nodnf | ||
} | ||
|
||
prepare() { | ||
ks=$1 | ||
tmpdir=$2 | ||
|
||
if [[ "${TEST_ADDON_NFS_REPO}" == "" ]]; then | ||
echo \$TEST_ADDON_NFS_REPO is not set. | ||
return 1 | ||
fi | ||
|
||
if [[ "${TEST_ADDON_HTTP_REPO}" == "" ]]; then | ||
echo \$TEST_ADDON_HTTP_REPO is not set. | ||
return 1 | ||
fi | ||
|
||
if [[ "${TEST_NFS_SERVER}" == "" ]]; then | ||
echo \$TEST_NFS_SERVER is not set | ||
return 1 | ||
fi | ||
|
||
if [[ "${TEST_NFS_PATH}" == "" ]]; then | ||
echo \$TEST_NFS_PATH is not set | ||
return 1 | ||
fi | ||
|
||
sed -e "/^nfs/ s|NFS-SERVER|${TEST_NFS_SERVER}|" \ | ||
-e "/^nfs/ s|NFS-PATH|${TEST_NFS_PATH}|" \ | ||
-e "/^repo/ s|NFS-ADDON-REPO|${TEST_ADDON_NFS_REPO}|" \ | ||
-e "/^repo/ s|HTTP-ADDON-REPO|${TEST_ADDON_HTTP_REPO}|" ${ks} > ${tmpdir}/kickstart.ks | ||
echo ${tmpdir}/kickstart.ks | ||
} | ||
|
||
validate() { | ||
img=$1 | ||
|
||
# Check the /root/RESULT file for whether the test succeeded or not | ||
result=$(virt-cat -a ${img} -m /dev/sda2 /root/RESULT) | ||
if [[ $? != 0 ]]; then | ||
status=1 | ||
echo '*** /root/RESULT does not exist in VM image.' | ||
elif [[ "${result}" != "SUCCESS" ]]; then | ||
status=1 | ||
echo "${result}" | ||
fi | ||
|
||
return ${status} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
nfs --server=NFS-SERVER --dir=NFS-PATH | ||
|
||
# The addon repos are setup with the following packages: | ||
# NFS: | ||
# - testpkg-nfs-core, to be installed with @core | ||
# - testpkg-nfs-addon, to be installed because we ask for it | ||
# - testpkg-share1, contains a file /usr/share/testpkg-2/nfs. To be installed by excluding | ||
# the HTTP version. | ||
# - testpkg-share2, contains a file /usr/share/testpkg-3/nfs. To be excluded via cost | ||
# HTTP: | ||
# - testpkg-http-core, to be installed with @core | ||
# - testpkg-http-addon, to be installed because we ask for it | ||
# - testpkg-share1, contains a file /usr/share/testpkg-2/http. To be excluded via excludepkgs. | ||
# - testpkg-share2, contains a file /usr/share/testpkg-3/http. To be included via cost. | ||
repo --name=kstest-nfs --baseurl=NFS-ADDON-REPO --cost=50 --install | ||
repo --name=kstest-http --baseurl=HTTP-ADDON-REPO --cost=25 --excludepkgs=testpkg-share2 --install | ||
|
||
install | ||
network --bootproto=dhcp | ||
|
||
bootloader --timeout=1 | ||
zerombr | ||
clearpart --all | ||
part --fstype=ext4 --size=4400 / | ||
part --fstype=ext4 --size=500 /boot | ||
part --fstype=swap --size=500 swap | ||
|
||
keyboard us | ||
lang en | ||
timezone America/New_York | ||
rootpw qweqwe | ||
shutdown | ||
|
||
%packages | ||
testpkg-nfs-addon | ||
testpkg-http-addon | ||
testpkg-share1 | ||
testpkg-share2 | ||
%end | ||
|
||
%post | ||
status=0 | ||
# Check that all the packages were installed | ||
for pkg in testpkg-nfs-core testpkg-nfs-addon testpkg-http-core testpkg-http-addon \ | ||
testpkg-share1 testpkg-share2 ; do | ||
if ! rpm -q $pkg ; then | ||
echo "*** package $pkg was not installed" >> /root/RESULT | ||
status=1 | ||
fi | ||
done | ||
if [[ "${status}" -eq 0 ]]; then | ||
# Check that the right packages were installed | ||
if [[ -e /usr/share/testpkg-1/http ]]; then | ||
echo "*** wrong version of testpkg-share1 was installed" >> /root/RESULT | ||
status=1 | ||
fi | ||
if [[ -e /usr/share/testpkg-2/nfs ]]; then | ||
echo "*** wrong version of testpkg-share2 was installed" >> /root/RESULT | ||
status=1 | ||
fi | ||
# Double check that the correct marker files are in place | ||
if [[ -e /usr/share/testpkg-1/nfs ]]; then | ||
echo "*** unable to find marker for testpkg-share1" >> /root/RESULT | ||
status=1 | ||
fi | ||
if [[ -e /usr/share/testpkg-2/http ]]; then | ||
echo "*** unable to find marker for testpkg-share2" >> /root/RESULT | ||
status=1 | ||
fi | ||
fi | ||
if [[ "${status}" -eq 0 ]]; then | ||
echo SUCCESS > /root/RESULT | ||
fi | ||
%end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# | ||
# Copyright (C) 2015 Red Hat, Inc. | ||
# | ||
# This copyrighted material is made available to anyone wishing to use, | ||
# modify, copy, or redistribute it subject to the terms and conditions of | ||
# the GNU General Public License v.2, or (at your option) any later version. | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY expressed or implied, including the implied warranties of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
# Public License for more details. You should have received a copy of the | ||
# GNU General Public License along with this program; if not, write to the | ||
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the | ||
# source code or documentation are not subject to the GNU General Public | ||
# License and may only be used or replicated with the express permission of | ||
# Red Hat, Inc. | ||
# | ||
# Red Hat Author(s): David Shea <dshea@redhat.com> | ||
|
||
kernel_args() { | ||
echo vnc | ||
} | ||
|
||
prepare() { | ||
ks=$1 | ||
tmpdir=$2 | ||
|
||
if [[ "${TEST_ADDON_NFS_REPO}" == "" ]]; then | ||
echo \$TEST_ADDON_NFS_REPO is not set. | ||
return 1 | ||
fi | ||
|
||
if [[ "${TEST_ADDON_HTTP_REPO}" == "" ]]; then | ||
echo \$TEST_ADDON_HTTP_REPO is not set. | ||
return 1 | ||
fi | ||
|
||
if [[ "${TEST_NFS_SERVER}" == "" ]]; then | ||
echo \$TEST_NFS_SERVER is not set | ||
return 1 | ||
fi | ||
|
||
if [[ "${TEST_NFS_PATH}" == "" ]]; then | ||
echo \$TEST_NFS_PATH is not set | ||
return 1 | ||
fi | ||
|
||
sed -e "/^nfs/ s|NFS-SERVER|${TEST_NFS_SERVER}|" \ | ||
-e "/^nfs/ s|NFS-PATH|${TEST_NFS_PATH}|" \ | ||
-e "/^repo/ s|NFS-ADDON-REPO|${TEST_ADDON_NFS_REPO}|" \ | ||
-e "/^repo/ s|HTTP-ADDON-REPO|${TEST_ADDON_HTTP_REPO}|" ${ks} > ${tmpdir}/kickstart.ks | ||
echo ${tmpdir}/kickstart.ks | ||
} | ||
|
||
validate() { | ||
img=$1 | ||
|
||
# Check the /root/RESULT file for whether the test succeeded or not | ||
result=$(virt-cat -a ${img} -m /dev/sda2 /root/RESULT) | ||
if [[ $? != 0 ]]; then | ||
status=1 | ||
echo '*** /root/RESULT does not exist in VM image.' | ||
elif [[ "${result}" != "SUCCESS" ]]; then | ||
status=1 | ||
echo "${result}" | ||
fi | ||
|
||
return ${status} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters