From e01656a5f12ed1305f2a100fcb8cb39d7d10770f Mon Sep 17 00:00:00 2001 From: Ondrej Mejzlik Date: Wed, 21 Oct 2020 10:41:02 +0200 Subject: [PATCH] adding active mode sanity test --- .../Makefile | 64 +++++++++++++++++ .../PURPOSE | 7 ++ .../main.fmf | 30 ++++++++ .../runtest.sh | 72 +++++++++++++++++++ 4 files changed, 173 insertions(+) create mode 100644 Sanity/cmdline-active-mode-with-20-port-blocked/Makefile create mode 100644 Sanity/cmdline-active-mode-with-20-port-blocked/PURPOSE create mode 100644 Sanity/cmdline-active-mode-with-20-port-blocked/main.fmf create mode 100755 Sanity/cmdline-active-mode-with-20-port-blocked/runtest.sh diff --git a/Sanity/cmdline-active-mode-with-20-port-blocked/Makefile b/Sanity/cmdline-active-mode-with-20-port-blocked/Makefile new file mode 100644 index 0000000..8a7d09f --- /dev/null +++ b/Sanity/cmdline-active-mode-with-20-port-blocked/Makefile @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 " > $(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) diff --git a/Sanity/cmdline-active-mode-with-20-port-blocked/PURPOSE b/Sanity/cmdline-active-mode-with-20-port-blocked/PURPOSE new file mode 100644 index 0000000..c6a89b0 --- /dev/null +++ b/Sanity/cmdline-active-mode-with-20-port-blocked/PURPOSE @@ -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 +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. diff --git a/Sanity/cmdline-active-mode-with-20-port-blocked/main.fmf b/Sanity/cmdline-active-mode-with-20-port-blocked/main.fmf new file mode 100644 index 0000000..8a646de --- /dev/null +++ b/Sanity/cmdline-active-mode-with-20-port-blocked/main.fmf @@ -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 diff --git a/Sanity/cmdline-active-mode-with-20-port-blocked/runtest.sh b/Sanity/cmdline-active-mode-with-20-port-blocked/runtest.sh new file mode 100755 index 0000000..f3f9219 --- /dev/null +++ b/Sanity/cmdline-active-mode-with-20-port-blocked/runtest.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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