Copy over gating tests from branch rhel-8.8.0
Signed-off-by: Chris Leech <cleech@redhat.com>
This commit is contained in:
parent
e60bf1e362
commit
94b563651d
1
tests/.fmf/version
Normal file
1
tests/.fmf/version
Normal file
@ -0,0 +1 @@
|
|||||||
|
1
|
62
tests/iscsi-target-initiator-restraint/Makefile
Normal file
62
tests/iscsi-target-initiator-restraint/Makefile
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Makefile of /kernel/test_beakertask/Sanity/beaker_nvr_test
|
||||||
|
# Description: Install VDO
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 2 of
|
||||||
|
# the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be
|
||||||
|
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
# warranty 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, see http://www.gnu.org/licenses/.
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
export TEST=/beaker_nvr_test
|
||||||
|
export TESTVERSION=1.0
|
||||||
|
|
||||||
|
BUILT_FILES=
|
||||||
|
|
||||||
|
FILES=$(METADATA) runtest.sh Makefile PURPOSE
|
||||||
|
|
||||||
|
.PHONY: all install download clean
|
||||||
|
|
||||||
|
run: $(FILES) build
|
||||||
|
./runtest.sh
|
||||||
|
|
||||||
|
build: $(BUILT_FILES)
|
||||||
|
test -x runtest.sh || chmod a+x runtest.sh
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *~ $(BUILT_FILES)
|
||||||
|
|
||||||
|
|
||||||
|
include /usr/share/rhts/lib/rhts-make.include
|
||||||
|
|
||||||
|
$(METADATA): Makefile
|
||||||
|
@echo "Owner: Andy Walsh <awalsh@redhat.com>" > $(METADATA)
|
||||||
|
@echo "Name: $(TEST)" >> $(METADATA)
|
||||||
|
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||||
|
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||||
|
@echo "Description: Creates iSCSI target/initiator, and logs it in locally" >> $(METADATA)
|
||||||
|
@echo "Type: Sanity" >> $(METADATA)
|
||||||
|
@echo "TestTime: 5m" >> $(METADATA)
|
||||||
|
@echo "RunFor: test_beakertask" >> $(METADATA)
|
||||||
|
@echo "Requires: test_beakertask" >> $(METADATA)
|
||||||
|
@echo "Priority: Normal" >> $(METADATA)
|
||||||
|
@echo "License: GPLv2+" >> $(METADATA)
|
||||||
|
@echo "Confidential: no" >> $(METADATA)
|
||||||
|
@echo "Destructive: no" >> $(METADATA)
|
||||||
|
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)
|
||||||
|
|
||||||
|
rhts-lint $(METADATA)
|
3
tests/iscsi-target-initiator-restraint/PURPOSE
Normal file
3
tests/iscsi-target-initiator-restraint/PURPOSE
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
PURPOSE Create an iSCSI target/initiator environment
|
||||||
|
Description: Set up and Log into an iSCSI target locally.
|
||||||
|
Author: Andy Walsh <awalsh@redhat.com>
|
115
tests/iscsi-target-initiator-restraint/runtest.sh
Executable file
115
tests/iscsi-target-initiator-restraint/runtest.sh
Executable file
@ -0,0 +1,115 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# runtest.sh for iSCSI target/initiator test
|
||||||
|
# Description: Set up and Log into an iSCSI target locally.
|
||||||
|
# Author: Andy Walsh <awalsh@redhat.com>
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Copyright (c) 2019 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 2 of
|
||||||
|
# the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be
|
||||||
|
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
# warranty 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, see http://www.gnu.org/licenses/.
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
# Include Beaker environment
|
||||||
|
. /usr/bin/rhts-environment.sh || exit 1
|
||||||
|
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||||
|
|
||||||
|
# Set up a target IQN to use through the test.
|
||||||
|
targetIQN=iqn.2019-03.com.redhat.test:testtargetname
|
||||||
|
targetIP=127.0.0.1
|
||||||
|
|
||||||
|
# Minimum size required for loopback device. Sometimes software (like VDO)
|
||||||
|
# needs more than ~10G.
|
||||||
|
minimumSize=15
|
||||||
|
|
||||||
|
rlJournalStart
|
||||||
|
|
||||||
|
rlPhaseStartSetup
|
||||||
|
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||||
|
rlRun "pushd $TmpDir"
|
||||||
|
|
||||||
|
# Determine the size of the loopback device we're going to use
|
||||||
|
# (Free space on rootfs minus 1G)
|
||||||
|
loopbackSize=$(($(df --sync --output=avail / | tail -1) * 1024 - 1024*1024*1024))
|
||||||
|
if [ ${loopbackSize} -lt $((1024*1024*1024*${minimumSize})) ]; then
|
||||||
|
rlDie "Not enough space to create the loopback device"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create the backing store and then set up the loopback device.
|
||||||
|
rlRun "truncate -s ${loopbackSize} $TmpDir/loop0.bin" 0 "Laying out loopfile backing"
|
||||||
|
rlRun "losetup /dev/loop0 $TmpDir/loop0.bin" 0 "Creating loopdevice"
|
||||||
|
|
||||||
|
# Check whether we have the iscsi utilities installed, and if we don't,
|
||||||
|
# then install them. If this is being tested in OSCI, I believe that
|
||||||
|
# the package will be pre-installed when we get to this point.
|
||||||
|
if ! rlCheckRpm iscsi-initiator-utils; then
|
||||||
|
yum install -y iscsi-initiator-utils
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! rlCheckRpm targetcli; then
|
||||||
|
yum install -y targetcli
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f /etc/iscsi/initiatorname.iscsi ]; then
|
||||||
|
. /etc/iscsi/initiatorname.iscsi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make sure the target service is running.
|
||||||
|
rlRun "systemctl start target"
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
rlPhaseStartTest
|
||||||
|
# Gather some system information for debug purposes
|
||||||
|
rlRun "uname -a"
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
rlPhaseStartTest "Set up target"
|
||||||
|
rlRun "targetcli backstores/block create name=loopback_device dev=/dev/loop0"
|
||||||
|
rlRun "targetcli iscsi/ create ${targetIQN}"
|
||||||
|
rlRun "targetcli iscsi/${targetIQN}/tpg1/acls create ${InitiatorName}"
|
||||||
|
rlRun "targetcli iscsi/${targetIQN}/tpg1/luns create lun=100 /backstores/block/loopback_device"
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
rlPhaseStartTest "Set up initiator (Log into target)"
|
||||||
|
rlRun "iscsiadm --mode discovery --type sendtargets --portal ${targetIP}"
|
||||||
|
rlRun "iscsiadm --mode node --target ${targetIQN} -l"
|
||||||
|
|
||||||
|
# Occasionally logging into the iSCSI target and checking for the LUNs
|
||||||
|
# being presented and handled by udev seems to falsely cause the next check
|
||||||
|
# to fail. Adding a short sleep seems to fix that.
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
if [ ! -L /dev/disk/by-path/ip-${targetIP}\:3260-iscsi-${targetIQN}-lun-100 ]; then
|
||||||
|
rlFail "iSCSI LUN not found"
|
||||||
|
fi
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
rlPhaseStartCleanup
|
||||||
|
# Log out of the target and tear down the iSCSI target configuration
|
||||||
|
rlRun "iscsiadm --mode node -u"
|
||||||
|
rlRun "targetcli iscsi/ delete ${targetIQN}"
|
||||||
|
rlRun "targetcli backstores/block delete loopback_device"
|
||||||
|
|
||||||
|
rlRun "losetup -d /dev/loop0" 0 "Deleting loopdevice"
|
||||||
|
rlRun "rm -f $TmpDir/loop0.bin" 0 "Removing loopfile backing"
|
||||||
|
rlRun "popd"
|
||||||
|
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
rlJournalPrintText
|
||||||
|
rlJournalEnd
|
5
tests/provision.fmf
Normal file
5
tests/provision.fmf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
standard-inventory-qcow2:
|
||||||
|
qemu:
|
||||||
|
m: 2G
|
37
tests/tests.yml
Normal file
37
tests/tests.yml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
# Tests suitable to run in classic environment
|
||||||
|
- hosts: localhost
|
||||||
|
roles:
|
||||||
|
- role: standard-test-beakerlib
|
||||||
|
tags:
|
||||||
|
- classic
|
||||||
|
tests:
|
||||||
|
- iscsi-target-initiator-restraint
|
||||||
|
required_packages:
|
||||||
|
- targetcli
|
||||||
|
|
||||||
|
- hosts: localhost
|
||||||
|
roles:
|
||||||
|
- role: standard-test-basic
|
||||||
|
# python-stqe cannot be installed on 'atomic', no need to run on 'container'
|
||||||
|
tags:
|
||||||
|
- classic
|
||||||
|
repositories:
|
||||||
|
- repo: "https://gitlab.com/rh-kernel-stqe/python-stqe.git"
|
||||||
|
dest: "python-stqe"
|
||||||
|
version: 535ecebf5611e158079d806b6232e3d2c68f0d93
|
||||||
|
tests:
|
||||||
|
# Install python-stqe first
|
||||||
|
# make sure we use same version of libsan
|
||||||
|
- install_stqe:
|
||||||
|
dir: python-stqe
|
||||||
|
run: pip3 install libsan==0.3.0 && python3 setup.py install --prefix=
|
||||||
|
- iscsi-initiator-utils:
|
||||||
|
dir: ./
|
||||||
|
run: stqe-test run -t iscsi/iscsi_params.py
|
||||||
|
required_packages:
|
||||||
|
# required for python-stqe
|
||||||
|
- python3-pyyaml
|
||||||
|
- python3-netifaces
|
||||||
|
- python3-augeas
|
||||||
|
- python3-pip
|
Loading…
Reference in New Issue
Block a user