adding active mode sanity test

This commit is contained in:
Ondrej Mejzlik 2020-10-21 10:41:02 +02:00
commit e01656a5f1
4 changed files with 173 additions and 0 deletions

View file

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/ftp/Sanity/cmdline-active-mode-with-20-port-blocked
# Description: Test for bz849940 and bz852636
# Author: Zbysek MRAZ <zmraz@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2011 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/ftp/Sanity/cmdline-active-mode-with-20-port-blocked
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: Zbysek MRAZ <zmraz@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for bz849940 and bz852636 (cmdline-active-mode-with-20-port-blocked)" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: ftp" >> $(METADATA)
@echo "Requires: ftp vsftpd" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 849940 852636" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,7 @@
PURPOSE of /CoreOS/ftp/Sanity/cmdline-active-mode-with-20-port-blocked
Description: Test for bz717409 (Connection failures during upload using PORT not handled cleanly)
Author: Your Name <root@redhat.com>
Bug summary: Connection failures during upload using PORT not handled cleanly
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=717409
The bug should be seen, when the error does not appear because of the connection hangout.

View file

@ -0,0 +1,30 @@
summary: Test for bz849940 and bz852636 (cmdline-active-mode-with-20-port-blocked)
description: |
Bug summary: Connection failures during upload using PORT not handled cleanly
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=717409
The bug should be seen, when the error does not appear because of the connection hangout.
component:
- ftp
test: ./runtest.sh
framework: beakerlib
recommend:
- ftp
- vsftpd
duration: 5m
enabled: true
tag:
- TIP_fedora_fail
- TIPfail_infra
- TIPfail_samba
- TIPfail_systemd
- TIPpass
- TIPpass_FIPS
- TIPpass_Security
- Tier1
- TierCandidatesPASS
- TipWaived6
tier: '1'
extra-nitrate: TC#0202993
extra-summary: /CoreOS/ftp/Sanity/cmdline-active-mode-with-20-port-blocked
extra-task: /CoreOS/ftp/Sanity/cmdline-active-mode-with-20-port-blocked

View file

@ -0,0 +1,72 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/ftp/Sanity/cmdline-active-mode-with-20-port-blocked
# Description: Test for bz849940 and bz852636
# Author: Zbysek MRAZ <zmraz@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2011 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/lib/beakerlib/beakerlib.sh
PACKAGE="ftp"
USER=Oleg
PASS=Ol€gp@ss
COMMANDS='ftpcommands'
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
if rlIsRHEL '<7.3'; then
rlRun "setsebool ftp_home_dir 1" 0 "Enable ftp to access home dir"
fi
rlRun "useradd $USER" 0 "Create testing user"
rlRun "echo 'testcontent' > /home/$USER/testfile" 0 "Creating test file"
rlRun "echo $PASS | passwd --stdin $USER"
rlRun "rlServiceStart vsftpd"
rlRun "iptables -I INPUT -p tcp --sport ftp-data -j REJECT --reject-with icmp-net-unreachable"
rlPhaseEnd
rlPhaseStartTest
echo -e "open 127.0.0.1\nuser $USER $PASS\nget testfile\n" > $COMMANDS
rlRun "/usr/bin/ftp -A -v -in 127.0.0.1 < $COMMANDS > output.log 2>&1 &"
sleep 40 # this should sufficient the 30sec timeout
killall ftp
rlAssertGrep "425 Failed to establish connection." output.log || cat output.log
# rlAssertGrep "426 Failure writing network stream." output.log || cat output.log
rlPhaseEnd
rlPhaseStartCleanup
rlRun "iptables -D INPUT 1"
rlRun "rlServiceRestore vsftpd"
rlRun "userdel -fr $USER" 0 "Remove testing user"
if rlIsRHEL '<7.3'; then
rlRun "setsebool ftp_home_dir 0" 0 "Return ftp_home_dir boolean back"
fi
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd