Adding new test

This commit is contained in:
Ondrej Mejzlik 2023-07-12 13:04:54 +02:00
commit d2dff56ba9
4 changed files with 109 additions and 0 deletions

View file

@ -0,0 +1,32 @@
summary: Test basic behavior
description: ''
contact: Ondrej Mejzlik <omejzlik@redhat.com>
component:
- urlview
test: ./runtest.sh
framework: beakerlib
recommend:
- urlview
duration: 5m
enabled: true
tag:
- NoRHEL4
- NoRHEL5
- TIPfail_infra
- TIPfail_samba
- TIPfail_systemd
- TIPpass
- Tier1
- notier
tier: '1'
adjust:
- enabled: false
when: distro == rhel-4, rhel-5
continue: false
- enabled: false
when: arch == s390x
continue: false
extra-nitrate: TC#0597641
extra-summary: /CoreOS/urlview/Sanity/basic-sanity-test
extra-task: /CoreOS/urlview/Sanity/basic-sanity-test
id: c4f64066-f366-46ef-8a6f-314ba25e1b8f

View file

@ -0,0 +1,68 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/urlview/Sanity/basic-sanity-test
# Description: Test basic behavior
# Author: Ondrej Mejzlik <omejzlik@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/share/beakerlib/beakerlib.sh || exit 1
PACKAGE=${PACKAGE:-urlview}
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE || rlDie "Package $PACKAGE not installed"
rlLog "PC name: $(hostname) User: $(whoami)"
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "cp testfile.txt $TmpDir" 0 "Copy testfile to test directory"
rlRun "pushd $TmpDir" 0 "Going into tmp directory $TmpDir"
rlPhaseEnd
rlGetTestState && {
rlPhaseStartTest
# Will be killed by timeout
echo 'Test file contents:'
cat testfile.txt
rlRun "timeout 2 urlview testfile.txt &> out" 124 "Run urlview to generate output"
rlAssertGrep "1 https://www.google.com/" out
rlAssertGrep "2 https://www.redhat.com" out
rlLog "Only links should be in the out file"
rlAssertNotGrep "Excellent" out 0
rlRun "urlview fakefile 1>/dev/null 2>out1" 1 "Try nonexistent file"
rlAssertGrep 'No such file or directory' out1
echo "Command error output:"
cat out1
rlRun "urlview fakefile | grep 'No URLs found'" 0 "No url should be found in nonexistent file"
rlRun "urlview /dev/null | grep 'No URLs found'" 0 "Try /dev/null"
rlRun "urlview /home | grep 'No URLs found'" 0 "Try to use a directory as input"
rlBundleLogs urlview out out1
rlPhaseEnd
}
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,3 @@
# Setup
Run manually on s390x

View file

@ -0,0 +1,6 @@
We are now ready to begin the test properly.
First link:
https://www.google.com/
More text below the first very very interesting link.
https://www.redhat.com
Excellent.