add test to fedora

This commit is contained in:
Ondrej Mejzlik 2022-07-13 13:06:28 +02:00
commit dd2d759d77
2 changed files with 103 additions and 0 deletions

View file

@ -0,0 +1,35 @@
summary: Test for BZ#861113 (FTP client does not expand home directory)
description: |
Test for BZ#861113 (FTP client does not expand home directory)
contact: Ondrej Mejzlik <omejzlik@redhat.com>
component:
- ftp
test: ./runtest.sh
framework: beakerlib
recommend:
- ftp
- sudo
- expect
duration: 5m
enabled: true
tag:
- NoRHEL3
- NoRHEL4
- NoRHEL5
- TIPfail_infra
- TIPfail_samba
- TIPfail_systemd
- TIPpass_FIPS
- TIPpass_Security
- Tier3
- TipWaived6
tier: '3'
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=861113
adjust:
- enabled: false
when: distro == rhel-3, rhel-4, rhel-5
continue: false
extra-nitrate: TC#0267067
extra-summary: /CoreOS/ftp/Regression/bz861113-FTP-client-does-not-expand-home-directory
extra-task: /CoreOS/ftp/Regression/bz861113-FTP-client-does-not-expand-home-directory

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/ftp/Regression/bz861113-FTP-client-does-not-expand-home-directory
# Description: Test for BZ#861113 (FTP client does not expand home directory)
# Author: Lukas Novy <lnovy@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2013 Red Hat, Inc. All rights reserved.
#
# 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 version 2.
#
# 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, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="ftp"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlAssertRpm sudo
rlAssertRpm expect
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
USERNAME="bz861113"
EHOME="/home/$USERNAME"
RHOME=$HOME
LOGFILE="sudo-ftp-lcd.log"
rlRun "useradd -m -d $EHOME $USERNAME"
rlFileBackup /root/.ssh
rlRun "rm -rf /root/.ssh" 0 "Remove any current keys"
rlRun "ssh-keygen -N '' -f '/root/.ssh/id_rsa'" 0 "Generate keys"
rlRun "cat /root/.ssh/*.pub > /root/.ssh/authorized_keys"
rlPhaseEnd
rlPhaseStartTest
rlLog "Current home is $RHOME"
rlRun "expect -c 'spawn ssh -o StrictHostKeyChecking=no localhost; expect root; send \"sudo -u $USERNAME ftp\n\" ;expect ftp; send \"lcd ~\n\"; expect directory' > $LOGFILE 2>&1" 0 "Running ftp through expect+ssh+sudo and asking it to lcd ~"
rlLog "Expected home is $EHOME"
rlAssertGrep $EHOME $LOGFILE
rlAssertNotGrep $RHOME $LOGFILE
rlPhaseEnd
rlPhaseStartCleanup
rlRun "userdel -f $USERNAME"
#rlBundleLogs ftp $LOGFILE
rlFileRestore
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd