Adding new test

This commit is contained in:
Ondrej Mejzlik 2024-11-19 11:52:23 +01:00
commit 6c919f983f
2 changed files with 134 additions and 0 deletions

View file

@ -0,0 +1,33 @@
summary: Test for BZ#1566149 (rsync without --verbose still writes "(new))
description: |
Bug summary: rsync without --verbose still writes "(new) backup_dir is ..." to STDOUT
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1566149
component:
- rsync
test: ./runtest.sh
framework: beakerlib
recommend:
- rsync
duration: 5m
enabled: true
tag:
- NoRHEL4
- NoRHEL5
- NoRHEL6
- TIPfail_infra
- TIPpass
- Tier1
tier: '1'
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1566149
adjust:
- enabled: false
when: distro == rhel-4, rhel-5, rhel-6
continue: false
- enabled: false
when: purpose == gating and distro ~< rhel-8.2
continue: false
extra-nitrate: TC#0602368
extra-summary: /CoreOS/rsync/Regression/bz1566149-rsync-without-verbose-still-writes-new
extra-task: /CoreOS/rsync/Regression/bz1566149-rsync-without-verbose-still-writes-new
id: d69bd0b0-c6bb-43f3-9296-0e66a2dea078

View file

@ -0,0 +1,101 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/rsync/Regression/bz1566149-rsync-without-verbose-still-writes-new
# Description: Test for BZ#1566149 (rsync without --verbose still writes "(new))
# 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:-rsync}
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE || rlDie "Package $PACKAGE not installed"
rlLog "PC name: $(hostname), $(hostname -A) User: $(whoami)"
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir" 0 "Going into tmp directory $TmpDir"
rlPhaseEnd
rlGetTestState && {
rlPhaseStartTest "No verbose"
rlRun "mkdir src dst && touch src/file1 dst/file2" 0 "Create test files"
rlRun "rsync -aH --delete --backup --backup-dir=$TmpDir/BackupDir src/ dst/ &>log" 0 "Do backup"
echo "Log contents:"
cat log
rlRun "grep '(new) backup_dir' log" 1 "Without verbose (new) backup_dir must not be in log"
if [ -s log ]; then
rlFail "Log should be empty"
else
rlPass "Log is empty"
fi
rlPhaseEnd
rlPhaseStartTest "Clean before next phase"
ls
rlRun "rm -rf log src dst BackupDir" 0 "Remove temporary files"
ls
rlPhaseEnd
rlPhaseStartTest "Normal verbose"
rlRun "mkdir src dst && touch src/file1 dst/file2" 0 "Create test files"
rlRun "rsync -v -aH --delete --backup --backup-dir=$TmpDir/BackupDir1 src/ dst/ &>log" 0 "Do backup"
echo "Log contents:"
cat log
rlRun "grep '(new) backup_dir' log" 1 "With single -v (new) backup_dir is not in log"
if [ -s log ]; then
rlPass "Log should not empty though"
rlRun "grep 'sent .* bytes' log" 0 "Something is in the log"
else
rlFail "Log is empty"
fi
rlPhaseEnd
rlPhaseStartTest "Clean before next phase"
ls
rlRun "rm -rf log src dst BackupDir" 0 "Remove temporary files"
ls
rlPhaseEnd
rlPhaseStartTest "Increased verbose"
rlRun "mkdir src dst && touch src/file1 dst/file2" 0 "Create test files"
rlRun "rsync -vv -aH --delete --backup --backup-dir=$TmpDir/BackupDir1 src/ dst/ &>log" 0 "Do backup"
echo "Log contents:"
cat log
rlRun "grep 'backup_dir' log" 0 "With -vv (new) backup_dir should be in log"
if [ -s log ]; then
rlPass "Log is not empty"
rlRun "grep 'sent .* bytes' log" 0 "More than backup dir is in the log"
else
rlFail "Log is empty"
fi
rlPhaseEnd
}
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd