From c2f92c7e7f54b86dee06b788f86e839a13e716a7 Mon Sep 17 00:00:00 2001 From: Ondrej Mejzlik Date: Oct 12 2020 12:16:47 +0000 Subject: Addig mirror directory hand test to upstream --- diff --git a/Regression/bz1228484-mirror-directory-hang/PURPOSE b/Regression/bz1228484-mirror-directory-hang/PURPOSE new file mode 100644 index 0000000..580b50d --- /dev/null +++ b/Regression/bz1228484-mirror-directory-hang/PURPOSE @@ -0,0 +1,5 @@ +PURPOSE of /CoreOS/lftp/Regression/bz1228484-mirror-directory-hang +Description: Test mirroring with subdirectories +Author: Martin Frodl +Bug summary: lftp hangs after dowloading one file during a mirror +Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1228484 diff --git a/Regression/bz1228484-mirror-directory-hang/main.fmf b/Regression/bz1228484-mirror-directory-hang/main.fmf new file mode 100644 index 0000000..368cd0c --- /dev/null +++ b/Regression/bz1228484-mirror-directory-hang/main.fmf @@ -0,0 +1,27 @@ +summary: Test mirroring with subdirectories +description: | + Bug summary: lftp hangs after dowloading one file during a mirror + Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1228484 +component: +- lftp +test: ./runtest.sh +framework: beakerlib +require: +- library(httpd/http) +recommend: +- lftp +- httpd +duration: 5m +enabled: true +tag: +- NoRHEL4 +- NoRHEL5 +- TIPfail_infra +- TIPfail_samba +- TIPfail_systemd +- TIPpass_Apps +relevancy: | + distro = rhel-4, rhel-5: False +extra-nitrate: TC#0544860 +extra-summary: /CoreOS/lftp/Regression/bz1228484-mirror-directory-hang +extra-task: /CoreOS/lftp/Regression/bz1228484-mirror-directory-hang diff --git a/Regression/bz1228484-mirror-directory-hang/runtest.sh b/Regression/bz1228484-mirror-directory-hang/runtest.sh new file mode 100755 index 0000000..d12803f --- /dev/null +++ b/Regression/bz1228484-mirror-directory-hang/runtest.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/lftp/Regression/bz1228484-mirror-directory-hang +# Description: Test mirroring with subdirectories +# Author: Martin Frodl +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2016 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 + +PACKAGES="lftp" + +random() { + tr -dc a-z < /dev/urandom | head -c 8 +} + +rlJournalStart + rlPhaseStartSetup + rlRun "rlImport httpd/http" + rlAssertRpm --all + + rlFileBackup --clean ${httpROOTDIR} + TESTDIR="${httpROOTDIR}/bz1228484" + + rlLogInfo "Creating directory tree on HTTP server" + mkdir ${TESTDIR} + cd ${TESTDIR} + for i in {1..4}; do + echo $(random) > $(random) + SUBDIR=$(random) + mkdir ${SUBDIR} + cd ${SUBDIR} + done + + rlRun "httpStart" + + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd ${TmpDir}" + rlPhaseEnd + + rlPhaseStartTest + LFTP='lftp -c "mirror -v -v -v http://localhost/bz1228484/"' + rlRun "rlWatchdog '${LFTP}' 8" 0 "Mirroring local server with lftp" + DOWNLOADED=$(du -s bz1228484 | awk '{ print $1 }') + TOTAL=$(du -s ${TESTDIR} | awk '{ print $1 }') + rlAssertEquals "Checking that all files have been downloaded" \ + ${DOWNLOADED} ${TOTAL} + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r ${TmpDir}" 0 "Removing tmp directory" + rlRun "httpStop" + rlRun "rlFileRestore" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd