Adding pflogsumm test

adjusting previous tests to not influence pflogsumm test
This commit is contained in:
Frantisek Hrdina 2022-07-21 10:09:48 +02:00
commit fef4bd2c18
11 changed files with 282 additions and 5 deletions

1
Sanity/bodycheck/main.fmf Normal file → Executable file
View file

@ -8,6 +8,7 @@ framework: beakerlib
recommend:
- postfix
- nc
- pflogsumm
duration: 20m
enabled: true
tag:

View file

@ -36,6 +36,7 @@ rlJournalStart
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlServiceStart "rsyslog"
if rlIsRHEL 5; then
rlServiceStop "sendmail"
fi
@ -44,6 +45,7 @@ rlJournalStart
rlFileBackup "/etc/postfix/main.cf"
rlFileBackup "/etc/postfix/vmailbox"
rlFileBackup "/etc/postfix/virtual"
rlFileBackup "/var/log/maillog"
rlPhaseEnd
rlPhaseStartSetup
@ -120,19 +122,25 @@ EOF
rlRun "rm -rf /var/mail/vhosts"
#rlRun "postqueque -p"
#rlRun "postfix flush"
#rlRun "postqueue -f"
rlServiceStop "postfix"
rlFileRestore
rlRun "rm -rf /etc/postfix/vmailbox.db"
rlRun "rm -rf /etc/postfix/virtual.db"
rlRun "rm -rf /etc/postfix/body_checks"
#bash
if rlIsRHEL 5; then
rlServiceRestore "sendmail"
rlServiceStop "postfix"
else
rlServiceRestore "postfix"
fi
rlFileRestore
#rlRun "echo test"
#bash
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

0
Sanity/headercheck/main.fmf Normal file → Executable file
View file

View file

@ -36,6 +36,8 @@ rlJournalStart
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlServiceStart "rsyslog"
if rlIsRHEL 5; then
rlServiceStop "sendmail"
fi
@ -44,6 +46,7 @@ rlJournalStart
rlFileBackup "/etc/postfix/main.cf"
rlFileBackup "/etc/postfix/vmailbox"
rlFileBackup "/etc/postfix/virtual"
rlFileBackup "/var/log/maillog"
rlPhaseEnd
rlPhaseStartSetup
@ -122,18 +125,26 @@ EOF
rlRun "rm -rf /var/mail/vhosts"
rlServiceStop "postfix"
rlFileRestore
rlRun "rm -rf /etc/postfix/vmailbox.db"
rlRun "rm -rf /etc/postfix/virtual.db"
rlRun "rm -rf /etc/postfix/header_checks"
#rlRun "postqueque -p"
#rlRun "postfix flush"
#rlRun "postqueue -f"
#bash
if rlIsRHEL 5; then
rlServiceRestore "sendmail"
rlServiceStop "postfix"
else
rlServiceRestore "postfix"
fi
#bash
rlFileRestore
#rlRun "postqueque -p"
#rlRun "postfix flush"
#rlRun "postqueue -f"
#bash
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

32
Sanity/pflogsumm/TC#0044098.fmf Executable file
View file

@ -0,0 +1,32 @@
contact: Patrik Moško <pmosko@redhat.com>
component:
- perl-Date-Calc
- postfix
- perl
tag:
- FedoraBroken
- NoApps
- NoModularTier
- NoRHEL3
- TIPfail_infra
- TIPpass
- TIPpass_Apps
- Tier1
- notier_apps
- postfix::LOGS::pflogsumm
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=531303
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=644346
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=540508
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=555349
adjust:
- enabled: false
when: product == rhscl
continue: false
- enabled: false
when: distro == rhel-3
continue: false
extra-nitrate: TC#0044098
extra-summary: /CoreOS/postfix/Sanity/pflogsumm
extra-pepa: |
PACKAGES= component/perl

11
Sanity/pflogsumm/TC#0575963.fmf Executable file
View file

@ -0,0 +1,11 @@
tag:
- NoRHEL3
- TIPfail_infra
- TIPpass
- Tier1
adjust:
- enabled: false
when: distro < rhel-8
continue: false
extra-nitrate: TC#0575963
extra-summary: /CoreOS/postfix/Sanity/pflogsumm

32
Sanity/pflogsumm/TC#0587347.fmf Executable file
View file

@ -0,0 +1,32 @@
contact: Patrik Moško <pmosko@redhat.com>
component:
- postfix
- perl-Date-Calc
- perl
environment:
MODSTREAMS: perl:5.24
tag:
- 082fdf2f
- FedoraBroken
- NoApps
- NoRHEL3
- TIPfail
- TIPfail_infra
- TIPpass_Apps
- TestCaseCopy
- Tier1
- perl:5.24
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=531303
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=540508
adjust:
- enabled: false
when: distro < rhel-8
continue: false
- enabled: false
when: distro > rhel-8
continue: false
extra-nitrate: TC#0587347
extra-summary: /CoreOS/postfix/Sanity/pflogsumm [perl:5.24]
extra-pepa: |
PACKAGES= component/perl

