Skip to content

Commit

Permalink
Add unified test to install from the harddrive
Browse files Browse the repository at this point in the history
Create a partition, download ISO and expand it to the / in the pre section.
This test will work only if you have an unified ISO overridden to the
fragments.
  • Loading branch information
jkonecny12 committed May 21, 2019
1 parent 4f43fa4 commit 9084fec
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fragments/platform/fedora_rawhide/section-data/unified-iso.ks
@@ -0,0 +1,3 @@
# Create a variable in the pre/post section with link to a Rawhide unified ISO
# The curl tool will download this ISO and it will be processed later in the section.
ISO_LOCATION=<link to a unified ISO>
3 changes: 3 additions & 0 deletions fragments/platform/rhel8/section-data/unified-iso.ks
@@ -0,0 +1,3 @@
# Create a variable in the pre/post section with link to a RHEL-8 unified ISO
# The curl tool will download this ISO and it will be processed later in the section.
ISO_LOCATION=<link to a unified ISO>
57 changes: 57 additions & 0 deletions unified-harddrive.ks.in
@@ -0,0 +1,57 @@
#version=DEVEL
#test name: unified-nfs

# This test is for testing the install from an unified repository.
#
# You have to have unified ISO as a source mounted on the NFS server.
# To create unified ISO for Fedora you can use this tool:
# https://github.com/rhinstaller/devel-tools/tree/master/create_unified_iso
#
# This test has to have access to the NFS server. However NFS won't mount
# if the VM is behind a NAT (NFS problem). So this test won't work on our setup
# right now.
#

%ksappend common/common_no_payload.ks

harddrive --partition=/dev/sdb1 --dir=/

%ksappend payload/unified_packages.ks

%pre
# Add ISO_LOCATION with an url to the unified-iso
%ksappend section-data/unified-iso.ks
DISK="/dev/sdb"
PARTITION="/dev/sdb1"

# Prepare partition on the new disk
parted $DISK mklabel msdos
parted --align=none $DISK mkpart primary 0 14G
mkfs.ext4 $PARTITION
mkdir /prep-mount
mount $PARTITION /prep-mount

# Download the ISO
pushd /prep-mount
mkdir iso
curl -L $ISO_LOCATION -o ./iso/unified.iso

# Mount the ISO
mkdir iso-mount
mount ./iso/unified.iso iso-mount

# Copy ISO content inside
rsync -ahHvS --stats iso-mount/ ./

# Clean up
umount iso-mount
popd
umount /prep-mount
rmdir /prep-mount
%end

%post
%ksappend validation/unified.ks

%ksappend validation/success_if_result_empty.ks
%end
35 changes: 35 additions & 0 deletions unified-harddrive.sh
@@ -0,0 +1,35 @@
#
# Copyright (C) 2019 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): Jiri Konecny <jkonecny@redhat.com>

#TESTTYPE="packaging rhel-only"

TESTTYPE="knownfailure"

. ${KSTESTDIR}/functions.sh

UNIFIED_ISO=/home/jkonecny/RH/projects/kickstart-tests/work/Rawhide-server-unified.iso

prepare_disks() {
tmpdir=$1

qemu-img create -q -f qcow2 ${tmpdir}/disk-a.img 10G
qemu-img create -q -f qcow2 ${tmpdir}/disk-b.img 15G

echo ${tmpdir}/disk-a.img ${tmpdir}/disk-b.img
}

0 comments on commit 9084fec

Please sign in to comment.