diff --git a/Sanity/bodycheck/main.fmf b/Sanity/bodycheck/main.fmf old mode 100644 new mode 100755 index 3245429..dee5055 --- a/Sanity/bodycheck/main.fmf +++ b/Sanity/bodycheck/main.fmf @@ -8,6 +8,7 @@ framework: beakerlib recommend: - postfix - nc + - pflogsumm duration: 20m enabled: true tag: diff --git a/Sanity/bodycheck/runtest.sh b/Sanity/bodycheck/runtest.sh index d128cb0..80942e6 100755 --- a/Sanity/bodycheck/runtest.sh +++ b/Sanity/bodycheck/runtest.sh @@ -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 diff --git a/Sanity/headercheck/main.fmf b/Sanity/headercheck/main.fmf old mode 100644 new mode 100755 diff --git a/Sanity/headercheck/runtest.sh b/Sanity/headercheck/runtest.sh index aeacde5..b316bfc 100755 --- a/Sanity/headercheck/runtest.sh +++ b/Sanity/headercheck/runtest.sh @@ -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 diff --git a/Sanity/pflogsumm/TC#0044098.fmf b/Sanity/pflogsumm/TC#0044098.fmf new file mode 100755 index 0000000..7f7c6c0 --- /dev/null +++ b/Sanity/pflogsumm/TC#0044098.fmf @@ -0,0 +1,32 @@ +contact: Patrik Moško +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 diff --git a/Sanity/pflogsumm/TC#0575963.fmf b/Sanity/pflogsumm/TC#0575963.fmf new file mode 100755 index 0000000..e3e7c86 --- /dev/null +++ b/Sanity/pflogsumm/TC#0575963.fmf @@ -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 diff --git a/Sanity/pflogsumm/TC#0587347.fmf b/Sanity/pflogsumm/TC#0587347.fmf new file mode 100755 index 0000000..556fe60 --- /dev/null +++ b/Sanity/pflogsumm/TC#0587347.fmf @@ -0,0 +1,32 @@ +contact: Patrik Moško +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 diff --git a/Sanity/pflogsumm/TC#0603564.fmf b/Sanity/pflogsumm/TC#0603564.fmf new file mode 100755 index 0000000..49bacc9 --- /dev/null +++ b/Sanity/pflogsumm/TC#0603564.fmf @@ -0,0 +1,33 @@ +contact: Patrik Moško +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 diff --git a/Sanity/pflogsumm/TC#0611128.fmf b/Sanity/pflogsumm/TC#0611128.fmf new file mode 100755 index 0000000..3f16918 --- /dev/null +++ b/Sanity/pflogsumm/TC#0611128.fmf @@ -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 diff --git a/Sanity/pflogsumm/main.fmf b/Sanity/pflogsumm/main.fmf new file mode 100755 index 0000000..fb057a7 --- /dev/null +++ b/Sanity/pflogsumm/main.fmf @@ -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 diff --git a/Sanity/pflogsumm/runtest.sh b/Sanity/pflogsumm/runtest.sh new file mode 100755 index 0000000..c4bd118 --- /dev/null +++ b/Sanity/pflogsumm/runtest.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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