33
Sanity/pflogsumm/TC#0603564.fmf Executable file
View file

@ -0,0 +1,33 @@
contact: Patrik Moško <pmosko@redhat.com>
component:
- postfix
- perl-Date-Calc
- perl
environment:
MODSTREAMS: perl:5.30
tag:
- FedoraBroken
- NoApps
- NoRHEL3
- TIPfail
- TIPpass_Apps
- TestCaseCopy
- Tier1
- perl:5:30
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=531303
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=540508
adjust:
- enabled: false
when: distro > rhel-8
continue: false
- enabled: false
when: distro < rhel-8
continue: false
- enabled: false
when: distro ~< rhel-8.3
continue: false
extra-nitrate: TC#0603564
extra-summary: /CoreOS/postfix/Sanity/pflogsumm [perl:5.30]
extra-pepa: |
PACKAGES= component/perl

25
Sanity/pflogsumm/TC#0611128.fmf Executable file
View file

@ -0,0 +1,25 @@
environment:
MODSTREAMS: perl:5.26
tag:
- FedoraBroken
- NoApps
- NoRHEL3
- TIPfail_infra
- TIPpass
- TIPpass_Apps
- TestCaseCopy
- Tier1
- notier_apps
- perl:5.26
- postfix::LOGS::pflogsumm
adjust:
- enabled: false
when: distro < rhel-8
continue: false
- enabled: false
when: distro > rhel-8
continue: false
extra-nitrate: TC#0611128
extra-summary: /CoreOS/postfix/Sanity/pflogsumm [perl:5.26]
extra-pepa: |
PACKAGES= component/perl

34
Sanity/pflogsumm/main.fmf Executable file
View file

@ -0,0 +1,34 @@
summary: Basic sanity test for postfix log summarizer
description: |
Test basic functionality of pflogsumm -- postfix log summarizer.
* set up postfix as default MTA
* send an email
* check whether it's correctly reported in the summary
This checks also underlying perl-Date-Calc module which
is required by pflogsumm package.
contact: fhrdina@redhat.com
component:
- perl:5.26
- perl-Date-Calc
- perl
- postfix
test: ./runtest.sh
path: /Sanity/pflogsumm
framework: beakerlib
recommend:
- postfix
- mailx
- s-nail
- postfix-perl-scripts
- postfix-pflogsumm
- rsyslog
duration: 10m
enabled: true
tier: '1'
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=531303
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=540508
extra-summary: /CoreOS/postfix/Sanity/pflogsumm
extra-task: /CoreOS/postfix/Sanity/pflogsumm

90
Sanity/pflogsumm/runtest.sh Executable file
View file

@ -0,0 +1,90 @@
#!/bin/bash
# vim: dict=/usr/share/rhts-library/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/postfix/Sanity/pflogsumm
# Description: Basic sanity test for postfix log summarizer
# Author: Petr Splichal <psplicha@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 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 rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="postfix"
MailLog="/var/log/maillog"
rlJournalStart
rlPhaseStartSetup Setup
#bash
rlAssertRpm $PACKAGE
rlFileBackup /var/lib/alternatives/mta
rlRun "rpm -q postfix-pflogsumm || rpm -q postfix-perl-scripts"
rpm -q --quiet sendmail && rlServiceStop "sendmail"
getsebool -a | grep allow_postfix_local_write_mail_spool \
&& rlRun "setsebool -P allow_postfix_local_write_mail_spool 1" \
0 "allow full write access to mail spool"
#bash
rlFileBackup /etc/alternatives $MailLog
#bash
rlRun "alternatives --set mta /usr/sbin/sendmail.postfix"
rlRun ": > $MailLog" \
0 "truncate mail log"
rpm -q rsyslog \
&& rlServiceStart rsyslog
#rlRun "sudo rm -rv $MailLog"
#bash
rlServiceStart postfix
rlRun "cat $MailLog"
#bash
rlRun "perl -e 'print join \"\\n\", @INC'"
rlRun "tail -n0 -f /var/log/audit/audit.log &"
rlPhaseEnd
rlPhaseStartTest Testing
#bash
rlRun "echo \"Summary test\" | sendmail -v root@localhost <<< \"hi!\"" 0 "Sending test email"
sleep 3
rlRun "cat $MailLog"
rlRun "pflogsumm $MailLog"
rlRun "pflogsumm $MailLog | grep 'Traffic Summary'"
rlRun "pflogsumm $MailLog | grep -P '^\s*1\s*received\s*\$'"
#bash
#bash
rlPhaseEnd
rlPhaseStartCleanup Cleanup
rlRun "kill $!"
rlRun "mailq"
rlServiceStop postfix
rlServiceRestore postfix
rlFileRestore
semanage boolean -d allow_postfix_local_write_mail_spool
rpm -q rsyslog && rlServiceRestore rsyslog
rpm -q --quiet sendmail && rlServiceRestore "sendmail"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd